Expand/resize single disk

Status
Not open for further replies.

Erik

Cadet
Joined
Aug 16, 2011
Messages
2
Expand/resize a single disk.

In this tutorial the 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.
Screen shot 2011-08-16 at 12.18.51.png

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 -

:smile:

This link gave me some directions and insight how to do it.
http://forums.freebsd.org/showthread.php?t=17436
 

Erik

Cadet
Joined
Aug 16, 2011
Messages
2
I understand that ZFS expansion (in this FreeNAS version) is not supported, but as you can see I managed to expand the disk. So it is expanded for me as an end-user.

Or are these steps not 'the way to go' if I wanted to expand a FreeNAS data-disk?
 
Joined
May 27, 2011
Messages
566
I understand that ZFS expansion (in this FreeNAS version) is not supported, but as you can see I managed to expand the disk. So it is expanded for me as an end-user.

Or are these steps not 'the way to go' if I wanted to expand a FreeNAS data-disk?

well it looks like it worked, but i wouldn't trust it one bit.

i did have to make a small change to my last post, pools can expand, vdevs cannot. it seems like you found a way too do it. that being said i doubt there has been enough testing to make sure what you did is bug free under all circumstances. if i get some free time later this week I'll mess around with this. I'd advice much caution to you and anyone reading this.
 
J

jpaetzel

Guest
ZFs was designed to grow in exactly this manner, and I'l note that I do it on production systems quite frequently. The PC-BSD build servers are ESXi VMs running ZFS and have been expanded this way twice, as are the Gnome, KDE, and QAT tinderboxes for the FreeBSD project, which have had one expansion each.
 
G

gcooper

Guest
The problem with changing the partitions (as I discovered today when someone tried importing a pool from a Nexenta box, then replacing the disk on the fly via the GUI with the Replace button), is that unless things are consistent in terms of partition size, you can trigger bugs in FreeNAS that are difficult to unravel without database surgery and/or minor pulling out of hair.

So, if at all possible I highly suggest avoiding command line modifications like this...
 
Status
Not open for further replies.
Top