ZFS zvol manage (space-iscsi)

Hi Guys.

I am doing some exercises on my virtual machines, in this exercise I have a windows server 2019 connected to my iscsi server with FreeBSD running the ctld daemon.

My first question is the following, when I create the volume in the following way:

zfs create -V 16gb zroot/vrt/vds0

Creating the volume in the path: zvol/zroot/vrt/vds0

I set up the ctld daemon with lun0 on that volume, ok no problem windows server recognizes the zvol and can format the new disk. But when I look at the zvol in the same path, I can't see the changes made by windows server, I mean the partitions, gpart doesn't say anything about it.

I guess that's normal, right? To see the changes made I have to create a snap and create a clone.

zfs snap zroot/vrt/vds0@snap && zfs clone zroot/vrt/vds0@snap zroot/vrt/vds0clone

Now i can view the changes:

Code:
Geom name: zvol/zroot/vrt/vds0clone
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 33554431
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: zvol/zroot/vrt/vds0clones1
   Mediasize: 17176723456 (16G)
   Sectorsize: 512
   Stripesize: 8192
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,MBR,0x3fec39cb,0x800,0x1ffe800)
   rawtype: 12
   length: 17176723456
   offset: 1048576
   type: fat32lba
   index: 1
   end: 33550335
   start: 2048
Consumers:
1. Name: zvol/zroot/vrt/vds0clone
   Mediasize: 17179869184 (16G)
   Sectorsize: 512
   Stripesize: 8192
   Stripeoffset: 0
   Mode: r0w0e0

But as I said above, it is not possible to see the partitioning scenario, without creating snap or clones of said zvol? Another question is about the expansion of the zvol, I read this on the oracle website and it scared me a bit.

When you create a volume, a reservation is automatically set to the initial size of the volume so that unexpected behavior doesn't occur. For example, if the size of the volume shrinks, data corruption might occur. You must be careful when changing the size of the volume.

In addition, if you create a snapshot of a volume that changes in size, you might introduce inconsistencies if you attempt to roll back the snapshot or create a clone from the snapshot.

Suppose now I need to extend the volume:

zfs set volsize=20gb zroot/vrt/vsd0

Ok, I am forced to reload the ctld daemon otherwise the changes are not seen on the client with windows server:

service ctld reload

I don't know if this is the most correct way, if when reloading the ctld daemon the iscsi service becomes inoperative for a few moments, thus losing communication or existing transfers at that time, what would be the most correct method to reload those changes ?

Ok, reloading the ctld daemon on the windows server client already shows the extra space and I can expand the volume with disk manager. But going back to the oracle message, now when you have expanded the volume you could have problems with the previous snapshots, or data corruption.

How can I prevent this type of problem? Promoting the clone? But that would create a new volume and take up space. What would be the best option?

Thanks.
 
Last edited by a moderator:
Everything I said before is wrong, clones are not designed to act that way, or at least I didn't know how to do it.

The only safe way I've seen to do that is to export the snaps of the volume incrementally to another location, and from there increase the size of the volume and delete the snaps.
 
Back
Top