How to grow zfs on FreeBSD running inside VMWare

Live ZFS resizing inside VMWare should be possible, but there are several steps:

– First you should resize your virtual disk in VMWare configuration. Recomendation is all virtual disks to be similar size for best performance in VMWare.
– Ideally VMWare should notify guest OS that resize happened. You should be able to see that with `diskinfo -v /dev/daX` command. If it didn’t happen – you’ll probably need to reboot at this point.

root@:~ # gpart show
=> 34 335544253 da0 GPT (160G)
34 1024 1 freebsd-boot (512K)
1058 4194304 2 freebsd-swap (2.0G)
4195362 331348925 3 freebsd-zfs (158G)

=> 34 335544253 da1 GPT (160G)
34 1048576 1 freebsd-boot (512M)
1048610 4194304 2 freebsd-swap (2.0G)
5242914 330301373 3 freebsd-zfs (157G)

=> 34 356515773 da2 GPT (170G)
34 1048576 1 freebsd-boot (512M)
1048610 4194304 2 freebsd-swap (2.0G)
5242914 351272893 3 freebsd-zfs (167G)

The new space will appear visible after partition 3 on each disk.

– Next you should resize your partition with `gpart resize …`. Hope it is the past one, otherwise this problem may have no easy solution. It should be doable for mounted filesystem. In my example commands are:

gpart resize -i 3 da0
gpart resize -i 3 da1
gpart resize -i 3 da2

– Next you should make ZFS to resize with `zpool online -e …`.
See output of `zpool status` command:

root@:~ # zpool status
pool: zroot
state: ONLINE
scan: scrub repaired 0 in 1h6m with 0 errors on Fri May 18 19:56:44 2018
config:

NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
gpt/zfs0 ONLINE 0 0 0
gpt/zfs1 ONLINE 0 0 0
gpt/zfs2 ONLINE 0 0 0

errors: No known data errors

So in the example you must execute following commands:

zpool online -e zroot gpt/zfs0
zpool online -e zroot gpt/zfs1
zpool online -e zroot gpt/zfs2

It’s good to execute `zpool scrub zroot`.

This site uses Akismet to reduce spam. Learn how your comment data is processed.