One might pick a large maximum dynamic disk size for a VirtualBox guest OS, not realizing that even if one uses a small portion of that maximum size, the guest OS (especially Windows) will spread itself out, so that say a 10GB Windows XP NTFS image will consume say 30+GB of your host OS (assuming you set the maximum dynamic size >30GB).
Here’s a fairly painless procedure to fix this. Should take less than 1 hour on a modern PC. I assume your guest OS is Windows XP, and your host OS is Linux running VirtualBox 4.2.4.
BACKUP YOUR VDI FILE BEFORE DOING THIS PROCEDURE!
- in guest Windows XP, run Disk Defragmenter
- in guest Windows XP, in Command Prompt, run
sdelete -z c:\ which can be downloaded from http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx
- shutdown guest Windows XP, and “insert” the Gparted ISO file (obtained from http://gparted.sourceforge.net/ ). You do this by right-clicking the CD icon at the bottom of the guest OS VirtualBox window and selecting your ISO file.
- Resize your guest Windows XP partition so that you have only say 8GB free (e.g. original partition 40GB, only 10GB used–>resize to 18GB)
- reboot guest Windows XP, removing the Gparted ISO file from VirtualBox. you will see Windows XP automatically runs CheckDisk–this is normal. You will need to reboot guest Windows XP once more, then shutdown guest Windows XP
- in host Linux, in Terminal type
cd ~/VirtualBox*/WinXP (or wherever your .VDI file is located. Then type in Terminal
vboxmanage modifyhd --compact MyFile.vdi where MyFile.vdi is the name of your VDI file.
- Now you’ll see in Linux that the size of your VDI file has dropped a lot! Nice!
Note: for future reference, when you Defragment in guest Windows XP, this actually makes your host VDI file INCREASE in size by the amount of bytes that were moved to defragment!
To fix this, repeat steps 1,2, and 6 of the procedure above when you find your VDI has grown to an annoying size.
The take-away point is, do not make large maximum size Dynamic VDIs to start–this problem will only repeat itself over time.
Note: if you have 64-bit Student Matlab (i.e. Matlab Student R2013a and higher), then you skip step 2.
Note: This procedure (step 2) is now obsolete for 32-bit Matlab as ia32-libs is no longer available.
ifconfig | grep eth0 and be sure you have an ethernet card listed–if not, you may need to consider renaming your ethernet card as in
sudo apt-get install ia32-libs
- if you haven’t already downloaded your files, here’s how to run the “download agent” to get the matlab download
javaws download_agent. This is an optional step.
- navigate to the mathworks files you downloaded, and
- set executable permissions:
chmod +x install
- set java executable permissions:
chmod +x sys/java/jre/gln*/jre/bin/java
- finally, navigate to your ~/mathworks_downloads/R2012a_Student_Version
- Be sure to use Custom, and to Install Symbolic Linux
- When starting Matlab, you will need to use
matlab -glnx86 -desktop
- to put links to Matlab in your menus, etc. consider the procedure at: http://blogs.bu.edu/mhirsch/2012/12/ubuntu-fixing-desktop-icons-and-menu-items-for-matlab/
Cygwin installs the minimal amount of packages necessary, so to do work with many programs, you must install the prerequisities. This is especially true when trying to read FITS files in Octave using the Octave-FITS package, which depends upon the CFITSIO library.
Here are the prerequisities you’ll need (get them using the Cygwin Setup.exe program)
make pkg-config gcc-g++ libgfortran3 libGraphicsMagick3
octave octave-devel octave-forge
Now, you’ll need to download the CFITSIO source code from http://heasarc.gsfc.nasa.gov/fitsio/ (get the “Unix .tar file”)
–copy this file to your Cygwin home directory (e.g. if your username is “joe”, then c:\cygwin\home\joe)
In cygwin, type
tar -xvf cfitsio*.tar.gz
./configure --prefix=/usr/local --enable-reentrant --enable-ssse3
make && make install
Now you must tell pkg-config where your libraries are by typing
Now, be sure you’ve downloaded the latest octave-fits package from Octave Forge, and put them in your cygwin home directory (e.g. c:\cygwin\home\joe if your username is joe)
Now in Cygwin type
pkg install fits-1*.tar.gz
(you must change to your ~ directory or pkg install will fail!)
This should install FITS without errors. Type
pkg load fits to enable the FITS functionality. Note, the command is NOT fitsread(), in octave the command is
POSSIBLE CONFIGURATION CHANGES NEEDED:
- If you get an error message upon ./configure that gcc/g++ can’t be found, in Windows go into Control Panel>System>Environment Variables and Delete variable named “CC”. Keep a record of what it was in case you need to put it back! Then reboot
Working with ASCII text files from various operating systems, you might encounter a case where Octave or MATLAB using fileread() reads an ASCII file with one character per line.
E.g. an input file in.txt containing:
Joe 100 eggs
and executing: data = fileread(‘in.txt’)
To workaround this problem, try doing:
data = fileread('in.txt');
data = data(:)';