Ubuntu VM with Dynamic Allocation not growing
Ubuntu VM with Dynamic Allocation not growing
I have installed a VM with 10GB of diskspace (SATA Controller), configured for dyanamic allocation.
I went to update my Linux VM and it's telling me I am out of disk space. It's showing (df -h) Used 3.9GB Available 0. I am also using LVM on my Ubuntu 18.04 guest.
The current VDI file is 4 GB, and I would assume that the virtualbox service would allocate more disk space, because I should have 6GB available for it to grow.
I have made certain that my host has plenty of disk space, so at this point what are my options?
Thank you!
I went to update my Linux VM and it's telling me I am out of disk space. It's showing (df -h) Used 3.9GB Available 0. I am also using LVM on my Ubuntu 18.04 guest.
The current VDI file is 4 GB, and I would assume that the virtualbox service would allocate more disk space, because I should have 6GB available for it to grow.
I have made certain that my host has plenty of disk space, so at this point what are my options?
Thank you!
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Ubuntu VM with Dynamic Allocation not growing
If you only allocate a 10GB drive, and if it's a Linux guest, then you'll immediately lose half of that to a swap partition (whose size is related to available disk space and PC RAM).
VirtualBox doesn't grow the disk by magic. As the "dynamic allocation" name suggests, VirtualBox allocates host space to a section of a virtual drive when the VM writes to that section of the drive for the first time. If the VM never writes to that section then no host space is ever allocated for it, this is precisely what we want from a "dynamic" container format. Under no circumstances will the drive capacity ever change, unless of course you resize the container (see below).
So, it sounds like you have a big swap partition that is mainly unused, I guess you don't run a lot of memory hogs.
See How to resize a Virtual Drive. I'll leave you to do your own research on guest OS matters, such as choosing a size for Mint's swap partition.
VirtualBox doesn't grow the disk by magic. As the "dynamic allocation" name suggests, VirtualBox allocates host space to a section of a virtual drive when the VM writes to that section of the drive for the first time. If the VM never writes to that section then no host space is ever allocated for it, this is precisely what we want from a "dynamic" container format. Under no circumstances will the drive capacity ever change, unless of course you resize the container (see below).
So, it sounds like you have a big swap partition that is mainly unused, I guess you don't run a lot of memory hogs.
See How to resize a Virtual Drive. I'll leave you to do your own research on guest OS matters, such as choosing a size for Mint's swap partition.
Re: Ubuntu VM with Dynamic Allocation not growing
Thanks, mpack. I thought that too, but my swap space is only half a gig and not really being used.mpack wrote:If you only allocate a 10GB drive, and if it's a Linux guest, then you'll immediately lose half of that to a swap partition (whose size is related to available disk space and PC RAM).
So, it sounds like you have a big swap partition that is mainly unused, I guess you don't run a lot of memory hogs.
See How to resize a Virtual Drive. I'll leave you to do your own research on guest OS matters, such as choosing a size for Mint's swap partition.
Code: Select all
NAME TYPE SIZE USED PRIO
/swap.img file 553M 268K -Code: Select all
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 20969471 18868224 9G Linux filesystem
Cheers!
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Ubuntu VM with Dynamic Allocation not growing
Read the FAQ carefully, noting step 2. How to resize a Virtual Drive. The whole point of a FAQ is that I don't have to manually repeat the information for every new person that comes along... and I'm not going to do that.
Re: Ubuntu VM with Dynamic Allocation not growing
mpack,
You must have misread...I stated that I already resized my partition, I don't need you to explain it to me. My question, so this doesn't happen again, is why my guest out of disk space and not growing like I thought it should.
You recommended it's a Swap Space reservation of half the allocated disk. I replied with my swap space size which wasn't half, and as a matter of fact I turned it off.
If my total size is 10GB disk, and the partitions are divvied up accordingly, then I should have more than 4 GB allocated to /dev/sda3 which is seen as 9GB but the guest OS
is failing. My point was I shouldn't have had to resize, and if that is what I needed to do, WHY?
You must have misread...I stated that I already resized my partition, I don't need you to explain it to me. My question, so this doesn't happen again, is why my guest out of disk space and not growing like I thought it should.
You recommended it's a Swap Space reservation of half the allocated disk. I replied with my swap space size which wasn't half, and as a matter of fact I turned it off.
If my total size is 10GB disk, and the partitions are divvied up accordingly, then I should have more than 4 GB allocated to /dev/sda3 which is seen as 9GB but the guest OS
is failing. My point was I shouldn't have had to resize, and if that is what I needed to do, WHY?
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Ubuntu VM with Dynamic Allocation not growing
What are you asking? Drives never "grow". What OS expects or could cope with a drive that change capacity when written to? "Dynamic" refers to allocation of existing capacity, not increase in capacity. The capacity never changes. I already explained this in my first reply.QJack wrote:My question, so this doesn't happen again, is why my guest out of disk space and not growing like I thought it should.
Re: Ubuntu VM with Dynamic Allocation not growing
OK, it may be just my misunderstanding of how I think Dynamic works.
I thought that if I told my VM to have a storage capacity of 10 GB, let's say, and selected "dynamic", that the VDI file won't pre-allocate the full 10 GB.
My thought was that the VM manager would increase UP TO 10 GB as it needs to and that the guest OS would see that the disk is sized for 10GB. The guest OS partition table definitely does see it this way.
I thought that if my guest OS was truly out of space, my raw VDI file would be ~10GB, but it's not. It's only ~4GB.
If that isn't the case, then why not just pre-allocate all the disk at once?
I thought that if I told my VM to have a storage capacity of 10 GB, let's say, and selected "dynamic", that the VDI file won't pre-allocate the full 10 GB.
My thought was that the VM manager would increase UP TO 10 GB as it needs to and that the guest OS would see that the disk is sized for 10GB. The guest OS partition table definitely does see it this way.
I thought that if my guest OS was truly out of space, my raw VDI file would be ~10GB, but it's not. It's only ~4GB.
If that isn't the case, then why not just pre-allocate all the disk at once?
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Ubuntu VM with Dynamic Allocation not growing
Your understanding of Virtualbox Dynamic is correct. The Dynamic disk has a maximum size. At the beginning, the disk file on the host drive is nothing more than headers & such. Couple of megabytes.
As the guest OS puts data into it's "disk", the disk file on the host gets bigger. The dynamic file can get as big as the size chosen for the disk file when the dynamic disk was made. If the dynamic disk was made to be 10GB final size, it will grow to 10GB max. No bigger.
If the guest OS makes partitions inside the guest "disk", these partitions control how large the data inside the partition can get. If a guest OS makes a 4GB data partition and a 6GB swap partition in the 10GB dynamic disk, then the 4GB data partition will be full when there's 4GB of data in it, even though the 6GB swap partition is still not much used. If the guest OS made use of 1GB of the swap partition too, then the dynamic disk file would be 5GB in size. However, the guest OS will report "full disk", even though the swap is not being fully used and the dynamic disk file has not grown to 10GB, because the data partition is full. The disk file will not increase beyond 5GB unless the guest OS decides to use more swap.
If you want to make more room for this guest to grow, you will need to resize the dynamic disk. See Mpack's link on "How to Resize a Virtual Drive". Roughly speaking, you run a command on the dynamic disk file from the host to change the maximum size it can grow, then alter the partitions in the guest OS to make use of the new space. (Take a backup copy of the disk file before doing anything to it.)
As the guest OS puts data into it's "disk", the disk file on the host gets bigger. The dynamic file can get as big as the size chosen for the disk file when the dynamic disk was made. If the dynamic disk was made to be 10GB final size, it will grow to 10GB max. No bigger.
If the guest OS makes partitions inside the guest "disk", these partitions control how large the data inside the partition can get. If a guest OS makes a 4GB data partition and a 6GB swap partition in the 10GB dynamic disk, then the 4GB data partition will be full when there's 4GB of data in it, even though the 6GB swap partition is still not much used. If the guest OS made use of 1GB of the swap partition too, then the dynamic disk file would be 5GB in size. However, the guest OS will report "full disk", even though the swap is not being fully used and the dynamic disk file has not grown to 10GB, because the data partition is full. The disk file will not increase beyond 5GB unless the guest OS decides to use more swap.
If you want to make more room for this guest to grow, you will need to resize the dynamic disk. See Mpack's link on "How to Resize a Virtual Drive". Roughly speaking, you run a command on the dynamic disk file from the host to change the maximum size it can grow, then alter the partitions in the guest OS to make use of the new space. (Take a backup copy of the disk file before doing anything to it.)
Re: Ubuntu VM with Dynamic Allocation not growing
scottgus1,scottgus1 wrote:
If the guest OS makes partitions inside the guest "disk", these partitions control how large the data inside the partition can get. If a guest OS makes a 4GB data partition and a 6GB swap partition in the 10GB dynamic disk, then the 4GB data partition will be full when there's 4GB of data in it, even though the 6GB swap partition is still not much used. If the guest OS made use of 1GB of the swap partition too, then the dynamic disk file would be 5GB in size. However, the guest OS will report "full disk", even though the swap is not being fully used and the dynamic disk file has not grown to 10GB, because the data partition is full. The disk file will not increase beyond 5GB unless the guest OS decides to use more swap.
If you want to make more room for this guest to grow, you will need to resize the dynamic disk. See Mpack's link on "How to Resize a Virtual Drive". Roughly speaking, you run a command on the dynamic disk file from the host to change the maximum size it can grow, then alter the partitions in the guest OS to make use of the new space. (Take a backup copy of the disk file before doing anything to it.)
Appreciate you stepping in here. Again, I've already resized my partition, etc. What I'm trying to figure out is why I had to do a resize because my VDI file only had a size of ~4GB when I had specified 10GB. I understand the Swap, but it was only set to be ~256MB max, not 6GB. Even if were 6GB, wouldn't my VDI file be ~10GB?
-
scottgus1
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: Ubuntu VM with Dynamic Allocation not growing
Good question. I see you posted your partition layout, I missed that earlier. It certainly seems like there's more space available. Does Linux hide system files so they don't show in the file browser but still takes space, like Windows does?
Can you show a report of the partitions saying how much data is on them & how much free?
Also, please post the command output of:
Can you show a report of the partitions saying how much data is on them & how much free?
Also, please post the command output of:
vboxmanage showmediuminfo "path//to/dynamic/disk/file"-
multiOS
- Volunteer
- Posts: 1223
- Joined: 14. Sep 2019, 16:51
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux, BSD
- Location: United Kingdom
Re: Ubuntu VM with Dynamic Allocation not growing
For info.: Linux does store previous package versions replaced by updates as well as 'old' Linux kernels in case the user needs/wants to 'roll back' to earlier versions. The user has to clean the system regularly to delete those files, much the same as with Windows 10. The method for cleaning the linux system depends on the distro.
Re: Ubuntu VM with Dynamic Allocation not growing
Depends on the distro, but either way, that would consume disk space and the VDI file should represent that. You can't hide without it taking up disk.multiOS wrote:For info.: Linux does store previous package versions replaced by updates as well as 'old' Linux kernels in case the user needs/wants to 'roll back' to earlier versions. The user has to clean the system regularly to delete those files, much the same as with Windows 10. The method for cleaning the linux system depends on the distro.
Re: Ubuntu VM with Dynamic Allocation not growing
As I mentioned in the reply to the other user, even if it did hide files, it would take up disk space and the VDI would reflect such.scottgus1 wrote:Good question. I see you posted your partition layout, I missed that earlier. It certainly seems like there's more space available. Does Linux hide system files so they don't show in the file browser but still takes space, like Windows does?
Can you show a report of the partitions saying how much data is on them & how much free?
Also, please post the command output of:vboxmanage showmediuminfo "path//to/dynamic/disk/file"
Unfortunately, I've already resized my partition, etc. But, if it has happened once, then it will happen again (hope not). I certainly am moving forward though with just
pre-allocating disk space. lol.
Thanks, scottgus1. I'm glad you took time to understand my question and did not berate me.
For the moderator, my advice is not to make assumptions of what's being asked. If you don't understand the question ask for clarification. If you don't have the patience for such, perhaps consider resigning the duties to another.