How to decrease a Volume ?

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

How to decrease a Volume ?

Postby tobi » Wed Feb 14, 2024 8:28 am

Hi folks,

I am very new to zfs and I have build the following mirror with 4 x 12TB:

Code: Select all
zpool list
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zfspool  10.9T  1.40T  9.51T        -         -     0%    12%  1.00x    ONLINE


Code: Select all
zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
zfspool         10.8T  1.98G  1.93M  /Volumes/zfspool
zfspool/tmmini   508G   486G  24.1G  -
zfspool/tmpro   2.03T  1.64T   400G  -
zfspool/zfsvol  8.25T  7.27T  1008G  -


I have tried to make zfsvol as big as possible and then I have build several APFS-Partitions (not visible in the output above) on it.

Know I am wondering if this was a good idea.

Where are the snapshots saved ? Is there enough space anywhere ?

Can I decrease zfsvol ? I would like to decrease it so that I have just 80% of the pool used. Is it possible to decrease with data in it ?

Regards
Tobias
tobi
 
Posts: 2
Joined: Thu Sep 15, 2016 10:05 am

Re: How to decrease a Volume ?

Postby Sharko » Thu Feb 15, 2024 10:40 pm

I'm having trouble understanding your pool - did you mirror all four 12TB disks together into a quadruply redundant vdev? Meaning the exact same data is striped on all four disks? So that the 48TB of raw space is collapsed down into a single logical storage space of 12TB? A 'zpool status' command output would clarify your pool structure.

To answer your question: zvols really can't be shrunk in place. You set aside a certain amount of space from the zpool when it is created, and then the native OS (MacOS in this case) sees that as a new, uninitialized disk. If you want to make it smaller you'll have to come up with a second large zpool to create a second zvol on it, and then init that with MacOS, and then copy over data from your original zvol. If you truly have four disks mirrored into a single zpool you can easily 'detach' one of those disks, and reuse it temporarily as a second zpool (by doing a zpool create on it).

I find space utilization to be super hard to understand where zvols are in use. Basically, the parent of the zvol(s) knows that a certain amount of space was set aside when you created the zvol, and so that gets subtracted from total of the disk and thus AVAIL for the parent looks reasonable. For the child zvol I don't know how it is computing AVAIL; it's almost like it adds back in the size of the zvol as though you could conceivably increase the size of the zvol, except the parent operating system won't let you do that.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: How to decrease a Volume ?

Postby tobi » Fri Feb 16, 2024 1:52 am

You guessed right:

Code: Select all
NAME STATE     READ WRITE CKSUM
zfspool ONLINE       0     0     0
   mirror-0 ONLINE       0     0     0
      disk1  ONLINE       0     0     0
      disk2  ONLINE       0     0     0
      disk3  ONLINE       0     0     0
      disk4  ONLINE       0     0     0


At first there will be 4 mirrored disks. But one of it i will remove periodically and bring it in another city (to my mum ;-)). So there will be "just" 3 disks left.
Some data is synced with Resilio to another computer. So there is another backup partially.

Indeed I have solved it with one of the disk. I have used it as a separate pool, copied all the data from the zvol, made the zvol new with compression on but smaller and copied all back.

No I am wondering if it is very rational to turn on compression on a zfs-volume with apfs (apple filesystem) on top of it. The compression ratio ist just 1.02 for now. ... ???
tobi
 
Posts: 2
Joined: Thu Sep 15, 2016 10:05 am

Re: How to decrease a Volume ?

Postby Sharko » Fri Feb 16, 2024 10:14 am

The ZFS compression algorithms are said to be very low cost in terms of performance, so I wouldn't bother yourself over it.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 83 guests