Separate disk size settings for the snapshot?

Discussions about using Windows guests in VirtualBox.
Post Reply
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Separate disk size settings for the snapshot?

Post by chupocro »

I suspect this isn't possible but I'll ask anyway.

Let's say I have a Windows 10 VM with dynamic disk size of 50 GB, there is 10 GB free space on the virtual disk and I'd like to test some software larger tha 10 GB. Is there a way to do something like this:

1. Make a snapshot of the VM
2. Increase maximum virtual disk size for the snapshot only
3. Install the software in the current state after which the used disk space would be more than 50 GB
4. Delete the current state and revert to the snapshot but the maximum disk virtual disk size shoud be again as it was before increasing it

In other words, I'd like to temporarily install some software which requires increasing the virtual disk size and to then revert everything to the state as it was before.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Separate disk size settings for the snapshot?

Post by scottgus1 »

I'm not sure about your scheme. How to Resize a Drive recommends doing all the disk files in the snapshot chain.

However, snapshots make a VM more delicate. I would recommend backing up the VM completely before doing anything, so a restore is possible if something goes wrong.

Then instead of snapshotting the VM, simply increase the existing disk per the tutorial above. After the experiment, you can either keep the expanded disk size, reduce the partition size within the VM down again and compact the disk using Mpack's CloneVDI, or copy the disk file from the backup back over the original.

I deduce that you are not using snapshots now. If not, seriously consider not using them. If you are using them now already, please post back, as the above suggestions may not work for you.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Separate disk size settings for the snapshot?

Post by fth0 »

scottgus1 wrote:I'm not sure about your scheme.
It should just work as the OP suggested.

I've done it myself in the past: In the VirtualBox Manager, I took a snapshot, enlarged only the newest child image in the Virtual Media Manager, ..., and finally reverted to the snapshot.

Alternatively, you could add another virtual hard disk image to the VM, and remove it in the end.
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

It would be really nice it that works, I didn't expect that would be possible.

Now if I only could install a large software without first copying the install files into the VM because then the program would take more than 3x space on the SSD - the original install files plus one copy after trasferring the files into the VM plus installed program.

Mounting .iso from shared folder didn't work, I'll try to share the folder in the host OS and to then access it from the guest via networking instead of using a shared folder.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Separate disk size settings for the snapshot?

Post by scottgus1 »

fth0 wrote:It should just work as the OP suggested.
Sounds interesting, will have to try it!
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Separate disk size settings for the snapshot?

Post by fth0 »

chupocro wrote:Now if I only could install a large software without first copying the install files into the VM
See Creating a Virtual Optical Disk Image.
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

I just tested with a few small files to check how that works and it seems to work well but I encountered some problems.

1. I couldn't find a way to specify the location of the virtual optical disk definition file (.viso) before creating the virtual optical disk image. The location of the .viso file after creating a new virtual optical disk image file seems to be the same as the location of the very last optical disk displayed in Virtual Media Manager. All text boxes under Optical disks > Attributes frame were greyed out (which is not the case with Hard disks > Attributes), the only control which worked was Choose Medium Location icon but I couldn't use that icon to specify the location of the .viso file in advance because the location was related to currently highlighted optical disk.

2. I tried to use Move Disk Image command to move the .viso file to other location but the progress bar stayed for more than a minute (which doesn't seem normal for moving the file which contains only 136 bytes) and then Virtual Media Manager window closed and focus switched to VirtuaBox Manager window, busy cursor animation stayed "forever" (until I closed VirtualBox Manager) and .viso file was not moved to the location I specified.

3 I tried to create the new optical disk image and after it was created at the location I couldn't specify I used the Choose Medium Location to specify the location where I'd like to store the optical disk image definition but the result was the same as in #2

I probably could create a new virtual optical disk, then remove it from Virtual Media Manager, then move it manually to the other location and then add it to Virtual Media Manager but there should be a way to specify the location of the optical disk image definition file to be created. Either I am doing something wrong or there is a bug.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Separate disk size settings for the snapshot?

Post by fth0 »

When I tried it myself, the <VM>.viso file was just located inside the VM folder, right next to <VM>.vbox. Since it's only a small descriptor file that specifies where the real files are, I don't see a good reason to put it anywhere else.
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

In my case every .viso file was created in my torrents destination folder which has nothing to do VirtualBox or virtual machines folder.

In that very same folder is the .iso image from which I installed Windows in the VM and that .iso image is the very last on the list of optical discs in Virtual Media Manager.

I'd like to keep virtual optical disk image descriptor files but the folder where it was created is just a temporary folder where I downloaded the .iso image and after moving downloaded files from the internal disk to some of the external disks that folder will not anymore be on the internal disk.

I am assuming either there is an optical disk in your Virtual Media Manager located in the same folder as your VM or the last item you mounted in some VM was in the same folder. But, what if you now create another virtual optical disk to be used with another VM - would it be created next to its corresponding VM, or would it be created in the very same folder as the last virtual optical disk you created?

I'd like to have these descriptors all in the same folder because virtual optical disks are not related to some specific VM - one virtual optical disk could be used with many VMs.

Does Move Disk Image menu command work in your case or it does nothing as in my case?
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Separate disk size settings for the snapshot?

Post by fth0 »

I'd guess that the idea is to create exactly one .viso file for a VM in the VM's folder, which happens when creating it from within a VM's configuration. When creating a .viso file from within the Virtual Media Manager, the folder of the VM where I created the previous .viso file is used, and I cannot move it, too. This could be a bug indeed. I'll have a closer look another day ...
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

I didn't notice the option to create the virtual optical disk from within the VM configuration, in that case it works as you said - the .viso file is created in the same folder as .vbox file and the suggested name is the same as the name of the virtual machine from which's configuration the option has been launched.

That is much better compared to the behaviour when the command is launched from Virtual Media Manager.

BTW, when the command for creating a new virtual optical disk is launched from Virtual Media Manager the suggested name is "ad-hoc".

Thank you very much one more time for your help!

Regards
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

fth0 wrote:
scottgus1 wrote:I'm not sure about your scheme.
It should just work as the OP suggested.

I've done it myself in the past: In the VirtualBox Manager, I took a snapshot, enlarged only the newest child image in the Virtual Media Manager, ..., and finally reverted to the snapshot.
Unfortunately consolidating free space on c: partition after enlarging the virtual disk didn't work.

As a test I increased the maximum virtual disk size from 50 to 80 GB and then I tried to use MiniTool Partition Wizard from within guest to move the Recovery partition (which was now in the middle of empty space) to the end of the virtual disk (so I can extend the partition using Disk Management) but that didn't work.

I've found this solution to the exact problem which happened but moving the Recovery partition didn't work even after I deleted Registry entries mentioned in that article and this time VirtualBox displayed I/O error and paused the VM.

Maybe moving partitions is not possible when using dynamically allocated disks?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Separate disk size settings for the snapshot?

Post by mpack »

chupocro wrote: Maybe moving partitions is not possible when using dynamically allocated disks?
Being dynamic has nothing to do with anything.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Separate disk size settings for the snapshot?

Post by fth0 »

chupocro wrote:BTW, when the command for creating a new virtual optical disk is launched from Virtual Media Manager the suggested name is "ad-hoc".
If you want to change this name, click on the Configuration button. ;)
chupocro wrote:Maybe moving partitions is not possible when using dynamically allocated disks?
It rather has to do with what the running Windows OS allows you to do. IIRC, I've seen instructions on the Internet that told to remove and later recreate the Recovery partition.
chupocro
Posts: 15
Joined: 20. Mar 2023, 03:18

Re: Separate disk size settings for the snapshot?

Post by chupocro »

fth0 wrote:If you want to change this name, click on the Configuration button. ;)
Yes, I know - I just wanted to say the name is unusual :-)
fth0 wrote:It rather has to do with what the running Windows OS allows you to do. IIRC, I've seen instructions on the Internet that told to remove and later recreate the Recovery partition.
I did some more testing and here are the results:

I tried to move the Recovery partition from within running guest using Partition Master and this time there was an error The I/O cache encountered an error while updating data in medium "ahci-0.0" (rc=VERR_INVALID_PARAMETER) but the partition was moved to the end of the disk. However, there was BSOD in the guest after restart, the Recovery partition became listed as RAW and recovery menus were not listed after invoking recovery mode.

The correct way of moving the Recovery partition to the end of virtual disk is to boot the VM from some bootable .iso containing disk tools (I used MiniTool Partition Wizard) and to then move the partition. That worked well and the Recovery partition was still usable.

BTW, I couldn't find any key to be used during boot for invoking Windows Recovery - the only ways I could test the recovery mode was using Update&Security > Recovery > Restart or Shift + Restart. I could probably invoke the recovery mode by shutting down the VM during boot several times in a row too but I didn't test that.

And there is another thing I noticed - the Shut down button at login screen doesn't work. When I try to use that button the same happens as when Start menu wasn't working before disabling Transparency effects. However, the button for changing the keyboard language at login screen does work well.
Post Reply