Resize VM Disk

panzerscope

Contributor
Joined
May 30, 2022
Messages
146
Hey all.

I have setup a Windows VM and after getting it all setup, I realised I do not need the size of disk I created. Is there a way to resize the VM disk ?

Many thanks,
Kim
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399

gmaggi

Cadet
Joined
Jul 19, 2020
Messages
1
Hi,

I have a similar question. Instead of windows, my VM is ubuntu 18.04. I've managed to shrink the partitions in the VM.
My question is: does the "zfs set volsize..." remain after rebooting the TrueNAS hypervisor?

I ask because of the message in the terminal:

"Warning: settings changed through the CLI are not written to
the configuration database and will be reset on reboot."

Thanks,
Giuliano.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
The quoted message had to be added because Linux "gurus" kept coming to TrueNAS and deciding that they knew all about the system, and about how to make their own preferred tweaks to the system, and then when it turned out that this didn't work, they'd get all huffy in the forums and on Jira at the "incompetence" of the iXsystems developers.

TrueNAS is an appliance OS, and all persistent changes to the system configuration need to be done through the GUI, so that when the system reboots or is updated to a new version, the bootup scripts can pull the relevant configuration elements out of the database and populate that into the various filesystem locations where stuff like the networking configuration needs to be. Manual changes to these files will not survive.

Many changes that are made to the ZFS pool, however, do not need to be made via the GUI, because the changes are made directly to ZFS, and sometimes aren't even stored in the database at all. For this particular class of changes, tweaks made directly via ZFS to the pool may indeed be persistent despite the warning. I would go so far as to say that this counts as "most of them", because in my experience iXsystems has gone to great effort to use the output of ZFS commands/API's as a "database" for ZFS-related configuration information.
 

whodat

Dabbler
Joined
Apr 28, 2018
Messages
34
"Warning: settings changed through the CLI are not written to
the configuration database and will be reset on reboot."
That's interesting, my remote ssh logins and/ or WebUI > System Settings > Shell shows:

Welcome to TrueNAS Warning: the supported mechanisms for making configuration changes are the TrueNAS WebUI, CLI, and API exclusively. ALL OTHERS ARE NOT SUPPORTED AND WILL RESULT IN UNDEFINED BEHAVIOR AND MAY RESULT IN SYSTEM FAILURE.

That message suggests the CLI is a supported method of making changes... (not that I disagree with the 'appliance OS' principle you outlined @jgreco )

I'm on TrueNAS-SCALE-22.02.4
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Welcome to TrueNAS Warning: the supported mechanisms for making configuration changes are the TrueNAS WebUI, CLI, and API exclusively. ALL OTHERS ARE NOT SUPPORTED AND WILL RESULT IN UNDEFINED BEHAVIOR AND MAY RESULT IN SYSTEM FAILURE.

The warning message has gotten progressively more complicated and specific as people have complained that they were unable to grok the earlier ones. I would note that this state of affairs with "changes must be made via GUI" has been the case for a decade, but it was the influx of Linux users who were... I dunno, overconfident? Unable to read for comprehension? I don't really know? that seem to have driven more specificity in this message.

That message suggests the CLI is a supported method of making changes...

Indeed it is. However, the "CLI" is not the UNIX shell environment. It's the actual TrueNAS CLI that's invoked when you type "cli" at a shell prompt. See


and I can confirm that settings made through the TrueNAS CLI are indeed persistent. I believe it is mainly a command line wrapper around the API. It is explicitly NOT the FreeBSD or Linux shell environment, however, so don't expect to be able to start making changes at the shell prompt and for those to stick around. (wah, wah, wah, fail ... sad trombone)
 

WikingDK

Dabbler
Joined
Aug 3, 2023
Messages
10
Yes, but there's a good chance you'll make your VM unbootable, if you mess up any of the steps.
  1. In the Windows guest, run Disk Management to shrink your C: partition. See https://docs.microsoft.com/en-us/windows-server/storage/disk-management/shrink-a-basic-volume.
  2. Shutdown the Windows guest.
  3. In the TrueNAS host, run from Shell: zfs set volsize=<new size> ZFS/path/to/VM/zvol.
  4. Restart the Windows guest.
I'm trying to expand a drive on TrueNAS Scale, but the command doesent work:
cannot open '/dev/zvol/path/to/my/disk': leading slash in name

But there is no slash in the disk name?

And if i go to the folder, and i type in the name of the disk directy it says:
cannot open 'disk': dataset does not exist
 
Top