How to calculate vxvm volume size and objects size

I am very sure that many of the Unix beginners(i e. veritas volume manager) will be struggling to calculate the values from “vxprint” output and “vxdisk” output to determine the size of the objects like volume,plex,subdisks and disk. Off course there is no easy way to get the values in MB or GB using veritas command. You need to calculate it your self.
We can calculate these values using script as well.

The formula is very simple.
Size in GB = value/2/1024/1024
Size in MB = value/2/1024

Operating system: Solaris 10
Veritas volume manager version:6.0

Here we will some example about calculating various values.

# vxprint -hv
Disk group: UADG

v  vol1         fsgen        ENABLED  204800   -        ACTIVE   -       -
pl vol1-01      vol1         ENABLED  204800   -        ACTIVE   -       -
sd DISK1-01     vol1-01      ENABLED  143056   0        -        -       -
sd DISK2-01     vol1-01      ENABLED  61744    143056   -        -       -

Using the above command output,we can calculate the size of the volume (vol1),size of the plex (vol1-01), and the size of the subdisks (DISK1-01,DISK2-01).

Calculating the volume size:
Volume size in MB = 204800/2/1024 = 100MB

bash-3.00# bc

Calculating the Plex size:
Plex size in MB=204800/2/1024=100MB

Calculating the Subdisk size:
Subdisk size in MB (DISK1-01) = 143056/2/1024=69MB
Subdisk size in MB (DISK2-01) = 61744/2/1024=30MB

bash-3.00# bc
bash-3.00# bc

Now we will see how to determine the disk size using vxdisk command.Even though we have many options in OS level to determined that.But let see from veritas level.Once the disk has been brought to veritas control ,VXVM will automatically make public and private region on the disk.By calculating the public region size can determine the disk size. For your information private region size will be always 32MB from VXVM 4.0 on-wards unless until you manually set it while doing vxdisksetup .

Here we go …

# vxdisk list disk_4 |egrep -i "private|public" |grep -v flags
public:    slice=2 offset=65744 len=143056 disk_offset=48
private:   slice=2 offset=208 len=65536 disk_offset=48

disk_4 = vxvm disk name;

Calculating the disk size:
Disk size in MB (disk_4) = Public region + private region
Public region size = 143056/2/1024 = 69MB
Private region size = 65536/2/1024 = 32MB

Disk Size is 101MB . 

To Determine the VXVM diskgroup size:
The below command will give the diskgroup size in MB.
Here the disk group name is UADG.
Note:You need to enter the command in one line. 

bash-3.00# echo `/usr/sbin/vxprint -g UADG -dF "%publen" | awk 'BEGIN {s = 0} {s += $1} END {print s}'`/2/1024|bc

To get the diskgroup size in GB 
Diskgroup Name:UADG
Note:You need to enter the command in one line.

bash-3.00# echo `/usr/sbin/vxprint -g UADG -dF "%publen" | awk 'BEGIN {s = 0} {s += $1} END {print s}'`/2/1024/1024|bc

To know the disk group free space,
#vxassist -g diskgroup_name maxsize

Unixarena has script to calculate these values.You can visit it here as well.

Hope this clear your doubt regarding the objects size in veritas volume manager.

Thank you for visiting.Please leave a comment if you have any doubt . I will get back to you.



  1. Hi ,

    Very useful information, thanks a lot.


  2. thanks for the article. why is the division by 2 ?