Resize the virtual disk ?
Resize the virtual disk ?
Hello,
Is there a possibility to resize, in my case "increase", the size of the virtual disk ?
I had chosen 40GB which is now a bottle neck.
I do also have a shared drive with the Windows host system which helps me, but I am looking for a way to finally increase the virtual disk size itself.
Maybe someone has an idea how to do that ?
Until now I have only found an indication to CloneVDI, but VM VirtualBox Manager does not recognize the .vdi file after resizing.
Cheers
NPS
Is there a possibility to resize, in my case "increase", the size of the virtual disk ?
I had chosen 40GB which is now a bottle neck.
I do also have a shared drive with the Windows host system which helps me, but I am looking for a way to finally increase the virtual disk size itself.
Maybe someone has an idea how to do that ?
Until now I have only found an indication to CloneVDI, but VM VirtualBox Manager does not recognize the .vdi file after resizing.
Cheers
NPS
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Resize the virtual disk ?
Sure it does, or else the experience of thousands of users over the last 9 years is all wrong.NPS wrote:Until now I have only found an indication to CloneVDI, but VM VirtualBox Manager does not recognize the .vdi file after resizing.
It would help if you gave precise error messages, and told us what you tried to do to get the VDI recognized.
You could of course use "VBoxManage modifymedium --resize" instead of CloneVDI, but since that's a command line tool I think most would consider CloneVDI easier to use.
-
- Volunteer
- Posts: 5102
- Joined: 19. Sep 2009, 04:44
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows 10,7 and earlier
- Location: Sydney, Australia
Re: Resize the virtual disk ?
@NPS It works if you use the correct procedure. You have to do it in such a way that VirtualBox uses the new .vdi . I would do it this way.
Choose to keep the same UUID. After the disk is copied, rename the old .vdi file to something else (I just add OLD to the name) and then delete Clone of from the name of the new .vdi . The new file has then replaced the old one using the same name and UUID and the vm should boot. If it boots successfully, you can delete the OLD file. The procedure is pretty much fail-safe because the original .vdi is not changed by the cloning process.
If you leave CloneVDI at the default setting of Generate new UUID, it is a bit harder.
Choose to keep the same UUID. After the disk is copied, rename the old .vdi file to something else (I just add OLD to the name) and then delete Clone of from the name of the new .vdi . The new file has then replaced the old one using the same name and UUID and the vm should boot. If it boots successfully, you can delete the OLD file. The procedure is pretty much fail-safe because the original .vdi is not changed by the cloning process.
If you leave CloneVDI at the default setting of Generate new UUID, it is a bit harder.
Bill
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Resize the virtual disk ?
All assuming of course that the OP has not used any snapshots or linked clones etc. One of several details I would have liked to see mention of!
Re: Resize the virtual disk ?
[<user>@localhost:~/uphwapi (master u=)]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 38770180 29551876 9218304 77% /
Please see attached screenshot of my new attempt.
----
Yes, I could have written more, but I thought I had just reproduced or confirmed this comment "CloneVDI does not support resizing of any Linux filesystem (unless of course you consider FATx or NTFS to be Linux filesystems)." in viewtopic.php?f=6&t=22422&start=1125&hi ... disk+space.
I had misunderstood this comment.
The definite reason for the failure was that I had not removed "Clone of " at the beginning of the name of the new file.
I overlooked that, because the file name was very long and not entirely displayed in the tool and I also did not notice the prefix in file manager.
Just for information how it was:
(see also the screenshots)
Validation result: "OK".
Indeed I had selected "Generate new UUID".
File system: ext1,Unknow(8e)
Next try today:
I selected "Keep old UUID":
The behavior was:
(I am using place holders.)
"
Failed to open a session for the virtual machine <name>.
Details:
Could not open the medium '<path><file.vdi>'.
VD: error VERR_FILE_NOT_FOUND opening image file '<path'><file.vdi> (VERR_FILE_NOT_FOUND).
Result Code:
E_FAIL (0x80004005)
Component:
MediumWrap
Interface:
IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}
"
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Resize the virtual disk ?
"File not found" should be quite straightforward to diagnose. The correctly named file is either where it's supposed to be, or it isn't. Since you are obfuscating path and file names I won't comment on this any further.
Re: Resize the virtual disk ?
@mpack
I apologize for my communication which was obviously not clear enough:
-> The "File not found" issue is solved. I had not seen that the tool had added a prefix. Now, when I remove it, the "File not found"-issue is of course solved.
-> When I remove the prefix, Oracle VM VirtualBox Manager does finds the new .vdi file, but the file itself is even a little smaller than the original one. Also executing "df" I do not see more space.
Is this maybe a normal symptom ?
I wanted to resize my virtual disk from 40 GB to 50 GB.
Shouldn't the new .vdi-file have a size of 50 GB ?
I apologize for my communication which was obviously not clear enough:
-> The "File not found" issue is solved. I had not seen that the tool had added a prefix. Now, when I remove it, the "File not found"-issue is of course solved.
-> When I remove the prefix, Oracle VM VirtualBox Manager does finds the new .vdi file, but the file itself is even a little smaller than the original one. Also executing "df" I do not see more space.
Is this maybe a normal symptom ?
I wanted to resize my virtual disk from 40 GB to 50 GB.
Shouldn't the new .vdi-file have a size of 50 GB ?
Last edited by NPS on 23. Mar 2018, 10:34, edited 1 time in total.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: Resize the virtual disk ?
If the file is smaller and you didn't explicitly set the compaction option then it will be because zero blocks were eliminated. This is normal. VBoxManage does that too. If in doubt then run a filesystem check inside the guest, and compare it to a filesystem check using the old VDI.
CloneVDI has been around for almost 10 years, it is a proven tool. If it gets to 100% without reporting errors then there were none.
CloneVDI has been around for almost 10 years, it is a proven tool. If it gets to 100% without reporting errors then there were none.
Re: Resize the virtual disk ?
I understand the new .vdi can be smaller, but I expected that "df" showed me the theoretically possible size 50GB, i.e. ~ 50000000 1K-blocks, for /dev/mapper/rhel-root, but this is not the case:
I have tried fsck -AV, but this return after 1 second and I do not see any further output:
Or is just all good ?
But why don't I see ~50000000 1K-blocks with command "df" ?
Maybe you have another idea ?
Code: Select all
[hartsocdsp@localhost:~/ceva_ps (master % u+29)]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 38770180 28387076 10383104 74% /
devtmpfs 1008404 0 1008404 0% /dev
tmpfs 1024144 0 1024144 0% /dev/shm
tmpfs 1024144 8936 1015208 1% /run
tmpfs 1024144 0 1024144 0% /sys/fs/cgroup
/dev/sda1 1038336 163668 874668 16% /boot
Windows_drive 488384508 463506568 24877940 95% /media/sf_Windows_drive
tmpfs 204832 24 204808 1% /run/user/1000
[hartsocdsp@localhost:~/ceva_ps (master % u+29)]$
Code: Select all
[hartsocdsp@localhost:~/ceva_ps (master % u+29)]$ fsck -AV
fsck from util-linux 2.23.2
Checking all file systems.
[hartsocdsp@localhost:~/ceva_ps (master % u+29)]$ echo $?
0
But why don't I see ~50000000 1K-blocks with command "df" ?
Maybe you have another idea ?
-
- Volunteer
- Posts: 1631
- Joined: 25. May 2010, 23:48
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Assorted Linux, Windows Server 2012, DOS, Windows 10, BIOS/UEFI emulation
Re: Resize the virtual disk ?
It looks like you have increased the size of the physical disk but haven't yet expanded the partition to fill the newly available space.
If you run gparted or similar tools in the guest I would expect them to tell you there is 10GB unused disk space.
-Andy.
If you run gparted or similar tools in the guest I would expect them to tell you there is 10GB unused disk space.
-Andy.
My crystal ball is currently broken. If you want assistance you are going to have to give me all of the necessary information.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
Re: Resize the virtual disk ?
@andyp73
Thank you, indeed, there is 10 GB of unallocated disk space. How can I allocated to existing partition /dev/sda2 ?
See attached screen shot.
NPS
Thank you, indeed, there is 10 GB of unallocated disk space. How can I allocated to existing partition /dev/sda2 ?
See attached screen shot.
NPS
- Attachments
-
- VB_10GBunallocated.png (35.72 KiB) Viewed 5230 times
-
- Volunteer
- Posts: 1631
- Joined: 25. May 2010, 23:48
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Assorted Linux, Windows Server 2012, DOS, Windows 10, BIOS/UEFI emulation
Re: Resize the virtual disk ?
Firstly, make sure you have a backup of your vdi file as you may need it if anything goes wrong!
It is a long time since I last used gparted but I don't think you can adjust the size of a partition when it is mounted. You will probably be best downloading the gparted livecd and booting from that.
You should then just be able to drag the right hand side of the partition to fill the empty space and hit the apply button.
-Andy.
It is a long time since I last used gparted but I don't think you can adjust the size of a partition when it is mounted. You will probably be best downloading the gparted livecd and booting from that.
You should then just be able to drag the right hand side of the partition to fill the empty space and hit the apply button.
-Andy.
My crystal ball is currently broken. If you want assistance you are going to have to give me all of the necessary information.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
Re: Resize the virtual disk ?
@andyp73
All this is running in a VirtualBox virtual machine on a Windows 7 PC and I have resized the .vdi file which contains the Linux file system already.
So, I don't think I need to boot my PC from a LiveCD. This is a different use case.
I need a way to allocate the 10GB to an existing partition.
I do not see how I can do this in gparted.
All this is running in a VirtualBox virtual machine on a Windows 7 PC and I have resized the .vdi file which contains the Linux file system already.
So, I don't think I need to boot my PC from a LiveCD. This is a different use case.
I need a way to allocate the 10GB to an existing partition.
I do not see how I can do this in gparted.
Re: Resize the virtual disk ?
Try the GParted Manual Instructions: https://gparted.sourceforge.io/display- ... nallocated