[Solved] Increasing the disk size of a VM

Discussions related to using VirtualBox on Windows hosts.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

[Solved] Increasing the disk size of a VM

Post by Jiger »

I have Windows 10 Home as host and Linux Mint as guest and the VBox version is 5.2.12r 122591. The system says that the VM drive has only 817 mb left of the given 20 gb. Is there, for a beginner, a simple and easy way to expand the drive in order to solve this problem. I can easily double the size for the Linux guest system.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

IMHO on Windows hosts the simplest way is to use CloneVDI. Keep the source and destination VDI files the same, select "Compact", "Keep old UUID", "Increase virtual drive ..." and "Increase partition size". The new VDI should be a plug in replacement.

Caveats: make sure you have enough host disk space for a copy of the current VDI. Don't bother trying any of this if you have snapshots.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: Increasing the disk size of a VM

Post by Jiger »

Well I have done this now but when I take a look under Storage, the only vdi-file I can see there is the original one. Can that file be deleted? But in the User´s folder in windows, there is a folder named Clone of Linux Mint, which is around 15 gb compared to the original file which is around 20 gb. I wanted to increase the file to 40 gb.
Later on, I have found that the system is still warning me that there is limited space for the guest system 817 gb. I have 1 snapshot, since earlier should I have deleted it?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

I covered most of your questions in my previous post, however it doesn't seem like you read it properly.
Jiger wrote:when I take a look under Storage, the only vdi-file I can see there is the original one.
Then you must have changed the destination path in the "destination" field, otherwise the clone VDI would have ended up in the same folder as the source. For usage instructions see the "readme.txt" file which came with the software.
Jiger wrote:Can that [original] file be deleted?
It can be deleted if you're done with it. If you followed the instructions I gave in my previous post then you'd be done, but you didn't, so you're not.
Jiger wrote:which is around 15 gb compared to the original file which is around 20 gb. I wanted to increase the file to 40 gb.
The logical size of the hard disk has little to do with the size of a physical dynamic VDI file. I guess you missed the part where I said to increase the partition size, and not bother if you have snapshots.

I'm going to stop there so you can re-read my previous post.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: Increasing the disk size of a VM

Post by Jiger »

Thanks for your attention. I have read your instructions and consequently in the settings of CloneVDI, I made the following settings:
I kept the suggested original destination
I enabled: Keep old UUID, Increase virtual drive size to 40 gb, Increase partition size and Compact drive while copying.
Then I clicked proceed.
In the instructions you write: If you cloned a source VDI to a dest VDI with the same name, same UUID, and in the same folder
then you don't need to do anything else - from now on VirtualBox uses the new VDI in all
VMs which used the original VDI.
Maybe I missed "the same name" because in the VM folder in Windows the new file has the suggested name Clone of Linux Mint.vdi instead of just Linux Mint.vdi

I was able to add this file under storage in VBox and it got the name NewVirtualDisk1.vdi, but this didn´t change anything.

What should I do? Delete the newly mounted file in VB and in Windows rename Clone of Linux Mint to just Linux Mint?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

Jiger wrote: I was able to add this file under storage in VBox and it got the name NewVirtualDisk1.vdi, but this didn´t change anything.
If you got that name then you did not add an existing VDI to the controller, instead you created a new VDI. I seriously hope you have not ignored what I said about not doing any of this if you have snapshots, as some of what you are doing would kill the VM.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: Increasing the disk size of a VM

Post by Jiger »

There was no problem to delete the NewVirtualDisk1.vdi under Storage in VB and the VM works fine with the old VDI-file. I have only one (1) snapshot. Can I delete that and start everything from the beginning? Should I name the file exactly as the original one (Linux Mint.vdi)?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

If the number of snapshots is >0, you have a problem. Specifically, the snapshot VDI was previously mounted in the disk controller of the VM. You replaced that with the base VDI. If you did that then the VM can't be working fine, you will have lost all data added since the snapshot was created.

Try this, and please pay attention to every detail.
  1. Make a backup of the VM folder as it is now, unless you did this already.
  2. Use CloneVDI to clone the snapshot VDI in the Snapshots subfolder (NOT THE BASE VDI). You should use the same settings as last time (particularly "Keep UUID"), including the size increase, except this time let it use the default "Clone of ..." name for the clone.
  3. When CloneVDI is done, run VirtualBox and delete the snapshot. Verify that your VM now consists of a single VDI with nothing in the "Snapshots" subfolder.
  4. Replace the single remaining VDI with the clone you made in step 2. Copy and rename the VDI using your Windows host while VirtualBox is shut down.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: Increasing the disk size of a VM

Post by Jiger »

After having done exactly as you suggest, when starting Linux Mint VM, I get a warning message that this computer has only about 800 mb left. But when looking under Storage in the VB settings, I can see that the single VDI (Linux Mint) has a virtual size of 40 gb (as was intended) and the actual size is 18,35 gb. Details: Dynamically allocated storage.

How should I understand the warning?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

You should understand it as the partition needing to be resized. The guest OS has data structures which manage the disk space, and those are not affected by finding themselves on a larger disk. You need to run gparted or similar to manage guest OS partitions.

I did not notice that you had a Linux guest. In that case the partition resize feature of CloneVDI is only partially functional, i.e. it will move secondary partitions aside to make room, but it can't actually resize an ExtX partition. It should however make gparted's task easier.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: Increasing the disk size of a VM

Post by Jiger »

Thank you very much for all your attention, gparted solved the final problem. :D
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Increasing the disk size of a VM

Post by mpack »

Good, thanks for reporting back.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: [Solved] Increasing the disk size of a VM

Post by Jiger »

Now, I have the same problem with a Windows XP VM. I can see that there is no vdi-file in that folder but a vmdk-file. Can I use the same procedure (using CloneVdi) as with the vdi-files in Linus concerning eliminating the (only one) snapshot and increasing the disk somewhat?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] Increasing the disk size of a VM

Post by mpack »

If it has no snapshots then yes, however the file created by CloneVDI is always a VDI, even if the input is a VMDK.

Also, since XP uses the NTFS filesystem then CloneVDI can increase the filesystem capacity too if you wish (no need to run GParted after). Just make sure that "Increase virtual drive size" and "increase partition size" are both ticked.
Jiger
Posts: 100
Joined: 11. Jan 2017, 17:33
Primary OS: MS Windows 10
VBox Version: OSE other
Guest OSses: MS Windows XP, Linux Mint
Location: Stockholm

Re: [Solved] Increasing the disk size of a VM

Post by Jiger »

As I said, the XP VM has one (1) snapshot that I want to get rid of in a decent way at the same time as I want to increase the disk somewhat. To put it shortly: How can I create the same result as earlier with Linux, when we have to do with a VM containing Windows XP with one snapshot and no vdi-file but instead a vmdk-file?
Last edited by Jiger on 5. Aug 2018, 18:33, edited 1 time in total.
Post Reply