Dual boot: Windows 7 and CentOS 7 - Tutorial

Updated: November 3, 2014

Here's another very important article. You know I love CentOS, and with the latest version out there, plus some honest desktop pimping, the emotion is even more powerful. So let's notch it up. How about dual-booting, Windows and CentOS, both versions 7?

Indeed, today, I will expand on my recent exploration of CentOS and show you how to install this operating system in a side-by-side configuration with Windows. The nice part is, the basic concept remains true for all versions of Windows, so if you're running later editions, then this tutorial is also good for you. Follow me.



The test machine is an aging Lenovo T400 laptop, with 4GB RAM and 80GB SSD, which I have used several times in the past. But not that often, because it's N-band Wireless card does not work well in Linux. Literally, no distro likes it. Not a single one. Nope. Even when I tested Xubuntu, and later showed you how to dual-boot it, I disclaimed my findings.

Likewise, here, we are going to be having tons of problems with the Wireless card. The driver will spectacularly fail every few minutes, and we will have to reset the network stack to reconnect and keep working. True for Ubuntu, Mint, CentOS, Fedora, and every single distro out there.

However, this should not concern you. The installation can be performed in an offline mode if you will, especially the tricky parts of configuring the partitions and the bootloader. The post-install use is another matter, but provided you selected a machine that works well in Linux, you will be absolutely fine. So please, IGNORE the Wireless woes, they are totally unrelated, and focus on the mechanics of dual booting.

Finally, this guide complements the whole series of multi-boot articles that I have been making recently, which cover Ubuntu, Xubuntu, Windows 7, and Windows 8, including some tricky setups like UEFI, Secure Boot and other nifty concepts. More goodness in a jiffy.

Preliminary reading

Here's some mandatory homework. Unless you can complete all of the steps below, you should not try to follow this article and expect good results. It might work, but I warmly recommend you become well familiar and confident with separate installations and the use of some more mainstream distributions before trying your luck with CentOS. It's not that much more difficult, but it is different, ever so slightly more advanced, and most importantly, not designed with newbies in mind.

How to install Windows 7 - If you are performing your own installation setup rather than using a preinstalled host, then you will want to invest time in checking this tutorial. It highlights the important steps in how to prepare your hard disks, so that your Windows installations are flexible and friendly for dual booting.

How to install Ubuntu - This is a very detailed guide on how to install Trusty. It's different from CentOS, but it is important because it covers the Linux installation fundamentals. Once again, it comes with numerous examples on dual and multi-booting, so it should be extremely valuable to you.

How to setup Ubuntu & Windows 7 side by side - This guide has originally been written for a much older version of Ubuntu, Karmic Koala in fact. Does it matter? No. The stuff in the guide remains 100% relevant and accurate. So please take a look.

How to setup Ubuntu & Windows 8 side by side - This guide tells you all about configuring Windows 8 and Linux in a dual-boot configuration. The clever part is that the procedure is done on a preinstalled, touch-enabled Ultrabook, which comes with a rather complex GPT partition scheme including hidden and recovery partitions, UEFI and Secure Boot.

I would also suggest you explore my RedHat family articles and howtos. They include CentOS, Scientific Linux and Fedora, and they cover many useful steps, including repo configuration, new software installation, drivers setup, and more. You will find more links at the end of this guide. Scroll down if you can't wait, then scroll back up. Or something.

Lastly, you might also like my openSUSE installation guide. While every distribution offers the same repertoire in a different way, SUSE is conceptually very similar to CentOS, and you will definitely benefit from the extra explanations and examples.

Step 1: Windows 7 setup

Much like we did with Xubuntu, if you have Windows preinstalled, you don't need to do anything here. If you don't, then install the operating system, following the nice tips I've laid out earlier. This will make you a happy user, and your disk management will be so much simpler.

In our example, Windows is preinstalled, so to speak, even though it was installed a few years back by your significant author here, with a smart disk layout created in advance. Reaping the benefits of early preparations. Last but not the least, backup your personal data, so you avoid any unnecessary complications that may arise!


Step 2: Boot into CentOS live session

Like almost every other Linux distribution out there, CentOS offers a live CD version, so you can boot and test before deciding whether you want to commit the changes. I have chosen the KDE version, which is much prettier and more sensible than the Gnome framework.

Live desktop

On this T400 machine, the 5GHz Wireless network did not work for some reason. CentOS did not have problems connecting to the 2.4GHz access points, though. Things were working fine, and the network throughput was good until the expected oops.

Network devices

[ ] ------------[ cut here ]------------
[ ] WARNING: at drivers/net/wireless/iwlwifi/pcie/trans.c:862
    iwl_trans_pcie_grab_nic_access+0xd3/0xe0 [iwlwifi]()
[ ] Timeout waiting for hardware access (CSR_GP_CNTRL 0x080003d8)
[ ] Modules linked in: ip6t_rpfilter ip6t_REJECT ipt_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw iptable_filter ip_tables rfcomm bnep sg arc4 iwldvm mac80211 coretemp kvm_intel iTCO_wdt iTCO_vendor_support kvm snd_hda_codec_conexant snd_hda_codec_generic snd_hda_intel iwlwifi snd_hda_codec cfg80211 snd_hwdep snd_seq btusb i2c_i801 pcspkr serio_raw uvcvideo bluetooth snd_seq_device videobuf2_vmalloc yenta_socket videobuf2_memops snd_pcm videobuf2_core videodev lpc_ich mfd_core snd_page_alloc thinkpad_acpi
[ ]  snd_timer mei_me shpchp mei snd rfkill soundcore acpi_cpufreq mperf nfsd auth_rpcgss nfs_acl lockd uinput ext4 mbcache jbd2 dm_snapshot dm_bufio vfat fat squashfs sd_mod crct10dif_generic sr_mod crc_t10dif cdrom crct10dif_common usb_storage i915 e1000e firewire_ohci ahci libahci i2c_algo_bit libata drm_kms_helper firewire_core drm crc_itu_t ptp pps_core i2c_core wmi video sunrpc dm_mirror dm_region_hash dm_log dm_mod loop
[ ] CPU: 0 PID: 390 Comm: kworker/u8:3 Not tainted
    3.10.0-123.el7.x86_64 #1
[ ] Hardware name: LENOVO 6475RE4/6475RE4,
    BIOS 7UET92WW (3.22 ) 03/11/2011
[ ] Workqueue: iwlwifi iwl_bg_restart [iwldvm]
[ ] ffff88007f141c60 000000006ebffff7
    ffff88007f141c18 ffffffff815e19ba
[ ] ffff88007f141c50 ffffffff8105dee1
    ffff8800ace20000 ffff8800ace23258
[ ] ffff88007f141cf8 0000000000000000
    0000000000001d00 ffff88007f141cb8
[ ] Call Trace:
[ ] [<>] dump_stack+0x19/0x1b
[ ] [<>] warn_slowpath_common+0x61/0x80
[ ] [<>] warn_slowpath_fmt+0x5c/0x80
[ ] [<>] iwl_trans_pcie_grab_nic_access+0xd3/0xe0 [iwlwifi]
[ ] [<>] iwl_write_prph+0x39/0x80 [iwlwifi]
[ ] [<>] iwl_pcie_tx_stop+0x4a/0x140 [iwlwifi]
[ ] [<>] iwl_trans_pcie_stop_device+0x90/0x190 [iwlwifi]
[ ] [<>] iwl_down+0x202/0x300 [iwldvm]
[ ] [<>] iwlagn_prepare_restart+0x4f/0xd0 [iwldvm]
[ ] [<>] iwl_bg_restart+0x47/0xb0 [iwldvm]
[ ] [<>] process_one_work+0x17b/0x460
[ ] [<>] worker_thread+0x11b/0x400
[ ] [<>] ? rescuer_thread+0x400/0x400
[ ] [<>] kthread+0xcf/0xe0
[ ] [<>] ? kthread_create_on_node+0x140/0x140
[ ] [<>] ret_from_fork+0x7c/0xb0
[ ] [<>] ? kthread_create_on_node+0x140/0x140
[ ] ---[ end trace aade12897cb53861 ]---

However, all other hardware was properly detected and initialized, and there were no other related issues. Again, I know how alarming this sounds, but it's not going to affect our installation in any way whatsoever. It should also give you some solace slash confidence that you can actually work and work around problems even when seemingly huge and tricky issues arise.

Step 3: Disk management

I ought to show you the whole installation process, because I have not done that with CentOS ever since my ancient review of the 5.X family. However, the idea is virtually identical to what we've encountered in my rather happy Fedora 18 review. We will redo some of that here, sans the Level 9,000 anger.

The first two steps are as follows: Choose your language. Then, take a look at the summary window. It will highlight steps that need completion before you can move on to the next stage. In this case, the tricky part is called Installation Destination. What it actually means is that you will need to prepare your disks, mark your partitions and configure the bootloader.

Language selection

First summary

Step 4: Manage disks & partitions

In the next window, there's a bunch of data you need to digest. At the top, a badly colored title. Then, a button labeled Done, which we will click the last. Go figure. Then, the list of your local disks, where you want to install CentOS. Most people will have a single hard disk. If you're not sure, then you can use labels and sizes to try to distinguish between them. There's no simple way to tell apart disks of the same vendor and same size. If that happens, you will want to mark them all and check their content later on.

The third section, named, Other Storage Options is the most critical one. We will not opt for the automatic partitioning, because it could be destructive. Instead, we will configure partitions manually. Mark the relevant radio button. Encryption is not important at this point. At the bottom, the blue hyperlink will take you to the bootloader setup. You can do that right now, but your choice will be reset if you change the device selection and choose some of the partitions.

Therefore, you should mark the right disks, click Done, manually partition, come back to this window, review the bootloader selection, and finally hit the Done button again. This is meant to be some kind of a star-logic non-linear installation flow, and it's quite confusing. Pay attention.

Device selection

Manual partitioning

The next window is also quite confusing. The list of existing partitions are shown on the left side in a column. The installer lists the following: CentOS 7, a new installation which has not yet been configured, an Unknown Linux and another, Unknown operating system. These are actually Xubuntu Trusty and Windows 7 from the previous dual-boot experiment. The idea is that as you mark partitions, they will "shift up" into the CentOS entry until you have your recommended separate root (/), /home and swap.

Manual partitioning

Expand the Unknown Linux and Unknown options. It slowly starts to make some sense. We have a 100MB NTFS partition. This is the Windows 7 Ultimate System Reserved partition. We also have a larger 55GB NTFS partition that correspond to the C:\ drive. Likewise, we have three Linux partitions.

Mark /dev/sda5 to be the root of our new installation. It's served that purpose with Xubuntu, so we will format it, mark the mount point as root (/) and update the settings. Don't move back to the column until you've pressed that button, or your changes will not be preserved.

Partitions list expanded

Root configured

Repeat the same exercise with the /home partition. Check the list on the left side. Your new CentOS 7.0 installation should have three entries underneath the title, the 10GB root, the 2GB swap and the 9GB home directory.

Home configured

After you've completed this, click Done. This will take you back to the previous menu, where we will now make sure the bootloader has been marked for installation and properly configured to the MBR of the one and only disk we have. If you're struggling with the concepts here, read my GRUB and GRUB2 guides please. A must, if you will.

You will be asked to confirm changes, most notably the formatting of the /dev/sda5 partition. Nothing destructive will happen at this point, but you still need to approve the popup prompt. After this, you will go back to the Installation Destination stage.

Confirm changes

Bootloader setup

We're okay here. The /dev/sda (just sda in that list) has been marked correctly as the boot device. You do not need to make any additional changes and adjustments. Hint, if you have a multi-boot system with additional Linux distros there, and you want one of them to control the boot sequence, then you will remove CentOS from the selection. We saw this during the first test of CentOS 7 on my quad-boot test laptop some time back.

Bootloader setup

Now, after you confirm this and click Done again in the top left corner, you will go back to the Installation Summary stage. There probably won't be any other steps left to setup, so you can begin the installation. Proceed with care and confidence.

Final summary

Complete installation

While the distro installs, you will have the option to configure the root password and your own user. After the first reboot, there will be another, short post-install configuration, where you will need to accept the license agreement and configure the Kdump mechanism.

Create users

Users created, installing

Installation complete

Step 5: Reboot, no Windows!

This is perfectly normal, do not be alarmed. But you will NOT see Windows 7 in the GRUB2 menu the first time you reboot CentOS 7. The reason why it has not been added yet is because CentOS does not have the drivers needed to detect NTFS partitions and thus add them to the GRUB2 menu list during the OS probe step. We will manually rectify this, and it is indeed an important step in this dual-boot guide.


There are two ways you can resolve the issue. One, you can add a manual chainload entry to the 40_custom GRUB script under /etc/grub.d, and then update the GRUB2 menu using the following command:

grub2-mkconfig -o /boot/grub2/grub.cfg

The content you actually need to add to the 40_custom script BEFORE you update the menu is as follows:

menuentry "Windows 7" {
   set root='(hd0,1)'
   chainloader +1

Do pay attention to the disk and partition number. And remember that GRUB2 enumerates disks starting with zero, but partitions starting with 1. Therefore, if you have Windows installed on the first partition of your first disk, you will use (hd0,1) and not (hd0,0) like you would back in the GRUB legacy days.

This option will work well. It's quite useful in that you do not need to install any third-party software, in other words, you will not configure any third-party repos. The second way of achieving the desired GRUB2 result is to install NTFS utilities, a set of three small programs that are not available in the official repo channels.

You can check whether you can access the Windows 7 partitions by trying to open them in Dolphin. You will probably get an error. This means that CentOS cannot mount the partitions and therefore, it cannot probe them and check what's there.

An error occurred while accessing '53.6 GiB Hard Drive', the system responded: The requested operation has failed: Error mounting /dev/sda2 at /run/media/roger/B6F00E61F00E27E7: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda2" "/run/media/roger/B6F00E61F00E27E7"' exited with non-zero exit status 32: mount: unknown filesystem type 'ntfs'

So we need third-party content. We will do the same thing we did in the CentOS 7 perfect desktop guide. Configure a bunch of third party repos. You can use Nux and EPEL, you can use RPMForge, you can use any of the popular third-party sources for CentOS. The basic idea is the same. Then, install:

yum search ntfs


======= N/S matched: ntfs =======
findntfs.x86_64 : Find NTFS partitions
fuse-ntfs-3g.x86_64 : Linux NTFS userspace driver
fuse-ntfs-3g-devel.x86_64 : Header files, libraries and development documentation for fuse-ntfs-3g
ntfsprogs.x86_64 : NTFS filesystem libraries and utilities

We will install these, using yum install <package name>. Then, we can run the necessary GRUB2 update. And for the fun of it, examine the Windows 7 partition using the file manager. Yup, it works.

grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.8.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.8.1.el7.x86_64.img
Found Windows 7 (loader) on /dev/sda1

Windows partition mounted

Post customization

At this point, you can configure additional content for your CentOS installation. But it really comes to your needs, taste and preference. You might want to configure the graphical drivers and other neat stuff. But we will just reboot into Windows 7.

Final setup

Step 6: Boot into Windows

Now, everything works fine. The GRUB menu entry is there, and we can boot into the Microsoft operating system. Let's briefly check the disk management utility and see what gives there. Yup, three partitions of an unknown type, all is well. So yes, we're done. We have a fully functional dual-boot system with Windows 7 and CentOS 7. Congratulations.


More reading

Some awesome material your body and soul:

The ultimate Scientific Linux pimping guide

The essential Fedora pimping guide

How to make CentOS 6 into a perfect desktop

CentOS 6 pimping guides - parts two and three

CentOS 6 in my production setup

CentOS 6 & SSD stuff 

CentOS 7 printing guide


There, it wasn't so difficult. Different, yes. CentOS did present us with a few obstacles. One, the non-linear installer is quite tricky. Two, we needed to sort out the bootloader after the installation. And finally, the laptop itself had its hardware woes, but these are not strictly related to CentOS. Still, we managed just fine.

Now you have learned how to work with what is essentially an enterprise-quality Linux distribution in a home setup. Much like we did with the noob-friendly Ubuntu family. On top of all that, we also have beauty and functionality and all the third-party stuff normal people need for everyday use. Really cool. I hope you liked this guide.

P.S. If you truly find this article useful, please consider supporting Dedoimedo.


You may also like: