Knoppix, Partimage, VMware, mmmm Blog
I had been doing the multi-boot thing on my Toshiba Satellite 5205-S703 since I bought it in late 2002. It came factory installed with Windows XP Home Edition (monopoly anyone?) on an NTFS partition. Thanks to Partition Magic 7.0, I soon ended up with the following partition table:
Physical Geometry: 7,926 Cyls, 255 Hds, 63, Sects Drive: C: Partition Type: 07 (Hex) NTFS Serial Number: F8CD:F94F Total Physical Sectors: 80,080,632 (3,945.6 MB) Drive: E: Partition Type: 08 (Hex) FAT32 Serial Number: None Total Physical Sectors: 8,353,800 (4,079.0 MB) Drive: Extended Partition Type: 0F (Hex) ExtendedX Serial Number: None Total Physical Sectors: 100,775,745 (49,206.9 MB) Drive: F: Partition Type: 08 (Hex) FAT32 Serial Number: None Total Physical Sectors: 78,605,982 (38,381.8 MB) Drive: SWAPSPACE2 Partition Type: 82 (Hex) Linux Swap Serial Number: None Total Physical Sectors: 2,120,517 (1,035.4 MB) Drive: Linux Ext2 Partition Type: 83 (Hex) Linux Ext2 Serial Number: None Total Physical Sectors: 20,049,057 (9,789.6 MB)
C: contained the factory Windows XP, E: contained Windows 2000 Professional, where I did most of my production work, including work on mozilla.org side projects. In the GNU/Linux partition, I ran Sun Java Desktop System Linux. I used GRUB as my bootloader, but somehow managed to have the Windows bootloader in there as well (like a sub-menu) to choose between Win XP and 2k, once "Windows" had been chosen from the main menu. I never bothered to fix that.
At the JAOO 2006 conference, VMware was giving out free licenses to their VMware workstation 5.5 product. Seeing an opportunity to free myself from the shackles of a multi-boot existence, I took one. Several months later, I began the long and arduous process of converting my multi-boot machine into one that just boots the factory installed OS (since that's the only thing officially supported by the manufacturer anyway) and uses VMs for the other OSes.
I wanted to convert the OSes installed in my real hard disk partitions into VMs. Here is the high level process I will use.
Install VMware Workstation 5.5 under the Windows XP OS, using an external disk for extra space and to contain the VMs for the guest OSes.
For each OS on a real partition on my disk
Use a Knoppix 3.7 CD I had made years ago to boot the Toshiba laptop. Once booted into Knoppix, use partimage to create partition images of all the OS partitions on the mahcine. Swap partitions needn't be imaged, for obvious reasons, and data partitions needn't be imaged because they can simply be copied. I stored the partimage files on an external disk.
Create a VM for that OS, storing it on an external disk.
Boot the VM into Knoppix
Install VMware tools into the running Knoppix instance so I can access the partimage files using the "shared folders" feature of VMware.
Use partimage to restore the OS partition into the virtual hard disk of the VM.
Re-install the appropriate boot loader for that OS to enable that OS to boot.
Once VMs had been created, on an external disk, for all the OSes on real partitions, completely and totally wipe, defrag, and re-install from factory media the laptop. After the factory restore has completed, run Windows update however many times I need to get the machine totally up to snuff and current. Re-install virus protection software and other essential goodies. Note, on the core, non virtual OS, I plan to install very little real software, just stuff that absolutely has to have access to the real hardware.
Details for the hard part: Steps b. thru f. above
Create the new VM using VMware.
Set the guest OS type to be the type of the OS stored in your partimage files.
Make sure the hard drive types (IDE or SCSI) match what is in the partimage files. I chose to pre-allocate space. Not sure if this is necessary.
Make the same amount of disk space is allocated in the VM as was in the partition from which the partimage files were made.
Because you are using the Knoppix live CD, you need to mount a second CDROM drive from the
linux.isofile, located in the install directory of VMware. Make sure to assign IDE 1.1 to this virtual CDROM drive.
Use the VMware shared folders feature to expose your partimage files to the VM.
Boot knoppix and install VMware tools into the running Knoppix instance.
Download the vmware-knoppix-overlay.tar.gz to a real machine on which an FTP server is running. In fact, this can be the VMware host machine, but it needn't be.
With the Knoppix CD in the drive, start the VM, pressing escape during the VMware startup screen to enter the boot menu. Select CDROM.
When Knoppix starts up, get root access:
su -, then
cd /tmp tar -zxf /mnt/cdrom1/VMwareTools-5.5.3-34685.tar.gz
Use FTP to transfer the
vmware-knoppix-overlay.tar.gzfile to /tmp in Knoppix.
cd / tar -zxf /tmp/vmware-knoppix-overlay.tar.gz cd /tmp/vmware-tools-distrib ./vmware-install.pl
This will run the modified VMware installer for Knoppix. When it asks "In which directory do you want to install the binary files?" answer
Accept the defaults for the rest of the questions until it asks, "What is the location of the directory of C header files that match your running kernel?" Answer
When done with these scripts, you should have access to your shared folders under the path
fdiskunder knoppix to partition the virtual disk, most likely it will be
/dev/hda, in such a way that it is equivalent to the partimage files you are going to restore. For example, if the partimage files were created from a
JFSfilesystem, use JFS as the partition type in
fdisk. If you need to create a swap partition, make sure to do that as well.
Use partimage to restore the image files under
/mnt/hgfsto the new virtual disk.
Lastly, you need to make sure that the boot loader has been restored. It's very unlikely that you can use the bootloader that happened to be installed in the partimage files. Of course, bootloaders are a matter of preference, but I used GRUB. Here's what I had to do in my case.
Back at the root prompt in Knoppix:
mkdir /mnt/hda1 mount /dev/hda1 /mnt/hda1 cd /mnt/hda1/boot cp -r grub grub.orig rm -rf grub grub-install --no-floppy --root-directory=/mnt/hda1 --recheck /dev/hda
At this pount the guest OS should boot.
Of course, your mileage may vary, but hopefully there is some useful information here. It was a PITA for me to figure this out so I thought I ought to share it once I did.Technorati Tags: edburns