FreeNAS Expand / Resize disk
Expand/resize a single disk.
FreeNAS machine is running on VMware ESXi (the VMware VMFS volumes are configured on RAID-disks, so the FreeNAS does not need to be configured for RAID anymore).
After you have setup a FreeNAS machine with a single-data-disk and want to expand/resize it later on, this is how I managed it.
I have an 20GB disk resized to 40GB.
Shut down the FreeNAS-guest and resize the data-disk with in VMware.
After booting up the FreeNAS-guest, open a console session.
# zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 17.9G 4.64G 13.2G 25% ONLINE –
# zpool status sataC_1
pool: sataC_1
state: ONLINE
scrub: scrub completed after 0h0m with 0 errors on Tue Aug 16 10:50:18 2011
config:
NAME STATE READ WRITE CKSUM
sataC_1 ONLINE 0 0 0
gpt/da1 ONLINE 0 0 0
errors: No known data errors
# camcontrol readcap da1 -h
Device Size: 40 G, Block Length: 512 bytes
# gpart show da1
=> 34 41942973 da1 GPT (40G) [CORRUPT]
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 37748575 2 freebsd-zfs (18G)
# zpool export sataC_1
# gpart status da1
Name Status Components
da1p1 CORRUPT da1
# gpart recover da1
da1 recovered
# gpart status da1
Name Status Components
da1p1 OK da1
# gpart show da1
=> 34 83886013 da1 GPT (40G)
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 37748575 2 freebsd-zfs (18G)
41943007 41943040 – free – (20G)
Resize the second partition (index 2)
# gpart resize -i 2 da1
da1p2 resized
# gpart show da1
=> 34 83886013 da1 GPT (40G)
34 94 – free – (47K)
128 4194304 1 freebsd-swap (2.0G)
4194432 79691615 2 freebsd-zfs (38G)
# zpool import
pool: sataC_1
id: 699091794103901671
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
sataC_1 ONLINE
gpt/da1 ONLINE
# zpool import sataC_1
# zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 17.9G 4.64G 13.2G 25% ONLINE –
🙁
#reboot
# zpool list sataC_1
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
sataC_1 37.9G 4.64G 33.2G 12% ONLINE –