10.13.2010

Dual-boot of Windows with Linux on Sony VAIO typeS

Abstraction of the method; closed/opened squares mean used/free blocks on the disk space.
This post describes how to install Linux into Windows PC without removing or reinstalling the existing Windows.



Please use this information at your own risk.
This method may break your system or important data.




Environment of My Case
  • Sony VAIO typeS (VGN-S94PS)
    • OS: Windows XP Professional
    • CPU: PentiumM 2 GHz
    • RAM: 1GB
    • HDD: 60GB
      • Recovery partition: for recoverying Windows
      • System partition: for system and user data
  • Additional OS: Ubuntu


Method 
  1. Download ISO image of Ubuntu from its web site and burn it onto an optical disk. (Of course you can use other bootable devices.)
    http://www.ubuntu.com/desktop/get-ubuntu/download
  2. Defrag the system partition to protect the Windows data from following repartitioning. I'm not sure, however, this method is enough to protect your data. I strongly recommend you to copy your whole data for backup.
  3. Boot Ubuntu from the optical disk onto which you burn its ISO image.
  4. Repartition the system partition with gparted which the ISO image contains. You have to ensure an enough sized partition for Windows because this operation may drop necessary data.
    Format the data partition as fat32 because both of Windows XP and Ubuntu can use the format.
    /dev/sda1 ntfs recovery partition (by default)
    /dev/sda2 ntfs for Windows XP
    /dev/sda5 ext3 /
    /dev/sda6 ext3 swap
    /dev/sda4 fat32 data partition for Windows and Ubuntu
    
    /dev/sda1 was not touched. /dev/sda2 was shrinked to make space for /dev/sda4, /dev/sda5 and /dev/sda6. /dev/sda5 and /dev/sda6 are for Ubuntu, and /dev/sda4 is for user data which both of Windows and Ubuntu access.
  5. Mount the data partition and write out a bootsector image there.
    $ sudo mkdir /winD
    $ sudo mount -t vfat /dev/sda4 /winD
    $ sudo dd if=/dev/sda5 of=/winD/bootsector.img bs=512 count=1
    
    I gave the mount point the name of /winD because Windows treats the partition as D-drive.
  6. Remove the optical disk (or other boot devices) and reboot.
  7. Move bootsector.img from D-drive to root of C-drive (C:\bootsector.img).
  8. Modify C:\boot.ini as below.
    [boot loader]
    timeout=30
    default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
    C:\bootsector.img="Ubuntu"
    
  9. Reboot to confirm that you can select OS.
    If you can not find the display to select OS, you may fail to modify boot.ini. Check the file. Or, if Ubuntu does not boot after you select it, you may fail to create or move bootsector.img. Check the file or recreate it. (You need the optical disk or bootable devices again.)

0 件のコメント:

コメントを投稿