Monthly Archives: September 2015

dual boot fedora 19 or 20 or 21 and windows 7 cleanly

I use Linux a lot and I like it very much. However I just cannot get rid of windows completely because certain applications only run under windows perfectly and natively, such as Microsoft PowerPoint and some games. I don’t want to talk about wine or crossover here, and that should be another post.

It is fairly easy to dual boot any Linux systems (Ubuntu, Fedora, etc.) and Windows. There are tons of resources online. However, I want to make a dual boot installation of Fedora and Windows CLEANLY!

By “cleanly”, I mean:
1. Fedora’s bootloader should not overwirte the Master Boot Record (MBR)
2. Let Windows’s bootloader to boot Fedora
3. You can delete Linux partition inside your windows system without causing any issues of existing Windows

Why do I need this “cleanly”?
Many laptops pre-installed Windows often have a recovery disk partition which you can use to reset your laptop to factory settings. It may be called “one key recovery”. Yes, literally, hitting one key during the system rebooting and that’s it. If Fedora installation overwrites MBR, the “one key recovery” will not work any more. I don’t want to loss this magic.

Fedora used to have an option to let user choose where to install the bootloader during the installation. However, this option is gone for some reason. (Can any one tell me why?)

I searched, searched, and finally found several useful links which are in the end of this post. I summarized how to make it in the following.
(The following commands have been tested on Fedora 19, 20, 21)

1. Assuming you have a laptop installed Windows, you need to make some unused space by either disk management tool coming with windows or other external tools.

2. Use liveusb-creator-3.12.0 to create Fedora image with usb

3. insert usb and boot from usb
You can do whatever to partition your fedora disk but you must have a stand alone /boot partition. When installing, you should NOT choose installing bootloader. Pay attention to the size of /boot partition because you may need to find this partition by its size later.

4. After the installation is finished, boot from usb device again.

5. change to root user


6. find which partition is /boot, normally it should be 500MB or whatever you set when installing fedora

fdisk -l

in my case, it’s /dev/sda6

7. check logical partition if you have, show logic partitaion, find “lv parth”


in my case /dev/fedora/root and /dev/fedora/home

8. make a directory to work in:

mkdir /mnt/sysimage

9. mount your filesystems (device nodes are examples, be sure to fill in your own!):

mount /dev/fedora/root /mnt/sysimage
mount /dev/fedora/home /mnt/sysimage/home
mount /dev/sda6 /mnt/sysimage/boot

10. bind mount your system filesystems:

mount --bind /dev /mnt/sysimage/dev
mount --bind /proc /mnt/sysimage/proc
mount --bind /sys /mnt/sysimage/sys

11. chroot

chroot /mnt/sysimage/

12. install bootloader

grub2-install --recheck --force /dev/sda6
grub2-mkconfig -o /boot/grub2/grub.cfg

13. reboot

After all these, you are almost done. You probably see your laptop goes directly into Windows. That’s fine.
The final step is to create an entry in Windows boot menu.

The tool I used is EasyBCD.

choose “Add New Entry”
choose tab “Linux/BSD”
choose type “grub 2”
enter name “Fedora or whatever”
drive: linux 500MB
hit add entry
hit save settings

root windows and you will find a entry for Fedora.

However, you will only see booting in text mode. If you want the fancy animation, you need to edit file /etc/default/grub. (create a new file if it doesn’t exist)

Add the grub options to it (the example file after installing FC 19, FC 20, FC21 with bootloader are shown in the following).
Redo grub2-mkconfig -o /boot/grub2/grub.cfg

Example /etc/default/grub file

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX=" rhgb quiet"

FC 20:

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX=" vconsole.font=latarcyrheb-sun16 $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rhgb quiet"


GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX=" vconsole.keymap=us $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rd.luks=0 vconsole.font=latarcyrheb-sun16 rhgb quiet"

A complete list of command lines in my case:

sudo mkdir /mnt/sysimage
sudo mount /dev/fedora/root /mnt/sysimage
sudo mount /dev/fedora/home /mnt/sysimage/home
sudo fdisk -l (to get the list of partition to find where is /boot, in my case /dev/sda6)
sudo mount /dev/sda6 /mnt/sysimage/boot
sudo mount --bind /dev /mnt/sysimage/dev
sudo mount --bind /proc /mnt/sysimage/proc
sudo mount --bind /sys /mnt/sysimage/sys
sudo chroot /mnt/sysimage
grub2-install --recheck --force /dev/sda6
grub2-mkconfig -o /boot/grub2/grub.cfg