ZFS Increasing size of ZFS disks in VMware

With FreeBSD as a guest OS in VMware, where the installation of FreeBSD is done on ZFS (also booting from ZFS), increasing the size of the zpool is possible in 2 ways:

- Add a new disk in VMware, and add the new drive with zpool add zroot da1 for example.

But I 'd rather not add a disk, but increase the size of the disk in VMware, and then let ZFS do the magic. But, I can't get it to work..

There is the zpool autoexpand property (that defaults to 'off', but I've set it to 'on'), but ZFS is not 'autoexpand-ing' at all.

How does this work? I can't find any clues in the man pages.
 
It should work 'automagically'. At least for physical hardware. I have for example exchanged my 4 x 2TB RAIDZ for 4 x 3TB. The additional space only became available when all the drivers where replaced. I had replaced one drive at a time, resilvering after each swap. It took a while but it worked without issues.
 
Please show us the output of gpart show -lp.

In this case, it's an install of FreeBSD with ZFS on root (from the installer), and later on I've added a second disk in Vmware and added that disk to the zroot pool with zpool add.

So:
Code:
# zpool status
  pool: zroot
state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          da0p3     ONLINE       0     0     0
          da1       ONLINE       0     0     0

errors: No known data errors
[root@server /home/admin]# zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zroot  17.9G  4.04G  13.8G    22%  1.00x  ONLINE  -


Code:
# gpart show -lp
=>      34  20971453    da0  GPT  (10G)
        34      1024  da0p1  gptboot0  (512K)
      1058   2097152  da0p2  swap0  (1.0G)
   2098210  18873277  da0p3  zfs0  (9.0G)

Because da1 was added directly, there is no GPT info.

I've tried increasing the size of the second disk (da1), and the first (da0) - but I'm not getting any extra space in ZFS.
 
That's probably because the disks have been partitioned. Although the disk increased in size the partition will stay the same. If it's the last partition on the disk you should be able to resize it using gpart resize. You're probably going to have to do that from a Live-CD, I'm not sure you can do this when the partition is in use.

The disks I've replaced in my RAID-Z have all been 'dedicated', i.e. there are no partitions on them.
 
Live ZFS resizing inside VMWare should be possible, but there are several steps:
- First you should resize your virtual disk in VMWare configuration.
- 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.
- 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.
- Next you should make ZFS to resize with `zpool online -e ...`.
 
Back
Top