Pages

Thursday, January 28, 2016

CentOS Rescue

Rebuilt the madadm.conf and re-configured grub on MBR of sda

To rebuild the mdadm.com
==> mdadm --detail --scan >> /etc/mdadm.conf

You can copy the partition layout from existing one to the newly replaced one as follows.

==> sfdisk -d /dev/sda | sfdisk /dev/sdb

Important: This will dump the partition table of sda, removing completely the existing partitions on sdb


Reconfigure Grub via rescue mode
================

Lets say the /dev/sda contains the boot partition, and sda1 mounted as /boot.

First, you have to make sure that boot flag is enabled on sda1 (There will be a * if the partition is bootable). You can mark it as bootable using 'a' with fdisk command.

#grub-install --boot-directory=/boot /dev/sda
#update-grub


You would not see any /dev/md[], /dev/sd[] or /dev/hd[] devices listed as they are not automatically mounted by the Rescue System. In some cases like MySQL crahses, you will be able to start the demand by mounting these virtual filesystems via rescue mode as follows.

mount /dev/sdb3 /mnt/sysimage
mkdir /mnt/sysimage/proc
mkdir /mnt/sysimage/sys
mkdir /mnt/sysimage/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
mount -o bind /dev /mnt/dev
chroot /mnt/sysimage

0 comments:

Post a Comment