Previous  |  Next  >  
Product: Volume Manager Guides   
Manual: Volume Manager 4.1 Administrator's Guide   

Resizing a Volume

Resizing a volume changes the volume size. For example, you might need to increase the length of a volume if it is no longer large enough for the amount of data to be stored on it. To resize a volume, use one of the commands: vxresize (preferred), vxassist, or vxvol. Alternatively, you can use the graphical VERITAS Enterprise Administrator (VEA) to resize volumes.

If a volume is increased in size, the vxassist command automatically locates available disk space. The vxresize command requires that you specify the names of the disks to be used to increase the size of a volume. The vxvol command requires that you have previously ensured that there is sufficient space available in the plexes of the volume to increase its size. The vxassist and vxresize commands automatically free unused space for use by the disk group. For the vxvol command, you must do this yourself. To find out by how much you can grow a volume, use the following command:


vxassist [-g diskgroup] maxgrow volume

When you resize a volume, you can specify the length of a new volume in sectors, kilobytes, megabytes, or gigabytes. The unit of measure is added as a suffix to the length (s, m, k, or g). If no unit is specified, sectors are assumed. The vxassist command also allows you to specify an increment by which to change the volume's size.


Caution  Caution    If you use vxassist or vxvol to resize a volume, do not shrink it below the size of the file system which is located on it. If you do not shrink the file system first, you risk unrecoverable data loss. If you have a VxFS file system, shrink the file system first, and then shrink the volume. Other file systems may require you to back up your data so that you can later recreate the file system and restore its data.

Resizing Volumes using vxresize

Use the vxresize command to resize a volume containing a file system. Although other commands can be used to resize volumes containing file systems, the vxresize command offers the advantage of automatically resizing certain types of file system as well as the volume.

See the following table for details of what operations are permitted and whether the file system must first be unmounted to resize the file system:

Permitted Resizing Operations on File Systems

Online JFS (Full-VxFS) Base JFS (Lite-VxFS) HFS
Mounted File System

Grow and shrink

Not allowed

Not allowed

Unmounted File System

Grow only

Grow only

Grow only

For example, the following command resizes the 1-gigabyte volume, homevol, in the disk group, mydg, that contains a VxFS file system to 10 gigabytes using the spare disks mydg10 and mydg11:


vxresize -g mydg -b -F vxfs -t homevolresize homevol 10g \
  mydg10 mydg11

The -b option specifies that this operation runs in the background. Its progress can be monitored by specifying the task tag homevolresize to the vxtask command.

Note the following restrictions for using vxresize:

  • vxresize works with VxFS, JFS (derived from VxFS) and HFS file systems only.
  • In some situations, when resizing large volumes, vxresize may take a long time to complete.
  • Resizing a volume with a usage type other than FSGEN or RAID5 can result in loss of data. If such an operation is required, use the -f option to forcibly resize such a volume.
  • You cannot resize a volume that contains plexes with different layout types. Attempting to do so results in the following error message:

  • VxVM vxresize ERROR V-5-1-2536 Volume volume has different organization in each mirror
    To resize such a volume successfully, you must first reconfigure it so that each data plex has the same layout.

For more information about the vxresize command, see the vxresize(1M) manual page.

Resizing Volumes using vxassist

The following modifiers are used with the vxassist command to resize a volume:

  • growto---increase volume to a specified length
  • growby---increase volume by a specified amount
  • shrinkto---reduce volume to a specified length
  • shrinkby---reduce volume by a specified amount

Extending to a Given Length

To extend a volume to a specific length, use the following command:


vxassist [-b] [-g diskgroup] growto volume length 
Note   Note    If specified, the -b option makes growing the volume a background task.

For example, to extend volcat to 2000 sectors, use the following command:


vxassist -g mydg growto volcat 2000 
Note   Note    If you previously performed a relayout on the volume, additionally specify the attribute layout=nodiskalign to the growto command if you want the subdisks to be grown using contiguous disk space.

Extending by a Given Length

To extend a volume by a specific length, use the following command:


vxassist [-b] [-g diskgroup] growby volume length
Note   Note    If specified, the -b option makes growing the volume a background task.

For example, to extend volcat by 100 sectors, use the following command:


vxassist -g mydg growby volcat 100 
Note   Note    If you previously performed a relayout on the volume, additionally specify the attribute layout=nodiskalign to the growby command if you want the subdisks to be grown using contiguous disk space.

Shrinking to a Given Length

To shrink a volume to a specific length, use the following command:


vxassist [-g diskgroup] shrinkto volume length 

For example, to shrink volcat to 1300 sectors, use the following command:


vxassist -g mydg shrinkto volcat 1300 
Caution  Caution    Do not shrink the volume below the current size of the file system or database using the volume. The vxassist shrinkto command can be safely used on empty volumes.

Shrinking by a Given Length

To shrink a volume by a specific length, use the following command:


vxassist [-g diskgroup] shrinkby volume length 

For example, to shrink volcat by 300 sectors, use the following command:


vxassist -g mydg shrinkby volcat 300 
Caution  Caution    Do not shrink the volume below the current size of the file system or database using the volume. The vxassist shrinkby command can be safely used on empty volumes.

Resizing Volumes using vxvol

To change the length of a volume using the vxvol set command, use the following command:


vxvol [-g diskgroup] set len=length volume

For example, to change the length of the volume, vol01, in the disk group, mydg, to 100000 sectors, use the following command:


vxvol -g mydg set len=100000 vol01
Note   Note    The vxvol set len command cannot increase the size of a volume unless the needed space is available in the plexes of the volume. When the size of a volume is reduced using the vxvol set len command, the freed space is not released into the disk group's free space pool.

If a volume is active and its length is being reduced, the operation must be forced using the -o force option to vxvol. This prevents accidental removal of space from applications using the volume.

The length of logs can also be changed using the following command:


# vxvol [-g diskgroup] set loglen=length log_volume 
Note   Note    Sparse log plexes are not valid. They must map the entire length of the log. If increasing the log length would make any of the logs invalid, the operation is not allowed. Also, if the volume is not active and is dirty (for example, if it has not been shut down cleanly), the log length cannot be changed. This avoids the loss of any of the log contents (if the log length is decreased), or the introduction of random data into the logs (if the log length is being increased).
 ^ Return to Top Previous  |  Next  >  
Product: Volume Manager Guides  
Manual: Volume Manager 4.1 Administrator's Guide  
VERITAS Software Corporation
www.veritas.com