I'm dual booting a Windows 7 + Ubuntu machine. I went ahead and replaced Ubuntu with Crunchbang, and now want to replace (not in place upgrade) Windows 7 with Windows 8. However, I've always done a dual boot with Windows first. I know that if I now try to install Win8 it will override the boot record. How can I make it so that I can install Win8 without loosing my already customized Crunchbang install?

  • 1
    Since you already replaced Ubuntu with Crunchbang, you should remove the Ubuntu tag from it. – Luis Alvarado Feb 15 '13 at 19:21
  • great point removing tag – Diego Feb 15 '13 at 23:27

If (a very important if, so make sure you understand the difference first) you are using an MBR style hard disk, as opposed to the newer GPT style, you can simply back up your MBR (master boot record) before you install windows, then replace it afterward. To back-up:

dd if=/dev/sda of=mbr.copy bs=512 count=1

"/dev/sda/" should be your actual hard disk (notice, not "sda1" or "sda2", just "sda"). Put that file somewhere safe where you can easily access it again.

Now install windows, which will overwrite the MBR you just backed up. Afterward, boot a linux live CD or something (since you won't be able to boot the crunchbang partition) and beware since you are now using some other medium, sda might not be the same drive it was before. If it isn't replace "sda" with the correct dev node below, and back up the new windows mbr, just in case:

dd if=/dev/sda of=ms.mbr.copy bs=512 count=1

Keep that somewhere safe where you won't forget what happened to it. Now replace the MBR with the other copy you made before:

dd if=mbr.copy of=/dev/sda bs=512 count=1

You should be able to reboot now and get the grub menu. Hopefully, the new windows will boot with the same menu entry as the old windows -- if not you have to sort that out.

You can use the ms.mbr.copy the same way in the future if you have a need for that.

There might be a similar way to do this for GPT, but since I haven't tried, I can't say. An easy way to tell whether your disk is GPT or MBR from linux would be to try gdisk -l /dev/sda. If you don't have a GPT disk, you'll see a big warning, "Found invalid GPT and valid MBR; Converting MBR to GPT" (don't worry, it doesn't actually do that when you just run -l).

  • 1. How do I find out what kind of hard disk Im using? 2. How can I check if the new windows will boot with the same menu entry as the old? – Diego Feb 15 '13 at 23:27
  • 1. Sorry, it's more properly "GPT" (for GUID Partition Table), and it was developed as part of UEFI (which is sort of a BIOS style). Having a UEFI "BIOS" (really it's not a BIOS, it's a UEFI) doesn't mean you have GPT but it may be required. I added a sentence in the last paragraph about how to tell GPT from MBR. Windows will probably say something somewhere too: tomshardware.com/forum/268934-32-disk – goldilocks Feb 16 '13 at 11:40
  • 2. As for the dual boot issue, just try it. If it is on the same partition, I say it will probably work; one issue (probably, the only issue) will be if grub is using the UUID of the partition, which changes when you reformat it. You can get the UUID with blkid /dev/sda1 (or sda2, if that's where windows is), then you just change that in /boot/grub2/grub.cfg. – goldilocks Feb 16 '13 at 11:45
  • @goldilocks: cgdisk and gdisk allow you to back up a GPT partition table. Not sure if it will still work, though. – strugee Jun 23 '13 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.