Remove a drive from a 2-drive RAID 5 array using version 1.2 metadata?

by ryank   Last Updated May 04, 2015 02:00 AM

My situation is nearly identical to "How to remove a drive from a non-standard 2-drive RAID 5 array?", except my 2 TB RAID5 is using mdadm super block version 1.2. According to the best answer), "Because it's a mdadm super block version 0.90, each drive should be usable on its own as well. Since 1.1 and 1.2 put the meta data near the beginning on the array it won't work for those versions."

However, after executing

mdadm /dev/md0 --grow --raid-devies=2

and completion of the subsequent layout change, my RAID 5 looks like this:

    /dev/md0:
        Version : 1.2
  Creation Time : Thu Sep 25 11:25:10 2014
     Raid Level : raid5
     Array Size : 1953383296 (1862.89 GiB 2000.26 GB)
  Used Dev Size : 1953383296 (1862.89 GiB 2000.26 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sun May  3 17:19:39 2015
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 128K

           Name : XXX:0  (local to host XXX)
           UUID : XXX:XXX:XXX:XXX
         Events : 93388

    Number   Major   Minor   RaidDevice State
       3       8       16        0      active sync   /dev/sdb
       1       8       32        1      active sync   /dev/sdc

And my two devices look like this:

/dev/sdb:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : 37ac9dbd:a823812b:fe8a59f6:ba24bf34
           Name : XXX:0  (local to host XXX)
  Creation Time : Thu Sep 25 11:25:10 2014
     Raid Level : raid5
   Raid Devices : 2

 Avail Dev Size : 3906767024 (1862.89 GiB 2000.26 GB)
     Array Size : 1953383296 (1862.89 GiB 2000.26 GB)
  Used Dev Size : 3906766592 (1862.89 GiB 2000.26 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : XXX:XXX:XXX:XXX

    Update Time : Sun May  3 13:11:25 2015
       Checksum : 30f8e8f7 - correct
         Events : 93388

         Layout : left-symmetric
     Chunk Size : 128K

   Device Role : Active device 0
   Array State : AA ('A' == active, '.' == missing)

--

/dev/sdc:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : 37ac9dbd:a823812b:fe8a59f6:ba24bf34
           Name : XXX:0  (local to host XXX)
  Creation Time : Thu Sep 25 11:25:10 2014
     Raid Level : raid5
   Raid Devices : 2

 Avail Dev Size : 3906767024 (1862.89 GiB 2000.26 GB)
     Array Size : 1953383296 (1862.89 GiB 2000.26 GB)
  Used Dev Size : 3906766592 (1862.89 GiB 2000.26 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : XXX:XXX:XXX:XXX

    Update Time : Sun May  3 13:11:25 2015
       Checksum : 6ab24a9f - correct
         Events : 93388

         Layout : left-symmetric
     Chunk Size : 128K

   Device Role : Active device 1
   Array State : AA ('A' == active, '.' == missing)

Accounting for the value of "Data Offset" on each drive:

dd if=/dev/sdb skip=262144 bs=512 count=1024 of=/tmp/b
dd if=/dev/sdc skip=262144 bs=512 count=1024 of=/tmp/c

I still get equivalent md5sums:

79e53dd4906b3fcb7b1f7c613325c377  /tmp/b
79e53dd4906b3fcb7b1f7c613325c377  /tmp/c

So, does this mean that

mdadm /dev/md0 --fail /dev/sdc --remove /dev/sdc
mdadm --zero-superblock /dev/sdc

or

mdadm --stop /dev/md0
mdadm --create /dev/md0 --level=1 --raid-devices=1 --force /dev/sdb
mdadm --zero-superblock /dev/sdc

will not result in any data loss (assuming the remaining data is moved elsewhere before the final drive fails)?



Answers 1


I went ahead and just tried it, and the answer is YES. A two-disk RAID5 using mdadm superblock version 1.2 will in fact retain its data upon failure and removal of one of the disks.

e.g:

mdadm /dev/md0 --fail /dev/sdc --remove /dev/sdc
mdadm --zero-superblock /dev/sdc
ryank
ryank
May 04, 2015 05:40 AM

Related Questions


Raid 5 Recovery Process

Updated August 07, 2017 07:00 AM

How do I move a Linux software RAID to a new machine?

Updated November 02, 2017 01:00 AM

Ubuntu RAID5 failure - unable to recover

Updated June 11, 2017 20:00 PM

Will my reshape result in an unrecoverable array?

Updated January 15, 2018 22:00 PM