Decreases the size of a volume.
Note: Shrinking a thin-provisioned volume is not supported in the current release.
Before shrinking a volume, be sure that whatever is using the volume (file system, application) is able to recognize and handle the new size of the volume. The new volume size will not be recognized by hosts currently connected to the volume unless they support file system shrinking.
You must set the volume offline before shrinking it. Therefore, it is recommended that you first cleanly stop all activity on the volume (unmount file systems, stop or quiesce applications).
If a volume is configured for replication, decreasing the volume size will also decrease the local replication reserve and the replica reserve, as these are calculated as a percentage of the volume reserve. Changes take effect the next time the volume is replicated.
If you have snapshot space reserved for a volume, decreasing the volume size will, by default, decrease the amount of snapshot reserve, as this is also calculated as a percentage of volume reserve. However, if the amount of in-use space for snapshots would exceed the new reserve percentage, the percentage is automatically increased enough to preserve the existing snapshots.
For example, consider a 100GB volume with a 100% snapshot reserve and 80GB (80%) of snapshots. If you shrink the volume to 50GB, a 100% snapshot reserve now represents only 50GB of space. The percentage will be increased to 160% to avoid deleting any snapshots.
If the amount of in-use snapshot reserve was 40GB (40% of the original volume size), shrinking the volume to 50GB means the snapshots now use 80% of the new snapshot reserve. The percentage will not be increased, because no snapshots are at risk of deletion.
To leave the percentage (but not the amount) of snapshot space unchanged, use the no-adjust-snap-resv option. If the original snapshot reserve percentage was 100% before shrinking the volume, this option keeps it at 100% of the new volume size. Therefore, some existing snapshots may be deleted.
By default, a snapshot of the volume is created before the volume size is decreased. Use the no-snap option to skip the creation of a snapshot.
Format
volume select vol_name shrink new_size [parameters]
Variables
|
vol_name |
Name of a volume to shrink. |
|
new_size[GB] |
New smaller size for the volume. The size is assumed to be in megabytes unless you specify otherwise. You can specify size with any of the following suffixes: m, mb, MB, g, gb, or GB. |
Parameters
|
no-snap |
Does not create a snapshot of the volume before reducing its size. |
|
no-adjust-snap-resv |
Maintains the same percentage of snapshot reserve for the volume, based on the new volume size. May result in the loss of existing snapshots. |
Example
The following commands set volume bigvol offline and shrink it from 100GB to 50GB, creating a snapshot:
> volume select bigvol offline
> volume select bigvol shrink 50g
Be sure the file system and/or application using the volume supports volumes getting smaller. Shrinking a volume could result in losing data. Using the no-adjust-snap-resv option can result in losing old snapshots. Do you really want to continue? (y/n) [n]y
Creating snapshot.