Friday, November 23, 2012

Increasing the size of ZFS volume online



How to increase the size of a ZFS Volume online.

ZFS is one of the great feature that Solaris has and good to see how easily we can manage the filesystem.

1. Display file system mount status

# df -h /mnt/test/test_vol/
Filesystem             size   used  avail capacity  Mounted on
/dev/zvol/dsk/test/test_vol
                       962M   1.0M   903M     1%    /test/test_vol


2. Display current ZFS volume size and reservation properties

# zfs get volsize,reservation test/test_vol
NAME          PROPERTY     VALUE          SOURCE
test/test_vol  volsize              1G                   -
test/test_vol  reservation        1G                  local

Confirms the volume is 1Gig in size with a 1Gig reservation.

3. Change the volsize ZFS property for test/test_vol to 10Gig.

# zfs set volsize=10g test/test_vol

4. Confirm the changes were made by displaying the volsize and reservation ZFS properties.

# zfs get volsize,reservation test/test_vol
NAME          PROPERTY     VALUE          SOURCE
test/test_vol  volsize              10G                 -
test/test_vol  reservation        10G                local

Notice the volsize is now set to 10G. At this point, the OS doesnt see the expanded file system. We will have to use "growfs" to increase the filesystem size

5. Run growfs to expand mounted file system

# growfs -M /mnt/test/test_vol /dev/zvol/rdsk/test/test_vol

The output should now show you the new volume size.

6. Confirm the size of mounted file system using df or dd.

# df -h /mnt/testtest_vol/
Filesystem             size   used  avail capacity  Mounted on
/dev/zvol/dsk/test/test_vol
                       9.9G   2.0M   9.8G     1%    /mnt/test/test_vol

That is how you increase the size of the ZFS volume online

No comments:

Post a Comment