How do I grow a zvol?

All your general support questions for OpenZFS on OS X.

How do I grow a zvol?

Postby perry » Wed Jul 08, 2020 10:35 am

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
perry
 
Posts: 12
Joined: Mon Mar 09, 2015 7:27 am

Re: How do I grow a zvol?

Postby lundman » Thu Jul 09, 2020 7:27 pm

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
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: How do I grow a zvol?

Postby perry » Mon Jul 13, 2020 10:50 pm

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
perry
 
Posts: 12
Joined: Mon Mar 09, 2015 7:27 am


Return to General Help

Who is online

Users browsing this forum: Google [Bot] and 20 guests