Thursday, 31 May 2012

DUAL BOOT XP/UBUNTU LINUX (Part 1)

How to turn your Windows XP into a Linux dual-boot...

Windows XP
Level : Advanced

For those of us who do considerable work in the Linux environment, a Windows-only notebook is far from ideal. I worked with Unix on Windows packages such as Uwin and Cygwin for several years, but I finally decided I wanted a full Linux installation on my notebook.

Prerequisites: Disk Space and CDs

As you might expect, a dual-boot computer requires more disk space than a computer running just one operating system. I don’t recommend performing an XP/Linux dual-boot conversion with a drive smaller than the 30 GB that my older notebook had. A system with more than 60 GB disk space is a more ideal starting point.

When reconfiguring operating systems on a hard drive, you must be able to boot the system using a CD that has appropriate tools for disk partitioning, fi le editing, and so on. I used the System Rescue CD (www.sysresccd.org/Main_Page), a Gentoo Linux 2.4 Live CD (www.gentoo.org) with system utilities including QtParted, GRUB, LILO, archiving tools, editors, CD tools, Perl 5.8, CaptiveNtfs,and others. I downloaded the ISO image file using Windows and made my CD using Alex Feinman’s excellent ISO Recorder (isorecorder.alexfeinman.com/isorecorder.htm). I downloaded the installation ISO file for Ubuntu 5.10, “The Breezy Badger,” at Ubuntu’s download page (www.ubuntu.com/getubuntu/download). Again, I made the CD using ISO Recorder.


Windows Disk Preparations
If you’re converting a Windows system that you’ve used for some time, the disk may be nearly full, and the files will likely be scattered across it. To install Linux, you need to divide the disk into multiple partitions. One way to do this is to destructively repartition the entire disk, but then you have to reinstall Windows and all of your Windows software—not a pleasing prospect. A better solution is to resize the Windows NTFS partition, then add new partitions for Linux, Linux swap space, and a FAT32 shared partition.

Because my Acer notebook’s disk was 85 percent full, the fi rst thing I had to do was remove files.
If you’re in this situation, see how much space you can free up by:

  • Backing up all critical files (or performing a full system backup if you have capability to do that).
  • Removing Windows software that you never use and never plan to use, using “Add or Remove Programs” (“Uninstall a program” in Vista) in the Windows Control Panel or the uninstallation programs that came with the software.
  • Removing unneeded data files.
  • Moving documents, data files, and project workspaces (for example, software development directories) that you can later store temporarily in the new shared partition to another computer.
  • Emptying the Windows Recycle Bin.
  • Doing all of these things decreased my Windows disk usage to 10 GB, leaving 18 GB free. However, the files were still scattered across the disk.

Before you can resize the NTFS partition, you must move all files to the “front” of the disk. You can see the locations of files on your disk by running the Windows Defragmenter utility. Go to Start→All Programs→Accessories→System Tools→Disk Defragmenter to launch the defragmenter. Figure below illustrates my disk usage after the defragmentation cycle completed.


Notebook disk usage after running the Windows disk defragmenter



The files were not as completely packed into the “front” of the disk (the left side of the Defragmenter diagram) as I would have expected. A little research revealed that the Windows Defragmenter applies a less-comprehensive defragmenting approach than is available in some commercial programs. I decided to rerun the Windows Defragmenter. After three more runs, my disk usage looked more like this:


Notebook disk usage after four Windows disk defragmenter runs


This result looked adequate. More than half of the disk was available for my Linux installation, Linux swap, and the shared FAT32 partition.

One problem that you may encounter in defragmenting a Windows disk using the Windows Defragmenter is unmovable files (the green bars, if you’re looking at your results) located in inconvenient locations (on the right side of the display, near the end of your disk). The two most common unmovable laptop files are the Windows operating system paging file (pagefile.sys) and the hibernation file (hiberfile.sys), which stores the system state when the XP operating system goes into “hibernate” mode. An easy solution is to temporarily remove these files, then reinstall them after you’ve resized the NTFS partition. If you need help with this, see my blog entry “Moving the Unmovable: Windows Disk Defragmentation Strategies” (lyratechnicalsystems.com/?p=9).

Dual-Boot Computer Disk Partitioning


When sizing your partitions, consider the following:

  • Windows NTFS partition: Provide adequate space for the full operating system (including anticipated future patches), installation of all applications you want, and plenty of extra space (just to be safe).
  • Linux ext3 partition: Provide adequate space for the full operating system; for convenience, allow enough space for software installation in the default install locations (/usr/bin, and so on).
  • Linux Swap: Follow the standard rule of allocating swap—twice your RAM.
  • Shared FAT32 partition: Don’t make this too small. For example, if your email will reside on the shared partition, that alone can quickly occupy gigabytes of disk space.

Once you’ve decided on partition sizes, boot the system using the System Rescue CD. When the rescue CD presents the boot: prompt, I recommend entering fb800 nodetect:


boot: fb800 nodetect


This setting bypasses a full search for the devices on your computer. When I tried the default boot with my new HP, the system displayed the message “USB and PCI hotplugging” and froze, forcing me into a hard power-down. My Knoppix 3.7 LiveCD also failed to complete its boot on the HP, using the default options. Because I don’t plan to work with USB or hotplug devices, there is no need to detect them.

After the rescue CD boots, you’ll see a Linux command prompt. Enter run_qtparted to launch the QtParted disk partitioning application. (Documentation and screen shots are available from the project’s site at qtparted.sourceforge.net.)

Select the Windows partition (this was /dev/hda on both my systems), and resize it: select Operations→Resize, enter the new partition size (observe your units, MB or GB), and click OK.

Next, create a second primary partition, of type ext3, for the new Ubuntu system: highlight the “02” partition, and select Operations→Create. Set “Create as” to “Primary Partition” (so that the Linux system can boot), select “ext3” as the partition type, give the drive a sensible partition label, enter the partition size, and click OK. Create the Linux swap partition by highlighting number 03 and selecting Operations→Create. Select “linux-swap” as the partition type, select the swap size, and click OK.

Finally, create the FAT32 partition that both operating systems will share. Highlight number “04” and select Operations→Create. Set the partition type to FAT32, provide a label, and allow the partition to use the remainder of the disk.


Now, study the color-coded diagram at the top of the QtParted window. The sizes of the colored partition regions should match what you expect to see based on your disk space allocation design. If there is any doubt, you can select Device→Undo to undo your changes, or exit QtParted and start over.

When you’re absolutely certain that everything looks correct, select Device→Commit. The QtParted program will warn you that all partitions must be unmounted. The hard drive partitions won’t be mounted if you went directly from the CD boot to run_qtparted. Click Yes to commit your changes.

A progress window appears, and QtParted displays various messages as it performs the repartioning operations. It took about ten minutes to repartition my 40 GB Acer drive into the four new partitions, but on my HP all operations completed in about a minute. If everything works, QtParted displays “Operations completed successfully.” Click OK, then select File→Quit to exit QtParted.

Enter shutdown -r now to shut down the system. At this point, you might want to reboot to verify that your Windows system is still bootable. Windows should boot fine if you selected an adequate resize partition size based on the final Windows defragmentation map. At boot time, Windows may detect the change in disk partition size and begin to run the chkdsk utility. Let this continue so that Windows can reset its internal information about available disk drives.

After Windows has completed its analysis of the new disk partitions and booted into its normal operating mode, open Explorer and look at the identified drives. You should see the resized boot drive, plus a new drive letter that designates the FAT32 partition you created using QtParted.

PART 2 : Installing Ubuntu Linux











No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips