How to grow a ZFS volume

How to grow a ZFS Volume.

Assume the following is true:
Pool Name: fort Volume Name: vol1 Mount Point: /mnt/vol1
1. Display file system mount status
[sourcecode language="plain"]
# df -h /mnt/vol1/
Filesystem size used avail capacity Mounted on
/dev/zvol/dsk/fort/vol1
962M 1.0M 903M 1% /mnt/vol1
[/sourcecode]
Notice its 1Gig in size (962M formatted).

2. Display current ZFS volume size and reservation properties
[sourcecode language="plain"]
# zfs get volsize,reservation fort/vol1
NAME PROPERTY VALUE SOURCE
fort/vol1 volsize 1G -
fort/vol1 reservation 1G local
[/sourcecode]
Confirms the volume is 1Gig in size with a 1Gig reservation.

3. Change the volsize ZFS property for fort/vol1 to 2Gig.
[sourcecode language="plain"]
# zfs set volsize=2g fort/vol1
[/sourcecode]

4. Confirm the changes were made by displaying the volsize and reservation ZFS properties.
[sourcecode language="plain"]
# zfs get volsize,reservation fort/vol1
NAME PROPERTY VALUE SOURCE
fort/vol1 volsize 2G -
fort/vol1 reservation 2G local
[/sourcecode]
Notice the "volsize" is now set to 2Gig. At this point, the OS doesnt see the expanded file system. In order for the OS to see the size, you will have to expand the file system with "growfs".

5. Run growfs to expand mounted file system
[sourcecode language="plain"]
# growfs -M /mnt/vol1 /dev/zvol/rdsk/fort/vol1
Warning: 2048 sector(s) in last cylinder unallocated
/dev/zvol/rdsk/fort/vol1: 4194304 sectors in 683 cylinders of 48 tracks, 128 sectors
2048.0MB in 49 cyl groups (14 c/g, 42.00MB/g, 20160 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 86176, 172320, 258464, 344608, 430752, 516896, 603040, 689184, 775328,
3359648, 3445792, 3531936, 3618080, 3704224, 3790368, 3876512, 3962656,
4048800, 4134944
[/sourcecode]
The output should now show you the new volume size.

6. Confirm the size of mounted file system using df or dd.
[sourcecode language="plain"]
# df -h /mnt/vol1/
Filesystem size used avail capacity Mounted on
/dev/zvol/dsk/fort/vol1
1.9G 2.0M 1.8G 1% /mnt/vol1

# dd if=/dev/zvol/dsk/fort/vol1 of=/dev/null bs=1024k
2048+0 records in
2048+0 records out
[/sourcecode]

Thats it! Growing a ZFS volume is an online operation in my mind.