Changing Size (shrink) on active zvol

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
Running FreeNAS 9.3 and wondering the following, and can't seem to find an answer on the forums or elseswhere:

We have a large zvol that is at about 30% capacity on the underlying NTFS partition. It is used for iSCSI storage.

Is it safe to edit to the zvol in the volume manager and lower the current size? If so, do I need to stop the iSCSI service first? It would be detrimental to lose the data on the volume, so if this isn't an absolutely safe thing, then I will unfortunately have to pass, though we would like to free up some space for other production purposes.
 

Mirfster

Doesn't know what he's talking about
Joined
Oct 2, 2015
Messages
3,215
Is it safe to edit to the zvol in the volume manager and lower the current size?
Out of curiosity, what are you looking to gain from doing this? Performance of iSCSI decreases as the free space decreases; pretty significantly after 50% (from what I understand). So by reducing it (if you can) you are for sure going to go beyond the 30% you are currently at and depending on how much it is reduced you could potentially jump up (or beyond) that 50% mark...

It would be detrimental to lose the data on the volume, so if this isn't an absolutely safe thing, then I will unfortunately have to pass, though we would like to free up some space for other production purposes.
Might be best to look at simply upgrading the drives to increase free space. As far as "other production purposes"; are they all iSCSI related or you running other stuff (CIFS, NFS, etc.)?

BTW, if you post System Configuration Information as well as current Use-Case(s); it may assist others in helping provide a more educated response. :)
 

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
You know what all, we're going to keep it as is.

For the record, I wanted to shrink the zvol to have enough space to create an addition dataset to put a AFP share on. Instead, we're going to have the Macs access a SMB share since Apple finally cleaned up the SMB protocal with the newer Mavericks (and now El Capitan) OS. And as of now, iSCSI only, but as mentioned, I wanted to free up space to make a separate AFP share.

I apologize and will be more detailed on our setup next time around.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
I bumped into this thread from @jpaetzel while doing some research

Resizing an iSCSI target
I get asked this a lot...how can I resize an iSCSI target without restarting the whole service? For systems that have multiple targets this can be a huge hassle.

The short answer is you can't, however there is a way to fake it that works fairly well.
 

RAIDTester

Dabbler
Joined
Jan 23, 2017
Messages
45
I just noticed a quirk that is scaring me.
2017-04-05 15_39_28-storage2 - FreeNAS-9.10.2-U1 (86c7ef5).png


We migrated a larger snapshot to a new zvol of smaller size.
(I did not notice this at the time)
The original was 110T with an iSCSI extent shared to windows. The new zvol only has about 80T capacity, but iSCSI still shows up in windows as 110T.

Everything is working as of right now, but I don't feel safe leaving it this way. Is there any way to deal with this besides creating a new iSCSI extent and migrating data over?
 
Last edited:

bobpaul

Dabbler
Joined
Dec 20, 2012
Messages
23
Is there any way to deal with this besides creating a new iSCSI extent and migrating data over?

Did you figure anything out?

After using client side tools to resize the partition/filesystem (and placed to the front of the disk, of course) you can use zfs set volsize=50T r10/zvol1 to truncate your zvol.

You can't do this from the GUI because too many users probably would try to shrink their volume without first shrinking the client partition. FreeNAS/ZFS have no idea what filesystem you have on your zvol. I would recommend shrinking your data down a good margin below your new smaller size, then boot the client up again and use client tools to grow the filesystem to file the new size.
 
Last edited:

macatarere

Dabbler
Joined
Jun 11, 2019
Messages
17
I found after using zfs set volsize=900t mypool/myzvol I had to use the Force size checkbox in the GUI to make it apply, 11.2-U7.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Beauty, thank you. On 12.0-U8.1 for an Ubuntu VM, used gparted Live ISO to shrink the ext4 way down to 20G, then the zfs set volsize=50G pool/path/zvol ... but had thereby cut off the backup GPT, which made the volume all kinds of unhappy. Back into gparted Live and run sudo gdisk /dev/vda then "w"rite, and start graphical gparted once more to resize the ext4 to the full 50G.

I wanted to move the main storage to NFS instead of zvol, because of saner snapshotting and better control over recordsize, compression, encryption etc.
 
Last edited:

d3mondani.dd

Cadet
Joined
Nov 14, 2023
Messages
1
Hi,
i am also trying to reduce the size of Zvol which is 7TiB to create new Zvol for another task
and the partition is running VMs.
so i wanted to know the reduction of size will effect the VMs or not please guide so i can proceed.
 
Top