I have a dual-boot laptop (Windows 7/Kubuntu 12.04) with an IDE spinning-rust disk.

I'd like to reinstall Windows. The problem is that the only medium for that is a factory-installed recovery partition, and I'm concerned it might potentially damage the Linux partitions.

My current plan of attack is:

  1. Note down existing partition information (from e.g. parted).
  2. Back up the Linux partitions using dd.
  3. Use the Windows recovery to reinstall Windows.
  4. If the recovery process damages the Linux partitions or dual boot configuration, use a LiveCD to:
    1. Partition the disk as it was before the reinstall.
    2. Use dd to write the partition data into the newly created partitions.
    3. Restore the dual boot configuration (I have yet to research how I go about that).

The question I'd like to ask: is this the correct approach, and, if yes, what are the gaps and potential pitfalls I should be mindful about?


It probably will damage the linux partitions and any other partitions (so back up to an external, detachable disk), if it's anything like what I've dealt with before; good news is you do have a solid plan of attack. However, you might also want to back up your boot loader (probably GRUB), which is stored in the first 446 bytes of the drive:

dd of=/backup/bootloader.mbr if=/dev/sda bs=446 count=1

And then restore it after you replace the partitions

dd of=/dev/sda if=/backup/bootloader.mbr

Alternatively, I think you can use a live CD to boot the linux partition, and then

sudo update-grub

to re-write the bootloader.

  • So I'm on the right track, then? Thanks for the GRUB instructions. One question 'though - why this specific byte buffer (466) in dd? – mikołak Jun 7 '13 at 16:51
  • OK, since this answer has gone unaccepted for too long, I'll assume this is just for convention's sake. – mikołak Jun 18 '13 at 15:21
  • @TheTerribleSwiftTomato Whoops, I missed the notification about your comment: The first 512 bytes of a DOS-formatted harddrive (as opposed to Apple or GPT) are the bootloader and partition table. Specifically, the first 466 are the boot loader, and then 467-512 are the partition table. Since we just want the boot loader, we set the block size to 466 and tell dd to copy 1 block. "Disk Convention" isn't the right word for it (though it is a convention I suppose); "Disk Format" better describes it. – Darth Android Jun 18 '13 at 16:30
  • heh, I also had a brainfart and missed the count=1 bit and hence the entire point of the command. Thanks for the clarification. I suggest it would be worthwhile to edit it into the answer. BTW, I think you might have probably meant 446 instead of 466: en.wikipedia.org/wiki/Master_Boot_Record#Sector_layout . – mikołak Jun 18 '13 at 17:32
  • 1
    Indeed I did; Fixed! – Darth Android Jun 18 '13 at 18:49

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.