expansion of disk files
-
edstevens
- Posts: 85
- Joined: 10. Nov 2011, 00:36
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: Oracle Linux; MS Server
expansion of disk files
VBox 4.2.6 on Win 7 Pro 64-bit host
Oracle Linux 5.6 x86-64 guest
My guest was running out of space on my primary hd, so I added another disk file, named localdisk2.vdi. sized at 12gb and specified as dynamically allocated.
Added the file/disk, formatted a single primary partition, created an ext3 file system and mounted it to directory /u02. So far all is according to plan.
Next I issued a 'cp -pR' to copy all of /u01 to the new /u02. As it turns out the 12gb wasn't enough. No big deal, I understand all that, but here's my question regarding VBox. Since the 'disk' was sized at 12 gb and I did a copy command that supposedly completely filled it, I would have expected the .vdi file to have grown to 12gb. Instead, it is still sized at 140mb
So two questions
1) Why didn't the vdi file grow to the specified 12gb
2) what's the best/safest way to remove that vdi from the guest and replace it with a larger one?
Oracle Linux 5.6 x86-64 guest
My guest was running out of space on my primary hd, so I added another disk file, named localdisk2.vdi. sized at 12gb and specified as dynamically allocated.
Added the file/disk, formatted a single primary partition, created an ext3 file system and mounted it to directory /u02. So far all is according to plan.
Next I issued a 'cp -pR' to copy all of /u01 to the new /u02. As it turns out the 12gb wasn't enough. No big deal, I understand all that, but here's my question regarding VBox. Since the 'disk' was sized at 12 gb and I did a copy command that supposedly completely filled it, I would have expected the .vdi file to have grown to 12gb. Instead, it is still sized at 140mb
So two questions
1) Why didn't the vdi file grow to the specified 12gb
2) what's the best/safest way to remove that vdi from the guest and replace it with a larger one?
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: expansion of disk files
Why not just make the (primary) VDI you have bigger?
viewtopic.php?f=35&t=50661
viewtopic.php?f=35&t=50661
-
edstevens
- Posts: 85
- Joined: 10. Nov 2011, 00:36
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: Oracle Linux; MS Server
Re: expansion of disk files
Perryg wrote:Why not just make the (primary) VDI you have bigger?
viewtopic.php?f=35&t=50661
Thanks for the link, but after seeing it, here's why not:
"First resizing does not work if the guest has snapshots "
Besides that show-stopper, I'd like to learn more about adding/deleting disks to/from my guest. That, in itself, has been one of my bigger challenges in learning to use VBox.
Also the open question of why the .vdi file didn't grow to its specified size.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: expansion of disk files
And how do you expect to copy the contents of the original with snap shots?
Seriously if you have snap shots then your not going to get it that way. You would need to clone the original to make it one flat file (or merge the snap shots) and then you can do what you want the way you want or resize which is easier IMHO.
Seriously if you have snap shots then your not going to get it that way. You would need to clone the original to make it one flat file (or merge the snap shots) and then you can do what you want the way you want or resize which is easier IMHO.
-
edstevens
- Posts: 85
- Joined: 10. Nov 2011, 00:36
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: Oracle Linux; MS Server
Re: expansion of disk files
Exactly as I would with a physical machine.Perryg wrote:And how do you expect to copy the contents of the original with snap shots?
Seriously if you have snap shots then your not going to get it that way. You would need to clone the original to make it one flat file (or merge the snap shots) and then you can do what you want the way you want or resize which is easier IMHO.
1) Create a new "disk" (attach a new disk to the server)
2) Format the disk
3) create a file system on the disk
4) make a new directory
5) mount the new fs to the new directory
6) copy files from old directory to new directory
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: expansion of disk files
The guest has multiple drives now due to snapshots. These are actually differencing disks and appear just like a separate HDD to VBox. If you have 4 snapshots you have actually 4 different drives + the original = 5 in total. these all have unique UUIDs and they match the values in the VBox control file. Each one of the differencing disks hold pieces of the whole pie and the next has more pieces and the next has more pieces.. to a total of the whole. Miss one of these and the entire chain is broken and the guest will become useless.
Tell you what, you want to try it your way and I can appreciate that. I like to experiment myself, but this time I can almost promise you are not going to like the outcome, so if you want to proceed be sure to have a good backup if this guest is at all important.
Tell you what, you want to try it your way and I can appreciate that. I like to experiment myself, but this time I can almost promise you are not going to like the outcome, so if you want to proceed be sure to have a good backup if this guest is at all important.
-
edstevens
- Posts: 85
- Joined: 10. Nov 2011, 00:36
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: Oracle Linux; MS Server
Re: expansion of disk files
I can appreciate that the "disk" is physically scattered across multiple files. Is that why the base .vdi file is still showing much smaller than the "disk" was allocated for even though what the guest OS sees is the full allocation of the disk being at 100% usage?Perryg wrote:The guest has multiple drives now due to snapshots. These are actually differencing disks and appear just like a separate HDD to VBox. If you have 4 snapshots you have actually 4 different drives + the original = 5 in total. these all have unique UUIDs and they match the values in the VBox control file. Each one of the differencing disks hold pieces of the whole pie and the next has more pieces and the next has more pieces.. to a total of the whole. Miss one of these and the entire chain is broken and the guest will become useless.
Tell you what, you want to try it your way and I can appreciate that. I like to experiment myself, but this time I can almost promise you are not going to like the outcome, so if you want to proceed be sure to have a good backup if this guest is at all important.
As for why my approach won't work, I completely do not understand. Once I create a 'disk' and attach it to the vm, everything I've described is at the guest OS level and should be completely blind to what the virtualization software is doing. It's all pretty straight forward systems admin work.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: expansion of disk files
Naw it is not straight forward when you add snapshots in the mix. In a normal (on metal) set up you would not have snapshots.
Look at it this way. You have the original install that you then snapshot. Then you install a program. This program is not installed in the base and the base knows nothing about it. The snapshot is actually a shot of the memory at the time you took it and you then build off that. Take another snap shot and install another program and the first two know nothing about that. It gets really hairy after that because you are actually running on stored memory that is being changed that is only tied to the base and previous snapshots by a hook.
And yes the base stopped growing when you took the snapshot because you are not running on it but depending on it being there. As you see that these little snips of work are stored on various differencing disks that are unique, but dependant on the base and all previous snapshots. Like I said it is not a simple as copying data to the new drive, because the differencing disks can not run on their own and are dependant on all the other parts.
Look in your guests folder and the snapshot folder. There you will see the other files and they are fragile. If any one of them are corrupt or their UUID is changed for what ever reason the guest will become unusable.
Look at it this way. You have the original install that you then snapshot. Then you install a program. This program is not installed in the base and the base knows nothing about it. The snapshot is actually a shot of the memory at the time you took it and you then build off that. Take another snap shot and install another program and the first two know nothing about that. It gets really hairy after that because you are actually running on stored memory that is being changed that is only tied to the base and previous snapshots by a hook.
And yes the base stopped growing when you took the snapshot because you are not running on it but depending on it being there. As you see that these little snips of work are stored on various differencing disks that are unique, but dependant on the base and all previous snapshots. Like I said it is not a simple as copying data to the new drive, because the differencing disks can not run on their own and are dependant on all the other parts.
Look in your guests folder and the snapshot folder. There you will see the other files and they are fragile. If any one of them are corrupt or their UUID is changed for what ever reason the guest will become unusable.
-
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: expansion of disk files
IMHO it's also worth remembering that it's the VM which is snapshotted, not just one disk. So if you add a second drive to a VM which uses snapshots then separate snapshot trails will be maintained for the second drive. That Snapshots subfolder is going to have a lot of junk in it, mostly wasting space.
-
edstevens
- Posts: 85
- Joined: 10. Nov 2011, 00:36
- Primary OS: MS Windows 7
- VBox Version: OSE other
- Guest OSses: Oracle Linux; MS Server
Re: expansion of disk files
I've been chewing on this all morning, trying to figure out what I'm failing to grasp and how it applies. I understand that the 'disk' is spread across snapshots. I *really* get how fragile those snapshots are ... most of my problems with VBox have been with that (just look at my posting history).Perryg wrote:Naw it is not straight forward when you add snapshots in the mix. In a normal (on metal) set up you would not have snapshots.
Look at it this way. You have the original install that you then snapshot. Then you install a program. This program is not installed in the base and the base knows nothing about it. The snapshot is actually a shot of the memory at the time you took it and you then build off that. Take another snap shot and install another program and the first two know nothing about that. It gets really hairy after that because you are actually running on stored memory that is being changed that is only tied to the base and previous snapshots by a hook.
And yes the base stopped growing when you took the snapshot because you are not running on it but depending on it being there. As you see that these little snips of work are stored on various differencing disks that are unique, but dependant on the base and all previous snapshots. Like I said it is not a simple as copying data to the new drive, because the differencing disks can not run on their own and are dependant on all the other parts.
Look in your guests folder and the snapshot folder. There you will see the other files and they are fragile. If any one of them are corrupt or their UUID is changed for what ever reason the guest will become unusable.
But what is really bothering me is my take (admittedly my take) on your earlier statement - "try it your way and I can appreciate that. I like to experiment myself, but this time I can almost promise you are not going to like the outcome". My 'take away' from that is that my basic approach (create a disk, mount the disk, copy files to it, remount it to a different directory) is fundamentally flawed due to the way Vbox virtualizes a disk across snapshots. Now, if *that* is true ...
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: expansion of disk files
I don't know how to better describe this. Anyway the easiest way is to clone the current state and then modify the drive if needed.