Difference between revisions of "Dual boot with Windows"

From ArchWiki
Jump to: navigation, search
(Notes on /home: shorter, more concise and replaced fs-driver with Ext2Fsd because fs-driver is outdated. Nobody uses ext3 anymore)
(use https for links to archlinux.org)
(5 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
This is a simple article detailing different methods of Arch/Windows coexistence.
 
This is a simple article detailing different methods of Arch/Windows coexistence.
  
 +
{{Out of date|GRUB Legacy support has been dropped from Arch Linux:<br> https://www.archlinux.org/news/grub-legacy-no-longer-supported/}}
 
==Windows and Arch Dual Booting==
 
==Windows and Arch Dual Booting==
 
In this example, we will install Windows first, and subsequently install the GRUB bootloader along with Arch, allowing for dual boot.
 
In this example, we will install Windows first, and subsequently install the GRUB bootloader along with Arch, allowing for dual boot.
Line 13: Line 14:
 
2. Remember to write down your partitions numbers: "sda1, sda2... sda8", noting which type of partitions belong to their relevant number. For example:
 
2. Remember to write down your partitions numbers: "sda1, sda2... sda8", noting which type of partitions belong to their relevant number. For example:
  
:; sda1 : Windows - 30GB should be enough. Many new games exceed 10GB each so bear this in mind.
+
:; sda1 : {{ic|Windows}} - 30 GB should be enough. Many new games exceed 10GB each so bear this in mind.
 
   
 
   
:; sda2 : {{ic|/boot}} - 100MB is enough (optional)
+
:; sda2 : {{ic|/boot}} - 100 MB is enough '''(optional)'''
 
   
 
   
:; sda3 : {{ic|/}} - about 25GB is appropriate
+
:; sda3 : {{ic|/}} - 10 GB should be enough. If you're planning on using KDE or installing a bunch of games, you may wish to allocate more; perhaps 15 GB.
 
   
 
   
:; sda4: swap - between 1024MB and 4096MB (optional)
+
:; sda4: {{ic|swap}} - between 1024 MB and 4096 MB '''(optional)'''. With 2 GB+ RAM you may even wish to skip it entirely. If you're only using swap for hibernation, you can also use a [https://wiki.archlinux.org/index.php/Swap#Swap_file swapfile], which will free up one of those 4 primary partitions.
 
   
 
   
:; sda5: {{ic|/home}} - use rest of hard drive (optional)
+
:; sda5: {{ic|/home}} - rest of the drive '''(optional)'''
  
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 {{ic|/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.
+
{{Note|Older motherboards have a 1024 cylinder limit. This means that the BIOS cannot access things beyond the 1024th cylinder (about 8.5 GB), so the {{ic|/boot}} partition should be in the first 8.5 GB (most likely before the Windows partition). [http://gparted.sourceforge.net/livecd.php GParted Live], [http://partedmagic.com Parted Magic] or [http://www.sysresccd.org/Main_Page SystemRescueCd] are useful for moving and resizing partitions to accommodate this.}}
  
 
3. When installing GRUB, you must configure {{ic|/boot/grub/menu.lst}}), and '''make sure to install GRUB to {{ic|/boot}} (or root ({{ic|/}}) if you did not create a separate partition for {{ic|/boot}})'''. ''Installing GRUB onto your Windows partition may cause Windows not to 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:
 
3. When installing GRUB, you must configure {{ic|/boot/grub/menu.lst}}), and '''make sure to install GRUB to {{ic|/boot}} (or root ({{ic|/}}) if you did not create a separate partition for {{ic|/boot}})'''. ''Installing GRUB onto your Windows partition may cause Windows not to 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:
{{Note|The above instruction is conflict with the GRUB installation position documented in [[GRUB#General notes about bootloader installation]] which says GRUB should be installed to MBR or the first partition to be recognized by most BIOS.}}
+
{{Note|The above instruction is in conflict with the GRUB installation position documented in [[GRUB#General notes about bootloader installation]] which says GRUB should be installed to MBR or the first partition to be recognized by most BIOS.}}
 
{{Note|It is also possible to install GRUB to MBR ({{ic|/dev/sda}}). This works fine with Windows 7.}}
 
{{Note|It is also possible to install GRUB to MBR ({{ic|/dev/sda}}). This works fine with Windows 7.}}
 
  # Windows XP
 
  # Windows XP
Line 63: Line 64:
 
  (2) Windows
 
  (2) Windows
 
  title Seven
 
  title Seven
  rootnoverify (hd1,0)
+
  rootnoverify (hd0,0)
 
  makeactive
 
  makeactive
 
  chainloader +1
 
  chainloader +1
Line 125: Line 126:
 
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.  
 
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 Boot-Loader===
+
===Using Windows 7/8 Boot-Loader===
 
Excerpted from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
 
Excerpted from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
  
This assumes you have already resized your Win partition, created Linux partitions, and installed linux. Some documents state that the partition being loaded by the Win boot-loader must be a primary partition but I have used this without problem on an extended partition.
+
In order to have the Windows boot-loader see the linux partition, one of the linux partitions created needs to be FAT32 (in this case, /dev/sda3). The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Win boot-loader must be a primary partition but I have used this without problem on an extended partition.
  
*When installing the grub bootloader, 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'''}}
+
*When installing the grub bootloader, 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''' <br>  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:
 
*Under linux make a copy of the boot info by typing the following at the command shell:
Line 140: Line 141:
 
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
 
dd if=$my_boot_part of=/media/win/linux.bin bs=512 count=1
 
</pre>
 
</pre>
*Boot to windows and run '''cmd''' with administrator privileges (navigate to Start->All Programs->Accessories, Right-click on Command Prompt and select “Run as administrator.”)
+
*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.”)
 
<pre>
 
<pre>
 
bcdedit /create /d “Linux” /application BOOTSECTOR
 
bcdedit /create /d “Linux” /application BOOTSECTOR
Line 152: Line 153:
 
</pre>
 
</pre>
  
Done! Reboot and enjoy. In my case I'm using the Win bootloader so that I can map my Dell Precision M4500's second power button to boot linux instead of windows.  
+
Done! Reboot and enjoy. In my case I'm using the Win bootloader so that I can map my Dell Precision M4500's second power button to boot linux instead of windows.
  
 
===Using Windows 2000/XP Bootloader===
 
===Using Windows 2000/XP Bootloader===

Revision as of 01:29, 6 December 2012

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

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: GRUB Legacy support has been dropped from Arch Linux:
https://www.archlinux.org/news/grub-legacy-no-longer-supported/ (Discuss in Talk:Dual boot with Windows#)

Windows and Arch Dual Booting

In this example, we will install Windows first, and subsequently install the GRUB bootloader along with Arch, allowing for dual boot.

Installation will be standard, but there are a few things to keep in mind:

1. You may have to use logical partitions for some of your partitions, because there can only be up to 4 primary partitions per disk.

2. Remember to write down your partitions numbers: "sda1, sda2... sda8", noting which type of partitions belong to their relevant number. For example:

sda1 
Windows - 30 GB should be enough. Many new games exceed 10GB each so bear this in mind.
sda2 
/boot - 100 MB is enough (optional)
sda3 
/ - 10 GB should be enough. If you're planning on using KDE or installing a bunch of games, you may wish to allocate more; perhaps 15 GB.
sda4
swap - between 1024 MB and 4096 MB (optional). With 2 GB+ RAM you may even wish to skip it entirely. If you're only using swap for hibernation, you can also use a swapfile, which will free up one of those 4 primary partitions.
sda5
/home - rest of the drive (optional)
Note: Older motherboards have a 1024 cylinder limit. This means that the BIOS cannot access things beyond the 1024th cylinder (about 8.5 GB), so the /boot partition should be in the first 8.5 GB (most likely before the Windows partition). GParted Live, Parted Magic or SystemRescueCd are useful for moving and resizing partitions to accommodate this.

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). Installing GRUB onto your Windows partition may cause Windows not to 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:

Note: The above instruction is in conflict with the GRUB installation position documented in GRUB#General notes about bootloader installation which says GRUB should be installed to MBR or the first partition to be recognized by most BIOS.
Note: It is also possible to install GRUB to MBR (/dev/sda). This works fine with Windows 7.
# Windows XP
title Windows XP
rootnoverify (hd0,0)
chainloader +1

The parts of this entry break down as follows:

title Windows XP 
Can be anything you like; it will just be what is displayed in the GRUB boot-up screen
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.
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.
  • The file is read from the top down, so the system listed first will be the one to automatically boot, if no keys are pressed during the GRUB boot screen.
  • GRUB uses a zero indexed system of numbering drives and partitions, which is a different convention than you may be used to seeing:
First disk, first partition=sda1=hd0,0
First disk, second partition=sda2=hd0,1
Second disk, first partition=sdb1=hd1,0

Dual Booting from Multiple Hard Drives

To dual boot from two separate hard drives (e.g., one dedicated Linux drive and one dedicated Windows drive).

Windows + Arch

You have Windows installed on the first hard drive and you want to install Arch on the second one. Follow this procedure :

  1. Unplug the Windows hard drive (this is not needed if you are sure you know which drive have the Windows on it and which one is supposed to receive Arch. But this way you are sure you won't do any mistake)
  2. Install Arch on the second hard drive (that has become the first if you have unplug the Windows one)
  3. Be sure to install GRUB on the MBR on the Arch drive (I didn't test with syslinux but it should work too).
  4. At the end of the process you should be able to boot on Arch but not on Windows (the disk is unplug and even if not, GRUB doesn't know how to boot Windows... Yet !)
  5. Log in on Arch
  6. Edit /boot/grub/menu.lst (that needs root access),At the end add :
(2) Windows
title Seven
rootnoverify (hd0,0)
makeactive
chainloader +1

I use '(2)' because '(0)' and '(1)' are already used by Arch.

If you want Windows to be loaded by default (the happy wife, happy life way !) Change the 'default' value by the one used for declaring Windows just before (here it is '2'). Ex :

# general configuration:
timeout   8
default   2

7/halt your computer and plug-in the Windows drive

8/Restart the computer. You should see the GRUB menu proposing Arch and Windows. Select the one you want et voila !

Arch + Windows

If 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)
map (hd1) (hd0)

So the entry for Windows on second disk, first partition will look like this:

title Microsoft Windows XP Professional
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

Or if the above configuration doesn't work, you might try the one below from the Arch Wiki GRUB page:

title Windows
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
makeactive #if you use Windows7 this line should be commented out
chainloader +1

More information on GRUB configuration can be found in the GRUB manual.

Other Layouts

1. You could use:

sda1 
Windows XP
sda2 
swap
sda3 
root
sda4 
home

and not use an extended partition (as /boot will be in the / partition as well).

2. LVM (Logical Volume Management) is also an option. You could simply create a single LVM partition and then create the other partitions inside the LVM physical volume. This allows a single partition to hold all your needed GNU/Linux data, and allows you to easily change partitions when necessary.

Notes on /home

You may not wish to store you documents on this mountpoint, especially if you wish to share data between both Windows and Arch Linux. Either use a shared NTFS partition (via NTFS-3G) or install Ext2Fsd in Windows, which will let you mount EXT4 partitions, even as Read-Only (a good idea in keeping the files virus-free).

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

Excerpted from http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/

In order to have the Windows boot-loader see the linux partition, one of the linux partitions created needs to be FAT32 (in this case, /dev/sda3). The remainder of the setup is similar to a typical installation. Some documents state that the partition being loaded by the Win boot-loader must be a primary partition but I have used this without problem on an extended partition.

  • When installing the grub bootloader, 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

Done! Reboot and enjoy. In my case I'm using the Win bootloader so that I can map my Dell Precision M4500's second power button to boot linux instead of windows.

Using Windows 2000/XP Bootloader

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 bootloader; you will still need a /boot partition, and this one is arguably more difficult to set up.

See also

Booting Windows from a desktop shortcut