I have a computer that dual boots between Windows and CentOS. Each has it's own hard drive.
I suddenly have a problem with Windows, and may need to reinstall. I need it for applications like After Effects, Premiere, and other things that I am currently in the middle of a project with.
It seems the system has become usnstable, it's preventing me from continuing to work, and I may need to wipe the Windows partition clean and start again.
My concern is that if I do that, I will lose the Grub boot loader and not be able to access CentOS again.
How can I reinstall Windows with a clean partition, and preserve my dual booting?
Dave
0) make a backup. 1) unplug the centos drive while you do the install, just to be sure. (warning, you may run into master-slave complications due to this, depending how you've got things configured) 2) install windows. 3) boot from centos disk in rescue mode. re-install grub. I think the right syntax for this would be: chroot /mnt/sysimage /sbin/grub-install 4) you did remember to make a backup, right?
On Fri, Jul 29, 2005 at 10:49:26PM +0900, Dave Gutteridge wrote:
I have a computer that dual boots between Windows and CentOS. Each has it's own hard drive.
I suddenly have a problem with Windows, and may need to reinstall. I need it for applications like After Effects, Premiere, and other things that I am currently in the middle of a project with.
It seems the system has become usnstable, it's preventing me from continuing to work, and I may need to wipe the Windows partition clean and start again.
My concern is that if I do that, I will lose the Grub boot loader and not be able to access CentOS again.
How can I reinstall Windows with a clean partition, and preserve my dual booting?
Dave _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
danno -- dan pritts - systems administrator - internet2 734/352-4953 office 734/834-7224 mobile
} Dan Pritts } Sent: Friday, July 29, 2005 } } 0) make a backup. } 1) unplug the centos drive while you do the install, just to be } sure. (warning, you may run into master-slave complications due } to this, depending how you've got things configured) } 2) install windows. } 3) boot from centos disk in rescue mode. re-install grub. } I think the right syntax for this would be: } chroot /mnt/sysimage } /sbin/grub-install } 4) you did remember to make a backup, right? } } On Fri, Jul 29, 2005 at 10:49:26PM +0900, Dave Gutteridge wrote: } > } > I have a computer that dual boots between Windows and CentOS. Each } > has it's own hard drive. } > } > I suddenly have a problem with Windows, and may need to reinstall. I } > need it for applications like After Effects, Premiere, and other things } > that I am currently in the middle of a project with. } > } > It seems the system has become usnstable, it's preventing me from } > continuing to work, and I may need to wipe the Windows partition clean } > and start again. } > } > My concern is that if I do that, I will lose the Grub boot loader } > and not be able to access CentOS again. } > } > How can I reinstall Windows with a clean partition, and preserve my } > dual booting? } > } > Dave } } } danno } dan pritts - systems administrator - internet2
so, which drive is the master drive in this config when you _start_ and when you are all _finished_ ?
same one? CentOS drive correct?
- rh
-- Robert Hanson Abba Communications http://www.abbacomm.net
On Fri, 2005-07-29 at 22:49 +0900, Dave Gutteridge wrote:
How can I reinstall Windows with a clean partition, and preserve my
dual booting?
Can make a Grub boot floppy with a copy of the current grub.conf - see script at bottom, [a simpler approach is to use "grub-install /dev/fd0" to create a GRUB floppy, but I like having the config on the floppy - allows modifications for different boot defaults, as well as providing a backup] and/or make a boot CD:
# mkbootdisk --iso --device boot`uname -r`.iso `uname -r`
On my system this results in file boot2.6.9-11.106.unsupportedsmp.iso which can then be written to CD with
# cdrecord -v -dao -eject -data driveropts=burnfree dev=/dev/hda boot2.6.9-11.106.unsupportedsmp.iso
(all one line - watch for wraps)
Either method will let you boot back to the installed system without going though the rescue gyrations. Can then rewrite grub with
# grub-install /dev/hda [ or whatever boot device ]
Phil
------------------------ Cut Here --------------------------------- #!/bin/bash # mkgrubdisk # # Written by Phil Schaffner p.r.schaffner@ieee.org # based on mkbootdisk by Erik Troan ewt@redhat.com
pause=yes format=yes device=/dev/fd0 unset verbose
GRUBDIR=/boot/grub MOUNTDIR=/tmp/mkgrubmenu PATH=/sbin:$PATH export PATH
VERSION=0.1
usage () { cat >&2 <<EOF usage: `basename $0` [--version] [--noprompt] [--noformat] [--device <devicefile>] [--grubdir <dir>] [--verbose -v] (ex: `basename $0` --device /dev/fd1) EOF exit $1 }
while [ $# -gt 0 ]; do case $1 in --device) shift device=$1 ;; --grubdir) shift GRUBDIR=$1 ;; --help) usage 0 ;; --noprompt) unset pause ;; --noformat) unset format ;; -v) verbose=true ;; --verbose) verbose=true ;; --version) echo "mkgrubdisk: version $VERSION" exit 0 ;; *) usage ;; esac
shift done
[ -d $GRUBDIR ] || { echo "$GRUBDIR is not a directory!" >&2 exit 1 }
if [ -e "$device" ]; then { [ -n "$pause" ] && { echo -n "Insert a" [ -n "$format" ] || echo -n " vfat formatted" echo " disk in $device." echo "Any information on the disk will be lost." echo -n "Press <Enter> to continue or ^C to abort: " read aline }
[ -n "$format" ] && { [ -n "$verbose" ] && echo "Formatting $device... " fdformat $device || exit 0 mkfs.msdos $device > /dev/null 2>/dev/null || exit 0 [ -n "$verbose" ] && echo "done." }
rm -rf $MOUNTDIR mkdir $MOUNTDIR || { echo "Failed to create $MOUNTDIR" >&2 exit 1 } [ -d $MOUNTDIR ] || { echo "$MOUNTDIR is not a directory!" >&2 exit 1 }
mount -wt vfat $device $MOUNTDIR || { rmdir $MOUNTDIR exit 1 }
mkdir $MOUNTDIR/grub
[ -n "$verbose" ] && echo -n "Copying $GRUBDIR files... " cd $GRUBDIR cp -a stage1 stage2 grub.conf device.map splash.xpm.gz $MOUNTDIR/grub [ -n "$verbose" ] && echo "done."
[ -n "$verbose" ] && echo -n "Setting up GRUB... " grub --device-map=$GRUBDIR/device.map --batch <<EOF root (fd0) setup (fd0) quit EOF
[ -n "$verbose" ] && echo "done."
umount $MOUNTDIR rmdir $MOUNTDIR [ -n "$verbose" ] && echo "done setting up GRUB." echo "Edit (fd0)/grub/grub.conf to customize." echo "May want to use splashimage=(fd0)/grub/splash.xpm.gz" } else echo "$device does not exist" fi
Dave Gutteridge dave@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.
Dave Gutteridge wrote:
I have a computer that dual boots between Windows and CentOS. Each has it's own hard drive.
good to have them on their own drives. 1. configure the windows as the master disk, install windows with the linux disk removed. 2. add the linux disk as slave or secondary master or slave. This assumes that grub is loaded on the MBR of the linux disk. 3. set the bios to boot from the linux disk. 4. load linux and configure grub to boot windows.
i have the same setup and works fine. do whatever you want to your windows disk, there is no problem.
hth, Raghavendra Moktali
Thanks everyone for the helpful suggestions. Fortunately, I was able to find the problem within Windows and not need to reinstall. However, it's good to know that if I do make that choice in the future, that it can be done without harm to my CentOS installation.
Dave