Difference between revisions of "Dual boot with Windows"

From ArchWiki
Jump to: navigation, search
(Windows and Arch Dual Booting:)
(fix links to specific sections)
(46 intermediate revisions by 27 users not shown)
Line 1: Line 1:
[[Category:Boot process (English)]]
+
[[Category:Boot process]]
[[Category:HOWTOs (English)]]
+
[[Category:Getting and installing Arch]]
 +
[[ru:Windows and Arch Dual Boot]]
 +
[[sk:Windows and Arch Dual Boot]]
 +
This is a simple article detailing different methods of Arch/Windows coexistence.
  
{{i18n_links_start}}
+
== BIOS Systems ==
{{i18n_entry|English|Windows_and_Arch_Dual_Boot}}
+
{{i18n_entry|Русский|Двойная загрузка: Windows и Arch}}
+
{{i18n_links_end}}
+
  
== Windows and Arch Dual Booting: ==
+
=== Using a Linux boot loader ===
  
In this example, we will install Windows first, and subsequently install the GRUB bootloader along with Arch, allowing for dual boot.
+
You may use [[GRUB#Dual-booting|GRUB]] or [[Syslinux#Chainloading|Syslinux]].
  
Installation will be standard, but there are a few things to keep in mind:
+
=== Using Windows boot loader ===
  
1. You will have to use logical partitions for some of our partitions, because there can only be up to 4 primary partitions per disk.
+
Another option is sort of the reverse of what is described at the beginning of this article where GRUB loads the Windows boot loader, which then loads Windows. Under this option, the Windows boot loader load GRUB, which then loads Arch.  
  
2. '''Very Important''': Remember to write down your partitions numbers: "sda1, sda2... sda8", noting which type of partitions belong to their relevant number.  For example:
+
==== Using Windows 7/8 boot loader ====
sda1: Windows (30GB is enough for some games)
+
+
sda2: /boot (100MB is plenty)
+
+
sda3: / (about 10-16GB is good)
+
+
sda4: swap (between 512MB and 1024MB)
+
+
sda5: /home (use rest of hard drive)
+
  
It is important to note that there is a 1024 cylinder limit with some older BIOSs.  This means that the BIOS cannot access things beyond the 1024th cylinder (about 8.5GB), so the /boot partition should be in the first 8.5GB (space before Windows partition).  [http://gparted.sourceforge.net/livecd.php GParted LiveCD] or a partitioning tool in [http://www.sysresccd.org/Main_Page SystemRescueCd] are useful for moving and resizing partitions to accommodate this.
+
The following section contains excerpts from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/.
  
3. When installing grub, you must configure /boot/grub/menu.lst), and make sure to install grub to /boot (or root (/) if you did not create a separate partition for /boot). There should be about three lines at the end of the file that speak about chainloading to boot other OSs, these can most generally be uncommented if you follow above convention, this would place windows boot point at hd0,0 or sda1. Thus you would have something akin to this:
+
The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Windows boot loader must be a primary partition but I have used this without problem on an extended partition.
  
# Windows XP
+
* When installing the GRUB boot loader, install it on your {{ic|/boot}} partition rather than the MBR. {{Note|For instance, my {{ic|/boot}} partition is {{ic|/dev/sda5}}. So I installed GRUB at {{ic|/dev/sda5}} instead of {{ic|/dev/sda}}. For help on doing this, see [[GRUB#Install to partition or partitionless disk]]}}
title Windows XP
+
rootnoverify (hd0,0)
+
chainloader +1
+
  
The parts of this entry break down as follows:
+
* Under Linux make a copy of the boot info by typing the following at the command shell:
  
'''''title Windows XP''''' <<--Can be anything you like, it will just be what is displayed in the grub bootup screen
+
my_windows_part=/dev/sda3
 +
my_boot_part=/dev/sda5
 +
mkdir /media/win
 +
mount $my_windows_part /media/win
 +
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
  
'''''rootnoverify (hd0,0)''''' <<--Remember the partition numbers we wrote down, here you write in the partition number of your windows partition.  This sets the windows boot at root, even though GRUB cannot read it.
+
* Boot to Windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to {{ic|C:\}}. Now run '''cmd''' with administrator privileges (navigate to ''Start > All Programs > Accessories'', right-click on ''Command Prompt'' and select ''Run as administrator''):
  
'''''chainloader +1''''' <<-- What this does is call the Windows boot loader that is still in MBR in our case, since GRUB cannot boot Windows itself.
+
bcdedit /create /d “Linux” /application BOOTSECTOR
  
'''REMEMBER:''' The file is read from the top down, so the system listed first will be the one to auto boot, if no keys are pressed during the grub boot screen.
+
* BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}.  
  
'''NOTE:'''GRUB uses a zero indexed system of numbering drives and partitions, which is a different convention than you may be used to seeing:
+
  bcdedit /set {ID} device partition=c:
  First disk, first partition = sda1 = hd0,0
+
  bcdedit /set {ID}  path \linux.bin
  First disk, second partition = sda2 = hd0,1
+
  bcdedit /displayorder {ID} /addlast
  Second disk, first partition = sdb1 =hd1,0
+
bcdedit /timeout 30
  
==Dual Booting from Multiple Hard Drives==
+
Reboot and enjoy. In my case I'm using the Windows boot loader so that I can map my Dell Precision M4500's second power button to boot Linux instead of Windows.
To dual boot from two separate hard drives (e.g. one dedicated Linux drive and one dedicated Windows drive) and Windows is not on the first hard drive, the Windows boot loader must be "tricked" into thinking Windows is on the first hard drive.  Do this by adding the following lines to your menu.lst config file:
+
  
map (hd0) (hd1)
+
==== Using Windows 2000/XP boot loader ====
map (hd1) (hd0)
+
  
So the entry for Windows on second disk, first partition will look like this:
+
For information on this method see http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html. I do not believe there are any distinct advantages of this method over the Linux boot loader; you will still need a {{ic|/boot}} partition, and this one is arguably more difficult to set up.
  
title Microsoft Windows XP Professional
+
== UEFI Systems ==
root (hd1,0)
+
savedefault
+
makeactive
+
map (hd0) (hd1)
+
map (hd1) (hd0)
+
chainloader +1
+
  
More information on GRUB configuration can be found in [http://www.gnu.org/software/grub/manual/grub.html the GRUB manual].
+
Both [[Gummiboot]] and [[UEFI_Bootloaders#Using_rEFInd|rEFInd]] autodetect '''Windows Boot Manager''' {{ic|\EFI\Microsoft\Boot\bootmgfw.efi}} and show it in their boot menu, so there is no manual config required.
  
==Other Layouts ==
+
For [[GRUB]](2) follow [[GRUB#With_Windows_Installed_in_UEFI-GPT_Mode]].
1. Actually you could just use:
+
sda1 <-WinXP
+
+
sda2 <-swap
+
+
sda3 <-/ (Arch)
+
+
sda4 <-/home (optional)
+
  
and not use an extended(logical) partition (as /boot will be in the /root portion as well).
+
Syslinux (as of version 6.01) and ELILO do not support chainloading other EFI applications, so they cannot be used to chainload {{ic|\EFI\Microsoft\Boot\bootmgfw.efi}} .
  
2. LVM (Linux Volume Management) is also a possibility to use, it works fine with arch, you could simply create a single LVM partition and let it create the other partitions inside it.  This allows a single partition to hold all your needed GNU/Linux stuff, also allows you to easily resize any of them if it becomes necessary.
+
== See also ==
  
==Notes on /home ==
+
[https://bbs.archlinux.org/viewtopic.php?id=140049 Booting Windows from a desktop shortcut]
You may wish to not store you documents in this mountpoint, especially if you wish to share data between both Windows and Arch Linux.  Traditionally this was done in a FAT partition because writing to NTFS was still experimental.  [http://www.ntfs-3g.org/ NTFS-3G] now offers stable writing to NTFS partitions, so you can just leave this as another partition that will be shared by both Windows and arch. Another option would be to use some of the tools in Windows, such as [http://www.fs-driver.org/ fs-driver] and use an ext3 or ext2 partition to store documents (fs-driver will mount ext3 partitions as ext2, so you will not be able to take advantage of journaling while in Windows).
+
 
+
==Other Options ==
+
Another option is sort of the reverse of what is described at the beginning of this article where GRUB loads the Windows boot loader, which then loads Windows.  Under this option, the Windows boot loader load GRUB, which then loads arch.  For information on this method see http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html.  I do not believe there are any distinct advantages of this method over the previous one, you will still need a /boot partition, and this one is arguably more difficult to setup.
+

Revision as of 07:24, 21 November 2013

This is a simple article detailing different methods of Arch/Windows coexistence.

BIOS Systems

Using a Linux boot loader

You may use GRUB or Syslinux.

Using Windows boot loader

Another option is sort of the reverse of what is described at the beginning of this article where GRUB loads the Windows boot loader, which then loads Windows. Under this option, the Windows boot loader load GRUB, which then loads Arch.

Using Windows 7/8 boot loader

The following section contains excerpts from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/.

The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Windows boot loader must be a primary partition but I have used this without problem on an extended partition.

  • When installing the GRUB boot loader, install it on your /boot partition rather than the MBR.
    Note: For instance, my /boot partition is /dev/sda5. So I installed GRUB at /dev/sda5 instead of /dev/sda. For help on doing this, see GRUB#Install to partition or partitionless disk
  • Under Linux make a copy of the boot info by typing the following at the command shell:
my_windows_part=/dev/sda3
my_boot_part=/dev/sda5
mkdir /media/win
mount $my_windows_part /media/win
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
  • Boot to Windows and open up and you should be able to see the FAT32 partition. Copy the linux.bin file to C:\. Now run cmd with administrator privileges (navigate to Start > All Programs > Accessories, right-click on Command Prompt and select Run as administrator):
bcdedit /create /d “Linux” /application BOOTSECTOR
  • BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}.
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \linux.bin
bcdedit /displayorder {ID} /addlast
bcdedit /timeout 30

Reboot and enjoy. In my case I'm using the Windows boot loader so that I can map my Dell Precision M4500's second power button to boot Linux instead of Windows.

Using Windows 2000/XP boot loader

For information on this method see http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html. I do not believe there are any distinct advantages of this method over the Linux boot loader; you will still need a /boot partition, and this one is arguably more difficult to set up.

UEFI Systems

Both Gummiboot and rEFInd autodetect Windows Boot Manager \EFI\Microsoft\Boot\bootmgfw.efi and show it in their boot menu, so there is no manual config required.

For GRUB(2) follow GRUB#With_Windows_Installed_in_UEFI-GPT_Mode.

Syslinux (as of version 6.01) and ELILO do not support chainloading other EFI applications, so they cannot be used to chainload \EFI\Microsoft\Boot\bootmgfw.efi .

See also

Booting Windows from a desktop shortcut