Monday, May 13, 2013

Dual Boot Linux Mint + Windows 7


Case :: linux mint installed peacefully but something urgent makes you need to install windows 7 later

Prerequisite:
  • linux mint distro dvd 
  • windows 7 installation dvd
  • make sure your hard disk primary partition only takes at most 3 partitions
        notes:
  • msdos partition table only support 4 primary partition. so save 1 primary partition for windows
  • what if i used all the primary partition? okay, prepare yourself to loss one of the partition. next line will be an obligation
  • backup your data
        backup your home, backup your package using aptoncd, just in case there is a disaster

Steps
1. make more space for windows (resize partition)
  • insert linux mint dvd to tray, boot from DVD and open GParted
  • choose one partition that is large enough for your windows NTFS (at least 15 GB)
  • next we will resize it
 
        notes:
  • for safety measure resize the partition from the end (the white area). the beginning part may contain your data (the yellow area)
2. installing windows
  • insert windows dvd to tray, boot from DVD and install windows
  • choose the unallocated space
 
  • install & wait until it's finished 
  • now you will automatically boot to windows and your grub gone somewhere. 
3. reclaim the boot flag
  • reboot, insert linux mint dvd to tray again and open GParted
      
as you can see windows will grab the boot flag so we have to give it back to grub. we'll continue to the next step
    
4. reinstall & update grub


     now it's time to call the terminal
  • mount the linux mint partition
      $ sudo mount /dev/sda6 /mnt
  • mount some directories that are needed
      $ sudo mount --bind /dev /mnt/dev
      $ sudo mount --bind /sys /mnt/sys
      $ sudo mount --bind /proc /mnt/proc
  • mount boot partition (only if it's located in separate partition)
      $ sudo mount /dev/sda1 /mnt/boot
  • chroot to mount point
      $ sudo chroot /mnt
  • install grub to hard disk (not the partition)
      $ sudo grub-install /dev/sda
  • update grub to detect all bootable OS and option
      $ sudo update-grub
  • finishing... exit /mnt and unmount them
      $ exit
      $ sudo umount /mnt/dev
      $ sudo umount /mnt/sys
      $ sudo umount /mnt/proc
      $ sudo umount /mnt/boot
      $ sudo umount /mnt/

5. reboot again

      $ sudo reboot  

6. let's wait and pray...
    thank God it's back :D


tried this in detail (including screenshots) using virtualbox. hope it's not much different from the real thing

Reference:
update-grub from live-cd

0 comments:

Post a Comment