0

I have a RAID 10 array consisting of 4 disks. One of them has failed and I have removed it from the array.

I have purchased an identical new drive and am unsure about how to add the new drive to the array.

In some literature that I read, it was mentioned that I need to copy the partitions to the new drive. In other online material that I read it seemed like the drive was simply added to the array and the syncing began without any mention of partitions having to be copied.

So now I am unsure how to proceed.

Here is some info about my raid 10 array.

cat /proc/mdstat:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md127 : active raid10 sda1[0] sdb1[1] sdc1[2]
      5860267008 blocks super 1.2 512K chunks 2 near-copies [4/3] [UUU_]

unused devices: <none>

sudo mdadm --detail /dev/md127

mdadm: unreconised word on DEVICE line: UUID=8eac0a3d-a22c-1a92-6ed9-f147f3dea64f
mdadm: unreconised word on DEVICE line: UUID=246226d0-a621-7f34-87b6-ff33b5c55906
mdadm: unreconised word on DEVICE line: UUID=52e1afa6-3ca6-a96e-f3dc-99bd0f56e878
mdadm: unreconised word on DEVICE line: UUID=16843e03-f177-97ef-07a7-6d761de9e99b
/dev/md127:
        Version : 1.2
  Creation Time : Sat Dec 13 15:01:15 2014
     Raid Level : raid10
     Array Size : 5860267008 (5588.79 GiB 6000.91 GB)
  Used Dev Size : 2930133504 (2794.39 GiB 3000.46 GB)
   Raid Devices : 4
  Total Devices : 3
    Persistence : Superblock is persistent

    Update Time : Mon Dec 31 22:07:21 2018
          State : clean, degraded
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 512K

           Name : server:0  (local to host server)
           UUID : 47c17420:8c4f5bf8:d70c8436:38187fe6
         Events : 973

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
       3       0        0        3      removed

gdisk -l of disk /dev/sda1 (in order to copy to new disk dev/sdd):

GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.
Disk /dev/sda1: 5860530176 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): AF72F8BD-75D0-469A-A7D3-3A4A40EFFFBE
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860530142
Partitions will be aligned on 2048-sector boundaries
Total free space is 5860530109 sectors (2.7 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name

I would be very thankful for steps required to swap the failed drive.

0

This is a very straightforward and low-risk procedure: Assuming you have physically replace the drive, you need to

  • First of all, find the device name for the new disk: it should be something like /dev/sdX. To find it out, try cat /proc/partitions to identify the drive, that has exactly the same size as /dev/sda, /dev/sdb and /dev/sdc

  • Next we need to create the partition table. The easiest way is to run gdisk -l /dev/sda and note the exact values for /dev/sda1, then run gdisk /dev/sdX (with X the letter you identified before) and create an identical partition (if needed, you must apt-get install gdisk before)

  • Finally add the newly created partition to the array: mdadm --add /dev/md127 /dev/sdX1 (again with X as identified before)

When this is done, cat /proc/mdstat will show you the progress of the new disk being synchronized into the array.

  • Thanks so far. I have identified the new drive as /dev/sdd. I have run gdisk -l on one of the existing drives /dev/sda1. Not sure how to proceed with gdisk. Could it be that the existing drives in the array do not have a partition table? – PartisanEntity Jan 1 at 0:30
  • I figured it out. To copy partition table from existing drive to the new one and then randomize GUID: 'sgdisk /dev/sdX -R /dev/sdY' then sgdisk -G '/dev/sdY'. – PartisanEntity Jan 1 at 0:42
  • You needed to run gdisk -l on /dev/sda, not on /dev/sda1 ! – Eugen Rieck Jan 1 at 15:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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