Tell me how to increase the virtual disk with ZFS?

Paul Kraus paul at
Sat May 11 15:39:16 UTC 2013

On May 11, 2013, at 11:13 AM, Alexander Yerenkow <yerenkow at> wrote:

2013/5/11 Paul Kraus <paul at
> On May 11, 2013, at 10:03 AM, Alexander Yerenkow <yerenkow at> wrote:
> > There's no mature (or flexible, or "can do what I want" ) way to
> > increase/decrease disk sizes in FreeBSD for now {ZFS,UFS}.
> > Best and quickest way - to have twice spare space, copy data, create new
> > sufficient disk and copy back.
> Is this a statement or a question ? If a statement, then it is factually FALSE. If it is supposed to be a question, it does not ask anything.
> It was a statement, and luckily I was partially wrong, as Vladislav did made what he wanted to.
> However, last time I checked there were no such easy ways to decrease zpools

Correct, there is currently no way to decrease the size of a zpool. That would require a defragmentation utility, which is on the roadmap as part of the bp_rewrite code enhancement (and has been for many, many years :-)

> or increase/decrease UFS partitions.

> Or grow mirrored ZFS as easily as single zpool.

This one I do not understand. I have grown mirrored zpools many times. Let's say you have a 2-way mirror of 1 TB drives. You can do one of two things to grow the zpool:

1) add another pair of drives (of any size) as another top level vdev  mirror device (you *can* use a different type of top level vdev, raidZ, simple, etc, but that is not recommended for both redundancy and performance predictability reasons).

2) swap out one of the 1 TB drives for a 2 TB (zpool replace), you can even offline one of the halves of the mirror to do this (but remember that you are vulnerable to a failure of the remaining drive during the resolver period), let the zpool resolver, then swap out the other 1 TB drive for a 2 TB. If the auto expand property is set, then once the resolver finishes you have doubled your net capacity.

> Or (killer one) remove added by mistake vdev from zpool ;)

Don't make that mistake. Seriously. If you are managing storage you need to be double checking every single command you issue if you care about your data integrity. You could easily make the same complaint about issuing an 'rm -rf' in the wrong directory (I know people who have done that). If you are using snapshots you may be safe, if not your data is probably gone.

On the other hand, depending on where in the tree you added the vdev, you may be able to remove it. If it is a top level vdev, then you have just changed the configuration of the zpool. While very not supported, you just might be able, using zdb and rolling back to a TXG before you added the device, remove the vdev. A good place to ask that question and have the discussion would be the ZFS discuss list at illumos (the list discussion is not limited to illumos, but covers all aspects of ZFS on all platforms). Archives here: 

> Of course I'm not talking about real hw, rather virtual one.

Doesn't matter to ZFS, whether a drive is a physical, a partition, or a virtual disk you perform the same operations.

> If you happen to point me somewhere to have such task solved I'd be much appreciated.

See above :-) Some of your issues I addressed above, others are not there (and may never be).

Paul Kraus
Deputy Technical Director, LoneStarCon 3
Sound Coordinator, Schenectady Light Opera Company

More information about the freebsd-questions mailing list