Replace failed hard drive in software RAID

Partitioned disk using sgdisk as follows,which means disk structure copied to replaced drive.

# sgdisk --backup=table /dev/sdb
# sgdisk --load-backup=table /dev/sda
# sgdisk -G /dev/sda

OR

Use sfdisk command,
-replace the old /dev/sda hard drive with a new one

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

OR

 sfdisk /dev/sdb > part_table
sfdisk /dev/sda < part_table
sfdisk /dev/sda < part_table --force



To view the disk structure.
parted  /dev/sdb
parted  /dev/sda

Added the partition to raid array,
Ex:

/dev/sda1 to /dev/md1 array and /dev/sda2 to /dev/md2

  mdadm --add /dev/md1 /dev/sda1---------------->add the sda1 to raid md1.
   mdadm --detail /dev/md1--------------------->details

To remove failed disk from raid.

   mdadm /dev/md1 -f /dev/sda1  ---------->mark sda1 as faulty drive.
    mdadm --detail /dev/md1------>shown sda1 degraded
   mdadm /dev/md1 -r /dev/sda1 ---------------->remove sda1 from md1.

Refer:-  http://www.cyberciti.biz/faq/linux-backup-restore-a-partition-table-with-sfdisk-command/

Comments

Popular posts from this blog

Using a Linux server to route packets between two private networks

PHP Fatal error: Class 'JFactory' not found

KVM & Qemu