Howto: Re-Write the Boot Sector on your Harddisk

Howto

How to re-write the boot sector on your hard disk

Assmptions

sda1 is /boot
sda2 is swap
sda3 is /

Step 1

Boot with a Linux rescue CD/DVD/USB Stick. you might use whatever flavour of rescue disks suits best. Even the rescue mode of the UCS Installation DVD is fine. Make sure your are user “root”.

NOTE: If any assumption about the partitions are wrong, adapt the commands accordingly.

Step 2

Create the simulated /-structure of your UCS system.

# mkdir /myucs
# mount /dev/sda3 /myucs
# mount /dev/sda1 /myucs/boot
# mount --bind /proc /myucs/proc
# mount --bind /dev /myucs/dev
# mount --bind /sys /myucs/sys
# chroot /myucs

Step 3

Re-write the boot sector of your disk.

# grub-install /dev/sda
# sync
# exit

Step 4

Unmount all and rebot your server through default boot order. It should boot now.

# umount /myucs/sys
# umount /myucs/dev
# umount /myucs/proc
# umount /myucs/boot
# umount /myucs
# sync
# reboot
Mastodon