Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Running Out of Win7 VirtualBox Guest Disk Space
I've got a Win7 virtual machine that was originally sized at 40G and is running out of space (about 8G left plus or minus) periodically.
I have a second drive with two 74G partitions and I'd like to use one of those for Win7, just give it the whole partition and be done with removing stuff to make space. I really only use Win7 for Turbotax, Stamps.com and, rarely, FamilyTreeMaker but the darned thing gets nearly filled up.
I don't want to go back to dual booting, I want to continue to use VirtualBox and I really, really don't want to reinstall Win7 from disk in VirtualBox and sit though a couple of days of critical updates.
I'm looking for a nearly painless way of exporting or copying or whatever would work to transfer the existing Win7 to that second drive so that the virtual machine can use the entire partition space and I don't really know how to do that (like, do I create a new virtual machine then copy to it or what?). The existing virtual machine is at least five years old and has been though a lot of VirtualBox updates.
It is actually quite easy, format the partition you want to use for that with a filesystem of your choice, copy the virtual disk image to that partition and configure your VM in Virtualbox to use that file instead. Then use this command
where you replace $NEWIMAGE with the path to the new disk image and $NEW_SIZE_IN_MB with the new size you want to use in MB.
Once you have done that, start the VM and use the Windows partition manager to extend the virtual Windows partition to the whole disk.
I don't think I have to tell you to keep the original disk image until you know that everything works fine with the new image, but I do it anyways.
Could you please give me additional information: for your PC hardware, how much RAM and how large is/are your hard drive(s)?; and what host OS are you using?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
Rep:
Quote:
Originally Posted by xode
Could you please give me additional information: for your PC hardware, how much RAM and how large is/are your hard drive(s)?; and what host OS are you using?
The system is Slackware 64-bit 14.1 stable (probably should have mentioned that).
The existing Win7 VM is allocated 8G RAM (the other 8G is system RAM), the disk partition is 75G where it's going to go. There are two drives, the one where the Win7 VM lives now and a second 150G drive that's split in half, one 75G partition for back up and one 75G partition for the VM. The file systems on all drives are ext4.
The present partition where the VM lives (with a couple of other VMs that come and go) is 92G. I want to move Win7 to the second drive and give it the whole partition. The existing partition will remain where it is and be used for other VMs when I get in the mood.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
Rep:
Quote:
Originally Posted by TobiSGD
Once you have done that, start the VM and use the Windows partition manager to extend the virtual Windows partition to the whole disk.
You know, that using the Windows partition manager to extend... I once tried to increase the size of the Win7 VM and the partition manager refused for some reason I can't remember, something about a primary something or other. Hope that won't happen.
Quote:
Originally Posted by TobiSGD
I don't think I have to tell you to keep the original disk image until you know that everything works fine with the new image, but I do it anyways.
Oh, yeah, the original stays in place for at least a month before I'll be confident enough. Been there, did that, regretted having done so, won't ever do it again.
A couple of questions: (1) is it possible for you to acquire an additional 1000 GB or so hard drive for your PC?; your PC as a whole looks like it is starving for hard drive space; (2) is your Win7 VM under VirtualBox like the VMs I use under VMware as in the virtualized 40G hard drive that your Win7 VM sees is actually a hard drive image file on the actual hard drive?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
Rep:
Hi, xode,
The system has two drives, sda and sdb. The second drive, sdb, is a 150G drive with two partitions, both 74G, that I use for doing some back ups and for stashing stuff temporarily. One of those two partitions is going to be the new home for the Win7 VM.
The other drive is partitioned the way I've done so for, well, decades; it looks like this:
I do this so that I can do a fresh install of system software without wiping out a whole lot of stuff that's living on those partitions (you just don't format them as you add them to fstab during installation). I have four systems, all partitioned the same with varying partition sizes depending on what they're doing; e.g., the MariaDB/MySQL server has a huge data base partition but a small PostgreSQL partition and vice versa on the other. The only system that has VirtualBox on it is this one, the others have the mount point but pretty much no space allocated. The data base servers sit quietly in the closet mumbling to themselves and a laptop sits on a shelf until I need to lug it somewhere.
What are they? Well this one is a Dell Optiplex 780, the data base servers are Dell Dimension 8400 (about 10 years or more old, 32-bitters) and a laptop is a Dell Inspiron 1750. Everybody has Slackware 14.1 stable (64-bit and 32-bit appropriately) and are kept fully patched. This machine has been up for 123 days (had a power outage a while back), the Dimensions have been up for 275 days (their UPS has a bigger battery). The laptop is just off until needed.
When you set up a virtual machine you pick the OS you're installing and a size. I chose 40G for Win7 a long time ago simply because I really don't use it for anything (well, critical updates every couple of weeks). However, tax time is coming and that means that TurboTax is coming and I'm outta space for it and need to expand Win7 to that second drive with the 74G partition.
Just for grins, this is what the files look like:
Code:
ll /var/lib/virtual/Machines/Win7
total 41829512
drwxr-xr-x 3 trona users 4096 Oct 25 12:35 ./
drwxr-xr-x 3 trona users 4096 Mar 8 2014 ../
drwxr-xr-x 2 trona users 4096 Oct 25 12:12 Logs/
-rw------- 1 trona users 12517 Oct 25 12:35 Win7.vbox
-rw------- 1 trona users 12517 Oct 25 12:10 Win7.vbox-prev
-rw------- 1 trona users 42833367040 Oct 25 12:35 Win7.vdi
That vdi file is Win7 and I need to make it bigger.
Just for comparison, the root partition? 15G? 10G used? That's the entire Slackware Linux system. Wow.
I don't know diddly beans about VMware, tried it about 10 years ago or so, but I think it wants a partition all to itself that it formats? Something like that. VirtualBox doesn't, it uses a file.
I'm think that 74G ought to be enough for Win7 plus some software and today's the day to give it a shot following TobiSGD's guide. If there's no smoke and sparks flying out of the vent slots I'll be a happy camper.
From what I see: your Win7 virtual machine is currently on /dev/sda8 (/var/lib/virtual) which is 92G in size, of which only 40G is used and 47G is free. Did I read things correctly?
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Original Poster
Rep:
Quote:
Originally Posted by xode
From what I see: your Win7 virtual machine is currently on /dev/sda8 (/var/lib/virtual) which is 92G in size, of which only 40G is used and 47G is free. Did I read things correctly?
Yep, right you are, it's the only virtual machine currently.
I have tried to extend that with the Windows partition manager and it refuses to (right now I don't remember the error, something about primary, secondary, or some other thing), thus this question.
I'm going to give TobiSGD's method a shot when thing quiet down enough so I can devote an hour or three (wife's getting set up for chemo and there's a lot of long range driving just now).
If there's a simple, hey, just do this, I'll try anything at least once.
(1) make a copy your entire Win7 virtual machine as it stands now (i.e. /var/lib/virtual/Machines/Win7) and put that copy in /dev/sdb1 (/back01) so you still have the original Win7 virtual machine if anything goes wrong while you are trying to upgrade the original.
(2) use TobiSGD's suggestion of "VBoxManage modifyhd $NEW_IMAGE.vdi --resize $NEW_SIZE_IN_MB" to increase the size of hard drive image file in VirtualBox for your Win7 virtual machine in /var/lib/virtual/Machines/Win7. Then, start up that Win7 virtual machine and use the Windows partition manager to have that Win7 virtual machine recognize and use all of the increased hard drive image file.
(3) If the Windows partition manager won't cooperate, then delete the Win7 virtual machine in /var/lib/virtual/Machines/Win7 and restore your original Win7 virtual machine by copying it from /back01 to /var/lib/virtual/Machines/Win7. Then use VirtualBox to add another hard drive image file to your Win7 virtual machine in /var/lib/virtual/Machines/Win7. Then, start up that Win7 virtual machine and use the Windows partition manager to have that Win7 virtual machine recognize the additional new hard drive image file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.