I was running out of room in my Virtual Box Windows 7 disk. Windows was reporting used space of 18.6 GB and free space of 1.22 GB. My Mac was reporting that my disk image was using up 21.39 GB.
On your Windows Guest:
- Run Disk Cleanup.
- Run Disk Defragmenter.
- Download SDelete and use it to zero out free space. I put sdelete in C:\Windows\System32 and then ran it like this from the command prompt.
C:\> sdelete -c c:/
- Shutdown Windows.
On your Mac Host:
- Run VBoxManage from the Terminal to compact the disk image.
$ VBoxManage modifyhd Windows.vdi --compact
I first tried shrinking the disk image to see if that would free up room using the instructions above which were based on the article How To Shrink Your Virtualbox VM And Free Up Space For Your Hard Disk.
After doing this Windows reported used space of 18.8 GB and free space of 1.03 GB. In other words no difference. But on the Mac the disk image was now only using up 20.51 GB.
On your Windows Guest:
- Shutdown Windows.
On your Mac Host:
- Run VBoxManage from the Terminal to resize the disk image. This is how I did it.
$ VBoxManage modifyhd Windows.vdi --resize N
On your Windows Guest:
- Restart Windows.
- Use diskpart to resize the C: drive to use the new space.
Realizing that compacting did not work I shut down again and this time increased the size of the disk image by 10 GB from 20 GB to 30 GB (N = 30720).
VirtualBox showed in its settings that the disk image size was now 30 GB. But Windows still reported used space of 18.8 GB and free space of 1.03 GB. Again no difference. And on the Mac the disk image was still the same but that was to be expected.
Back to Google which led me to Windows’ brilliant tool diskpart.
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: WIN-7-IMAC-POOP
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 D VBOXADDITIO CDFS CD-ROM 38 MB Healthy
Volume 1 System Rese NTFS Partition 100 MB Healthy System
Volume 2 C NTFS Partition 19 GB Healthy Boot
DISKPART> select volume 2
Volume 2 is the selected volume.
DISKPART> extend size=10240
DiskPart successfully extended the volume.
Windows now reported free space of 11.0 GB.
I originally tried resizing the disk by specifying the size of how much I wanted the disk increased, i.e. 10 GB or N=10240.
$ VBoxManage modifyhd Library/VirtualBox/HardDisks/Windows\ 7.vdi --resize 10240
This failed with the strange error:
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
Fortunately I found out in one of the VirtualBox forums that this happened because I gave the wrong argument to resize. Too bad the error message wasn’t a little more helpful.
Double Bows by Nicholas_T
I have been using VirtualBox for awhile and have been pretty pleased with it considering it’s a free solution. I blogged about wanting to try it over two years ago.
Today I started up Windows 7 on my iMac. Then I tried to start up Windows XP but got this error.
Failed to open a session for the virtual machine Windows XP Pro Media Center.
PIIX3 cannot attach drive to the Secondary Master
Unknown error creating VM (VERR_SHARING_VIOLATION).
Fortunately Google came to the rescue and led me to this article in the VirtualBox forums, Can’t run multiple Instances on OSX Leapord. Once I unmounted the DVD drive in Windows 7 (Devices –> CD/DVD Devices) I was able to start Windows XP.
The lesson is you can’t run two instances if both want to mount the same DVD drive. Not sure if this is a problem with Parallels or VMWare.
Sunrise Heron Silhouette by Brandon Godfrey
A few days I installed Cygwin on a new laptop. I saw the warnings that Cygwin 1.7.x is new but I chose to ignore it for now.
I soon noticed that Cygwin was not remembering my mounts. After reading this on the Cygwin front page I realized I needed to do some more research.
… the mount point storage has been moved out of the registry into files. User mount points are NOT copied into the new user-specific /etc/fstab.d/$USER file. Rather, every user has to call the /bin/copy-user-registry-fstab shell script once after the update.
Next I looked at the /etc/fstab file which pointed me to the Cygwin Mount Table documentation. Using this documentation I did the following steps so that my mounts are always remembered.
- Manually mounted the C: drive.
$ mount c: /c
- Ran mount to determine what to add to my /etc/fstab.
C:/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin on / type ntfs (binary,auto)
C: on /c type ntfs (binary,user)
- Based on the output of mount I added this line to my /etc/fstab.
C: /c ntfs binary,user
- Closed the Cygwin shell, opened a new one and verified the C: drive was properly mounted.
Update 06-15-2010: I should have just followed Cygwin’s directions and ran /bin/copy-user-registry-fstab.
In Windows Vista I installed JBoss. When I then logged in as another user for some reason all the JBoss directories had no permissions, i.e. their permissions were 000. I ignored this and went ahead and copied one of the server directories. Then I tried to go into the copied server directory and could not.
Thinking something was funky I tried to delete the whole JBoss directory but got this maddening and uninformative window.
I googled for a long time but could not find a satisfying solution. I gave myself full control permissions for all files and folders but that did not help. Then I noticed that if I clicked on one of the directories that Windows Vista was not letting me delete I would be prompted for permission to enter this directory. Then I would repeat this process for all directories within. After doing this I could delete that directory.
I then looked in Cygwin and found out what Vista had done, it had simply given the directory read and write permission.
Therefore the simple solution was to do the following:
chmod -R 500 .
After doing that simple change I could remove everything.
I was running out of space on one drive so I decided to move my Cygwin installation to another drive.
It turned out not to be too difficult thanks to this article Hints for Setting up Cygwin. This is how I did it though there might be a simpler way.
- In a bash shell save the mount points as a batch script.
$ mount -m > /c/cygwin-mount.bat
- Close the bash shell.
- Move the cygwin folder from one drive to the other. In my case that was from C:\cygwin to D:\cygwin.
- Update all the short cuts for Cygwin in the Start Menu to use the new drive.
- Update cygwin.bat, which is in the top level of your Cygwin installation, to use the new drive.
- Update your Windows environment variable to use the new Cygwin bin path, e.g. D:\cygwin\bin.
- Open a DOS cmd prompt. Run umount to unmount the old Cygwin mounts.
- Next run the mount points script.
- Open a Cygwin bash shell to make sure everything is working correctly.
I tried to make the Mac hibernate based on this article, Make my Macbook Pro Hibernate. Unfortunately it did not work and I am wondering if it is because this article is older and maybe it does not work for Mac OS X Leopard.
In the end I have gotten used to not having hibernate on the Mac since start up and shutdown are so fast.
Windows NTFS has a nice but relatively unknown feature called NTFS junctions. It is like hard links in Unix except it is only for directories. Microsoft has a KB article about it which points to several utilities. However I have been using Mark Russinovich’s junction tool exclusively.
-s Recurse subdirectories
If you want to create or delete a junction, use Junction like this:
Usage: [-d] 
To delete a junction specify the -d switch and the junction name.
Here is an example of using junction. Note that the order of arguments is opposite of the Unix ln command.
> junction foo d:\docs\foo
The above example will create a junction called “foo” in the current directory. This junction will point to d:\docs\foo.
To do the same in Cygwin:
$ junction foo `cygpath -aw /d/docs/foo`
One tip is to use the DOS dir command. It will display instead of in directory listings for junctions.
I tried many times to install the Microsoft Office 2008 update 12.1.0 but each time it would hang.
Finally I found this forum thread about the exact same problem, Msi Wind Forums • View topic – Microsoft Office 2008 update 12.1.0 will not install.
This is how to get the update to install.
Should have an option to edit……thing is it’s to late because your forced quit. Run the installer again and when the installer hangs move the installer window to one side…the error window noted above should be directly behind the installer and thats why you missed it in the first place…the installer has halted (and appears hung) as the error window is awaiting a response from you…..but you dont see it. All you have to do is click the edit button on the error window and then installer will continue…thats it. You can close the error window and the installer will continue.
Running Java scripts in Cygwin bash scripts becomes a little tricky because you want to treat most paths in Cygwin as normal UNIX paths but Java expects DOS paths. Therefore to get around this you can use the mixed option for cygpath.
if [ -e /usr/bin/cygpath ] || [ -e /bin/cygpath ]
export FOO=`cygpath --mixed "e:\work\betweengo/target/foo"`
The result on Cygwin is that FOO will be set to “e:/work/betweengo/target/foo” which will work both in DOS and UNIX.
Previously I recommended TcpView to help figure out what ports are being used. But today I was informed of an even better, more informative program called What’s Running.
Update Feb 27 2014: Unfortunately this does not work on Windows 8.0. Development for this program apparently ceased in 2010.