0

I had a hard drive fail on my server. I am pretty slow when it comes to linux so bear with me. I replaced the drive.

I ran this:

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

I then ran:

fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024c28

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sda2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sda3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024c28

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sdb2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sdb3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

Disk /dev/md2: 1974.0 GB, 1973953691648 bytes
2 heads, 4 sectors/track, 481922288 cylinders, total 3855378304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Somehow I got this but, am very lost:

cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sdb3[2] sda3[0]
      1927689152 blocks super 1.2 [2/1] [U_]
      [====>................]  recovery = 23.7% (457343168/1927689152) finish=190.9min speed=128320K/sec

md0 : inactive sda1[0](S)
      25149440 blocks super 1.2

md1 : inactive sda2[0](S)
      524032 blocks super 1.2

unused devices: <none>

I am trying to get md0 added into the raid. I am thinking I have to wait till after this recovery finishes before I do anything else?

UPDATE1 I got a little further but am not sure about md1

# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
# mdadm --stop /dev/md1
mdadm: stopped /dev/md1
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sdb3[2] sda3[0]
      1927689152 blocks super 1.2 [2/1] [U_]
      [=====>...............]  recovery = 27.8% (536125376/1927689152) finish=179.4min speed=129207K/sec

unused devices: <none>
mdadm --assemble --scan
mdadm: /dev/md/0 has been started with 1 drive (out of 2).
mdadm: /dev/md/1 has been started with 1 drive (out of 2).

# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sda2[0]
      523968 blocks super 1.2 [2/1] [U_]

md0 : active raid1 sda1[0]
      25149312 blocks super 1.2 [2/1] [U_]

md2 : active raid1 sdb3[2] sda3[0]
      1927689152 blocks super 1.2 [2/1] [U_]
      [=====>...............]  recovery = 27.8% (537003968/1927689152) finish=198.8min speed=116544K/sec

unused devices: <none>

thank you

1

You don't have to wait until the operation finishes, you can add the other partitions now. Since you already added sdb3 you only need to add sdb1 and sdb2 to their corresponding mds

mdadm --add /dev/md0 /dev/sdb1
mdadm --add /dev/md1 /dev/sdb2

Then cat /proc/mdstat should show the correct status for all three partitions.

You may need to reinstall grub to both hard disks if you haven't done that already.

| improve this answer | |
  • Thank you very much, all added and resync is delayed most likely till after that other recovery finishes. – davidripes Sep 6 '16 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.