Migrating to Linux

From JimboWiki
Jump to: navigation, search

Want to start computing in Linux? Have a Windows system that you're not ready to give up? Hate the idea of dual-booting? Yeah, me too. Luckily for us, I think I've found a fairly nice solution.

NOTE: I just finished getting this to work - I started on 10/14/07, and finished on 10/25/07. I have not completely documented the procedure, but there are a lot of good hints here. Stay tuned for more.

Summary

I have a laptop with an 80GB hard drive dedicated to Windows. I have purchased a new 200GB drive which I plan on installing both Windows and Ubuntu Linux 7.10 on. Sound like dual booting? Well, so far it is. Then through some trickery, I'm going to make it possible to be able to run Windows in a virtual machine (henceforth "VM"), but still make it possible to boot directly into Windows if the need arises. Using a VM makes sure that I can run any software designed for windows - not just the ones that work with a compatibility layer. Having dual-boot compatibility means that I can free up the resources used by the VM software and the host operating system if I want to.

After I get that working, I plan on looking into WINE, a Windows compatibility layer for Linux. Hopefully, I can use WINE to minimize the need for the VM. If I'm tricky enough, I might even be able to get it to use the same installation of Windows.

This is all very prone to accidental destruction of both operating systems, so I would suggest you not do this before backing up everything - say in a nice Notron Ghost image. No, I don't get a commission on plugging Ghost, it's just a nice tool.

This procedure is VERY technical. I do not recommend you attempt it without a significant amount of knowledge about Windows, at least some knowledge about virtual machines, and a vast knowledge about how to fix Windows when it's broken. Or at least make some good backups before you start.

Plan

Here's the overview of my plan:

  1. Image the old drive onto the new drive - this allows me to keep the entire Windows installation intact and unchanged - no need to reinstall software or anything like that.
  2. Install Ubuntu 7.10 Gusty Gibbon. When I did this, 7.10 was still in beta - the release version is now available. I had no significant problems with the beta install, and I'm sure the release is better.
  3. Set up VMWare Server in Ubuntu (available for free)
  4. Set up Windows with hardware profiles to allow it to boot in both VM and standalone mode
  5. Check and make sure everything works

The How-to

Like I mentioned earlier, I haven't finished documenting this project yet. I have all the pieces, now I just need to put them together. Watch here for more details as the fun unfolds.

  1. Use your favorite imaging tool to image your Windows installation to the new drive, or install a fresh copy of Windows
    • It's important that Windows be installed first. The Windows designers apparently don't think other operating systems exist, so they simply overwrite the boot records to only allow Windows to be booted. If you have a lot of extra time, you can get around this, but it's really not worth it.
    • Be sure that Windows is installed on the first partition of the primary drive. Windows does not like to be anywhere else.
    • I used a copy of Acronis Disk Imager - which is not free - to do the drive-drive copy. You can use any drive-to-drive imaging software to do this step.
      1. Install the old drive and the new drive into a computer. In my case, I used a desktop machine for this, because the laptop does not fit 2 drives (For laptop IDE drives, you can buy an adapter to make them work in towers - the adapters are about $5, and worth every penny. For laptop SATA drives, the connectors are the same as the desktop computer.)
      2. Boot into the imaging software (In my case, Acronis - I found that Norton Ghost does not do drive-drive copy in the bootable mode)
      3. Copy the drive (this took me about 35 minutes for an 80GB drive.)
    • If you want to do the imaging with the free "partimage" Linux tool, follow these steps:
      1. If Windows is installed on an NTFS partition (the default for Windows 2000/XP), defragment the Windows NTFS partition. This will help avoid issues in the imaging process
      2. If you're using a desktop machine and plan on using a new hard drive, install the new drive - this saves some work later
      3. Boot using the Ubuntu Live/Install CD
      4. Get it connected to the Internet
      5. Install "partimage" using apt-get
      6. Run partimage (from console) and create an image of the Windows partition to some external device (network share, removable hard drive, whatever you like)
      7. If you did not install the new hard drive, install it now. Boot the live CD again, get it back online, get partimage installed.
      8. Install "gparted" and "ntfstools" using apt-get
      9. Create a new NTFS partition of about the same size as the drive you just imaged (must be same or larger) on the new hard drive
      10. Use partimage to fill the new partition from the partimage image file
  2. Install Ubuntu using the "Install" shortcut on the desktop of the Live/Install CD
    • IMPORTANT! When asked to set up partitions, select the advanced mode.
    • Use your brain for the other options - it's pretty simple.
      1. Do not alter the existing NTFS partition
      2. Add a partition of type ext2, size about 100MB, mounted at /boot. We have to separate out a boot partition so that when the bootloader runs in the VM, it doesn't conflict with the root filesystem of the host operating system. (For those not intimately familiar with Linux, /boot is where the bootloader lives.)
      3. Add a swap partition - 512-1024MB depending on what you feel like.
      4. Add a partition of type ext3, filling the rest of the drive, mounted at /.
      5. For the remainder of the installation, default values are acceptable.
      6. The installer should detect Windows and add it to the Grub bootloader automatically. It may also ask you if you want to import settings from Windows. (That didn't work for me at all, but it's a nice idea. I was using the beta install, so it may have been fixed.)
  3. Boot and configure Ubuntu
    • In order to limit exactly which partitions VMWare Server will be allowed to use, our user account must have read access to the partition devices. This is handled in Ubuntu using the "disk" group.
    • If you don't believe me, run ls -l /dev/hd* (or ls -l /dev/sc* if you're using SATA or SCSI drives) and look at the permissions granted to the disk group
      1. Create a group called disk if it doesn't already exist (use the tool in System --> Administration --> Users and Groups if you're not sure how to do this any other way)
      2. Make your regular user a member of the new disk group.
      3. As with all user permission changes, you will need to log out for this change to take effect.
  4. Boot Windows and set up hardware profile
    • This step isn't technically necessary, but it will make Windows much more reliable and cut the boot time significantly.
    • Windows is capable of storing multiple bootable hardware configurations. This is important for us, because VMWare Server will not be emulating the same hardware that is physically installed in the system.
      1. (I'll fill this in later, you can probably figure it out if you've gotten this far)
  5. Install VMWare
    • At the time of this writing, VMWare Server is not in Ubuntu's apt repository. If you can find it in there, install from there. Otherwise, use the tar.gz version with automatic installer available from VMWare's website. In my experience, all default options were acceptable, though I haven't tested advanced features like UBS hub emulation.
  6. Create the VM
    • Choose physical device, and select partitions.
  7. Troubleshooting
    • Unaccessable Boot Device (0x0000007B Blue Screen)

Notes

  • tried to use partimage instead of Norton Ghost - it's free, and it runs in Linux. Seems to work pretty well with NTFS
    • needed to create an NTFS partition with gparted - had to install ntfstools to do that
  • Used Acronis bootable imaging tool to fill the new disk
  • Got Windows to boot, significant work due to hardware confilcts