Page 1 of 1

How do I grow a zvol?

PostPosted: Wed Jul 08, 2020 10:35 am
by perry
I'm probably missing the obvious here.

I use zvols on a server for time machine backups. So from MacOS's perspective, each is a separate disk, and diskutil knows that it's (in this case) ~539G large. And it's getting full (bad planning on my part).

How do I grow it? I have lots of space in the pool, but the zvol's partition map "knows" how big it is. Diskutil knows how to grow a partition into free space, but it doesn't seem to know how to grow the whole disk into space that miraculously appeared at its end. I don't really want to hand-edit the partition map if I can avoid it...

(FWIW, this is a thinly provisioned zvol. Not that I think that matters here.)

Thanks
-- perry

Re: How do I grow a zvol?

PostPosted: Thu Jul 09, 2020 7:27 pm
by lundman
zfs set volsize=newG pool/zvol

where newG is your new size, like 10g, 20g etc. Once that is done, you can use diskutil to grow it afaik

Re: How do I grow a zvol?

PostPosted: Mon Jul 13, 2020 10:50 pm
by perry
Thanks. I knew I was missing something obvious. :)

For the record, after setting the volsize of the zvol, the invocation to make MacOS actually use the new space is
$ diskutil repairdisk /dev/disk11 # "repair" (reconstruct) the partition map to cover the whole new disk
$ diskutil resizevolume /dev/disk11s2 R # grow the partition to maximum size (filling the new partition space)

Substitute your own disk names, obviously. Resizevolume performs a full fsck on the filesystem, which can take a while. Note the magical "R" size indicator.

Cheers
-- perry