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?
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