Editing the Windows 8 Boot Menu by Using BCDEdit
Sometimes, you will need to manually edit the Windows 8 boot menu and add in missing operating systems. To do this, you use need to gain access to the Windows 8 command line by using the method I described earlier or by starting your computer from your Windows 8 installation DVD and selecting Repair Your Computer at the Install screen.
BCDEdit follows the structure BCDEdit /Command [Argument1] [Argument2]. Useful commands you will need to add in an operating system are as follows:
- /? Displays a full list of BCD commands.
- /default {GUID} Sets the default bootloader on the computer.
- /enum all Displays your current disk structure. You should run this to make a note of the GUID (identifier) for the operating system(s) you wish to add to the boot menu.
- /export and /import Backs up and reimports the boot menu.
- /timeout [num] Changes the length of time for which Windows waits at the boot choices screen; for example, /timeout 10 instructs Windows to pause for 10 seconds.
To use BCDEdit, perform the following steps:
- Open a Command Prompt window, as described at the beginning of this section.
- Type bcdedit /enum all and press Enter to show all the data for each installed operating system on your computer.
You will see Windows 8 listed as {current} and a different entry (or more) for a {legacy} operating system. Note that this might also display as {ntldr}.
To change the name of an operating system that already appears in BCDEdit, perform the following steps:
- Create a backup of the BCD file in case something goes wrong. Type bcdedit / export ?C:\BCD_Backup? (where BCD_Backup is the location at which you want the backup to reside) and press Enter.
- Type bcdedit /set {legacy} Description ?OS Name? (where OS Name is the name of the operating system) and press Enter. You can also use {current} to change the name of the main Windows 8 installation.
Note:
To set the entry for a second Windows 8 installation, type bcdedit /set {GUID} Description "Windows 8 Alternate", where GUID is the long string of numbers and letters.
To change the default operating system in BCD, type bcdedit /default {current} to set the Windows 8 boot loader as the default. You can also use {legacy}, {ntldr} or a {GUID}.
If an operating system is showing with an incorrect partition, you can change this by using the command bcdedit /set {GUID} device partition=X:, where X: is the correct partition. You must also then use the command bcdedit /set {GUID} osdevice partition=X:.
However, sometimes an operating system simply won't show up. In this case, you will need to add it to the boot menu manually. To manually add an operating system to the boot menu, perform the following steps:
- Type bcdedit /create {legacy} /d "Windows XP" and press Enter to create a new boot entry for the operating system.
- Type bcdedit /set {legacy} device partition=D: (where D: is the drive on which the operating system is installed ) and press Enter.
- Type bcdedit /set {legacy} path /ntldr and press Enter.
Note that if your Linux installation is already showing in bcdedit /enum all you can change the path to /linux.bin. - Type bcdedit /displayorder {legacy} /addlast and press Enter to add Windows XP to the end of the current boot menu.
Manually Setting Dual Booting for Windows 8 and Linux
If dual-booting both a GNU/Linux installation and Windows 8 doesn't work using the simple commands described in the preceding section, you will need to follow a slightly more complex route. Run the following commands in Linux before installing Windows 8:
- Boot into Linux and launch a terminal with root privileges.
- Determine on which parititon Linux is installed by typing fdisk -l and pressing Enter. The Linux operating system will be on a partition such as /dev/sda1 or /dev/hda1.
- Install the GRUB boot manager by typing grub-install /dev/sda1 and pressing Enter.
- Copy the Linux boot sector by typing dd if=/dev/sda1 of /tmp/linux.bin bs=512count=1 and pressing Enter.
- Copy linux.bin to a different partition or USB flash drive as a backup.
- Install Windows 8.
- In Windows 8, press Windows logo key+X to launch the Command Prompt (Admin).
- Copy your Linux.bin backup file to the root (active) partition on your hard disk, which is the one containing bootmgr.
If you do not know which one this is, type diskpart and then diskmgmt.msc to determine it. Type exit to leave the diskpart tool. - Create a GRUB entry by typing bcdedit /create /d "GRUB" /application BOOTSECTOR and pressing Enter.
BCDEdit will return a {GUID} for this entry. You should make a note of this. For this tutorial, we will call it {LinuxGUID}. - Type bcdedit /set {LinuxGUID} device boot and press Enter to specify which device hosts the Linux boot sector.
- Type bcdedit /set {LinuxGUID} PATH /Linux.bin and press Enter to specify the path of the Linux boot sector.
- Type bcdedit /displayorder {LinuxGUID} /addlast and press Enter to add Linux to the end of the boot order.
Backing Up the Windows 8 Boot Partitions
In tutorial we talk about GNU/Linux primarily because when it comes to dualbooting Windows, this is the operating system that enthusiasts most seem to want as the secondary system.
There is one use for Linux though that Windows simply cannot match: Linux can allow you to create full backups of the Windows System Reserved partition and other boot partitions. To do this you need to download a Linux ISO file and burn it to a CD or DVD. You can then boot your computer from the disc (don't install Linux), and you will be able to see-and most important-access all the partitions on your computer's hard disk
Here, you can make copies of the partitions, either by copying the files into backup folders (make a note of the partition types and sizes so that you can recreate them later; I will show you how to get the details shortly), or if you have an imaging tool, you can create an ISO file of each image that you can later copy back, again by booting from your Linux disc.
You can get the full details of a partition by using the Disk Utility in Linux. This will give you valuable information, including data about the following:
- Partition Type
- Label
- Capacity
You will need all of this information to rebuild the partition if it becomes completely corrupt.
Normally, however, just copying the contents of the boot partitions (including System Reserved, which is the most important) means that you can then use a Linux boot disc to copy the contents back afterward if a disaster occurs.