LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This 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


Reply
  Search this Thread
Old 10-25-2015, 10:48 AM   #1
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.

Any hope for doing something like that?
 
Old 10-25-2015, 01:58 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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
Code:
VBoxManage modifyhd $NEW_IMAGE.vdi --resize $NEW_SIZE_IN_MB
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.
 
2 members found this post helpful.
Old 10-25-2015, 02:07 PM   #3
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
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?
 
Old 10-25-2015, 02:43 PM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by xode View Post
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.

Thanks for asking.
 
Old 10-25-2015, 02:48 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
ext4 will work fine for this purpose. Host distribution, size of RAM and size of partitions you use is irrelevant for this problem.
 
Old 10-25-2015, 02:56 PM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by TobiSGD View Post
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 View Post
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.

Thanks.
 
Old 10-25-2015, 03:45 PM   #7
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
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?
 
Old 10-26-2015, 06:40 AM   #8
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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:
Code:
df -h
Filesystem      Size  Used Avail Use Mounted on
/dev/sda1        15G   10G  3.9G  73% /
/dev/sda3        19G  6.0G   12G  35% /home
/dev/sda5        19G  5.7G   12G  34% /usr/local
/dev/sda6        19G  3.3G   15G  19% /opt
/dev/sda7        19G  663M   17G   4% /var/lib/mysql
/dev/sda8        92G   40G   47G  46% /var/lib/virtual
/dev/sda9        92G   12G   76G  14% /spares
/dev/sda10      173G  129M  164G   1% /var/lib/pgsql
/dev/sdb1        74G  3.6G   66G   6% /back01
/dev/sdb2        74G   52M   70G   1% /back02
tmpfs           3.9G     0  3.9G   0% /dev/shm
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.

Thanks for your interest.
 
Old 10-29-2015, 12:58 AM   #9
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
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?
 
Old 10-29-2015, 06:36 AM   #10
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by xode View Post
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.

Thanks.
 
Old 10-29-2015, 10:05 AM   #11
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
My recommendations:

(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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] if attacker compromises virtualbox guest win7 ... ////// Linux - Security 3 04-28-2015 08:32 AM
Scientififc Linux guest does not see a hard disk space using VMWare Player on Win7 rich100 Linux - Virtualization and Cloud 7 01-27-2015 10:57 PM
Host Fedora14, Windows 7 is running as Virtualbox guest- Mic is not working on Guest mwaheed Linux - Virtualization and Cloud 1 10-20-2011 12:51 PM
host ran out of disk space, guest virtual disk got corrupt help please fedora.linux.64 Linux - Virtualization and Cloud 16 08-09-2010 05:04 PM
VirtualBox Slackware guest on Win7 host -- folder sharing R_Shackleford Slackware 3 07-15-2010 11:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 05:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration