[CentOS] Re: Reinstall Windows but preserve CentOS

Fri Jul 29 15:27:43 UTC 2005
Bryan J. Smith <b.j.smith at ieee.org>

Dave Gutteridge <dave at tokyocomedy.com> wrote:
> How can I reinstall Windows with a clean partition, and
> preserve my dual booting?

Recommendation #1:

Always use your Linux Rescue Disk to boot and re-install GRUB
afterwards.

Recommendation #2:  

dd can be used to preserve and return the _full_ MBR.
I.e., the _full_ MBR is Cylinder 0,
  1 cyl * X heads * Y sectors * 512 bytes/sector

So if your disk geometry is 16/63 heads/sectors,
to preserve the 512KiB MBR:
  dd if=/dev/XdX of=./MBR.dd bs=512K count=1
to restore the 512KiB MBR:  
  dd if=./MBR.dd of=/dev/XdX bs=512K count=1 conv=notrunc

If your disk geometry is 255/63 heads/sectors,
to preserve the 8MiB MBR:  
  dd if=/dev/XdX of=./MBR8MiB.dd bs=8M count =1
to restore the 8MiB MBR:  
  dd if=./MBR.dd of=/dev/XdX bs=8M count=1 conv=notrunc

Gotcha A:  This will _also_ include the disk label
(partition table), So it _only_ works when it's a matching
replacement.

Gotcha B:  Some service packs and hotfixes for Windows NT5.1
(XP) have been stealthy using portion of the MBR for disk
geometry and other information.  This sometimes _breaks_ GRUB
and other boot loaders as they step on each other.



-- 
Bryan J. Smith                | Sent from Yahoo Mail
mailto:b.j.smith at ieee.org     |  (please excuse any
http://thebs413.blogspot.com/ |   missing headers)