Sunday, June 28, 2015

Add second mirrored raid 1 hard drive to software raid 1 /dev/md0 md0 on hardware node

# SDB is the first hard drive
# SDC is the second hard drive
# only one partition for each drive
sfdisk -d /dev/sdb | sfdisk --force /dev/sdc  (copies partition table from sdb to sdc)

-----------------------

cat /proc/mdstat

dd if=/dev/zero of=/dev/sdc bs=512 count=1
sfdisk -d /dev/sdb | sfdisk --force /dev/sdc
mdadm --manage /dev/md0 --add /dev/sdc1

cat /proc/mdstat

-----------------------

example how it should look like after partitioned:

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
81 heads, 63 sectors/track, 191411 cylinders
Units = cylinders of 5103 * 512 = 2612736 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x31961bff

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      191412   488385560   fd  Linux raid autodetect

-------------

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       60802   488385560   fd  Linux raid autodetect



///////////////////////////////////////

if SDC is source and SDB is the target:

dd if=/dev/zero of=/dev/sdb bs=512 count=1
sfdisk -d /dev/sdc | sfdisk --force /dev/sdb
mdadm --manage /dev/md0 --add /dev/sdb1


No comments:

Post a Comment