1

I'm starting to teach myself how ZFS works - so I may have fundamental misunderstandings here - if so, please let me know.

Is a ZVOL a block device, or does it simply behave in a manor similar to a block device ?

I can resize a ZVOL using a command like

zfs set volsize=SIZE poolname/volname 

Does the above behave the same way as an LVM volume would, ie

  1. Can I expand the ZVOL I then expand the partitions/filesystems in the VM associated with the ZVOL.
  2. Can I safely REDUCE the size of the ZVOL after shrinking the partititions/ filesystems in the ZVOL (This is the operation I am most concerned about)
  3. Can I map the ZVOL to a loopback device using losetup and play with it the same way I might play with an LVM block device.

1 Answer 1

1

It works as if it was a block device.

  1. Yes, you first increase the zvol, then grow the file system inside it to the new size (similar to increasing the size of an existing partition on a traditional hard disk). Of course, your file system must support regrowing (here is an example with GParted)
  2. This depends again on the contained file system and your data (see last paragraph of linked resource):

    Decrease the disk size is almost the same as increasing it. The only difference is that you need to resize your paritions before you reduce the zfs volsize.

  3. I don't know how LVM volumes differ here to normal block devices - assume your zvol is like an ordinary partition presented as a disk.
1
  • 1
    Thank you for your confirmation. It all makes perfect sense. Yes, LVMs also appear as a normal block devices. (My concern is it might be different because I see I can compress the zvol and also snapshots work differently - and I didn't want to build a solution on a platform requiring functionality I don't adequately understand. Thanks again
    – davidgo
    Oct 6, 2017 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .