• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

VxVM tutorials : Volume resize with vxassist and vxresize

by admin

VxVM Tutorials
  • Installing VxvM in VMware virtual machine
  • Creating Basic volume and file system
  • Volume layouts and layered volumes
  • Comparing layered and non-layered Volumes
  • Root disk Encapsulation and Mirroring
  • Replacing a failed disk under VxVM

It is very common now a days to increase the size of mount point or the volume being used in the production without any downtime. Veritas volume manager provides this facility with vxassist and vxresize commands. Now to resize a volume you must know the remaining space in the disk group. The space remaining in a disk group may vary according to the layout of the volume you want to create in that DG. For example, the space remaining to create a mirrored volume is not same as space required to create a concat volume. Lets see how we can see different ways to find space remaining to create different volume layouts.

Maxsize Vs maxgrow

The syntax to find the space remaining in a DG using maxsize is :

# vxassist -g DG_name maxsize layout=Layout

For example the maximum size mirrored volume that can be created in Disk group mydg can be found out by using :

# vxassist -g mydg maxsize layout=mirror
Maximum volume size: 1820672 (889Mb)

To find out maxsize of volumes with different layouts just change the layout attribute to raid5, concat, stripe-mirror etc.

Now we can find the size to which an existing volume can grow using the maxgrow. There is a difference in maxgrow and maxsize. Maxsize is used to find the size to which a new volume can be grown to and maxgrow is to find the size to which an existing volume can be grown to. The syntax of using maxgrow with vxassist is :

# vxassist -g DG_name maxgrow Volume_name

for example

# vxassist -g mydg maxgrow myvol
Volume myvol can be extended by 1955840 to: 4052992 (1979Mb)

Now this is tricky, the size 1979Mb is the final size to which the volume can grow to if it uses the complete space in the DG. So even when I grow it by 100MB and see the output of maxgrow command it would again show me that the myvol can be grown to 1979Mb size. In that case you can use the maxsize command to see the remaining space in the DG.

Volume resizing examples

There are multiple ways to resize a volume using vxassist.
1. growto – to grow a volume to a specif volume size
2. growby – to grow a volume by a specific size
3. shrinkto – to shrink a volume to a specific size
4. shrinkby – to shrink a volume by a specific size
The syntax is as follows:

# vxassist -g DG_name [growby|growto|shrinkby|shrinkto] Volume_name size[m|g|blocks]

To find out the current size of the volume:

# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1324.05m healthy   concat   -

To grow the volume myvol by 100mb

# vxassist -g mydg growby myvol 100m
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1424.05m healthy   concat   -

To shrink volume myvol by 100m (use -f incase of error, use it carefully as it may damage the data)

# vxassist -g mydg shrinkby [-f] myvol 100m
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1324.05m healthy   concat   -

To grow volume myvol to 1600 MB

# vxassist -g mydg growto myvol 1600m
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1600.00m healthy   concat   -

Now we can similarly shrink the volume to a specific size. I had to use -f to force the shrink.

# vxassist -g mydg -f shrinkto myvol 1500m
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1500.00m healthy   concat   -

Resizing both volume and file system online using vxresize

All the command used above changes only the size of the underlying volume. To increase the size of volume as well as the file system above it, we can use vxresize. Let us see an example, I have a mount point /data on top of the volume myvol.

# df -h |grep data
/dev/vx/dsk/mydg/myvol   1.5G    17M   1.4G     2%    /data
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1500.00m healthy   concat   -

Lets now increase the volume as well as FS by 100MB

# vxresize -g mydg myvol 1600m

Now you can see both FS and volume size has been increased by 100MB

# df -h |grep data
/dev/vx/dsk/mydg/myvol   1.6G    17M   1.4G     2%    /data
# /opt/VRTSsfmh/bin/vxlist vol
TY   VOLUME   DISKGROUP         SIZE STATUS    LAYOUT   LINKAGE
vol  myvol    mydg          1600.00m healthy   concat   -

I hope the article was informative. Do comment if you have any doubts.

Filed Under: VxVM Tagged With: solaris, VxVM

Some more articles you might also be interested in …

  1. VxVM tutorials : Replacing a failed disk under VxVM
  2. VxVM tutorials : Root disk Encapsulation and Mirroring
  3. VxVM tutorials : Comparing layered and non-layered volumes
  4. VxVM tutorials : Volume layouts and layered volumes
  5. VxVM Tutorials : Creating Volume and file system

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright