Linux

From coopzone
Jump to navigation Jump to search

Grub Notes

To re-install grub manually (mostly for raid systems, if you want more than one drive to be bootable)

grub
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.

grub> quit

Repeat above for each drive. Note the (hd0,0) refers to the boot partion.

mdadm

Example: To replace a drive

Fail the drive you want to replace in the array, i.e.

mdadm --manage /dev/mdx --fail /dev/hdxy

shutdown the system, replace the drive.

If the drive is not already blank, you may need to remove any previous raid usage:

boot from cd, rescue mode.

For most commands to work you need an /etc/mdadm.conf.

This can be setup using "mdadm -E --scan >/etc/mdadm.conf"

To get the /etc/mdadm.conf file from the drives in the system.

madam --zero-superblock /dev/hdxy for each partionion.

remove the partitions, recreate from an existing drive

sfdisk -d /dev/hdx | sfdiisk /dev/hdy


start the array used by the root filesystem

madam -A /dev/md1 --force --run

add the new drive/partion to the root md device

madam --manage /dev/md1 --add /dev/hdxy

wait for rebuild

do the same for the /boot patron

finally any data partions you have, these can be done either from a rescue setup or after a reboot.