Linux

From coopzone
Revision as of 20:54, 13 September 2010 by Cooperd (talk | contribs) (→‎mdadm)
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 all old patrons in array, i.e.

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

init 0, remove faulty drive, replace new one make sure you have completely deleted the new drive, things like:

boot from cd, rescue mode

For most commands to work you need an /etc/mdadm.conf. This can be setup using mdadm -E --scan option to get the /etc/mdadm.conf file from the drives in the system.


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

remove patrons, recreate from an existing drive

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


reboot from cd, rescue mode

create an /etc/mdadm.conf for each md device

example mdadm.conf

ARRAY /dev/md2 devices=/dev/hda5,/dev/hdb5,/dev/hdc5,/dev/hdd5


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 the data one but you donut need to wait for the build to complete, once it's started you can reboot, it will then continue while the system is up