2

I had a 1-disk RAID0 array that I created with a view of adding more disks to it eventually, that was working normally. I created it with (approximately):

$ mdadm --create /dev/md0 --raid-devices=1 --level=0 /dev/sdb -f

Then I added another disk to it with:

 $ mdadm --grow /dev/md0 --add /dev/sdc --raid-devices=2

and, as per manual, mdadm converted the array to RAID4 and started re-syncing. The manual says that the array will be converted back to RAID0 later. However, /etc/mdstat says it will take 2-3 days for a full re-sync, and I'm wondering whether it is possible instead to stop the array, kill the superblock on /dev/sdc, and do something like:

$ mdadm --create --assume-clean --verbose /dev/md0 --chunk=512 \
    --level=0 --raid-devices=2 /dev/sdb /dev/sdc

instead of waiting for the useless RAID4 re-sync?

Right now, the array state is:

$ mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : XXXXXXXXXXXXXXXX
     Raid Level : raid4
     Array Size : 11718754304 (11175.88 GiB 12000.00 GB)
  Used Dev Size : 11718754304 (11175.88 GiB 12000.00 GB)
   Raid Devices : 3
  Total Devices : 2

    Update Time : XXXXXXXXXXXXXXXX
          State : clean, FAILED, reshaping
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

     Chunk Size : 512K

sistency Policy : resync

 Reshape Status : 2% complete
  Delta Devices : 1, (2->3)

...

[root@centos7 ~]# mdadm --stop /dev/md0
[root@centos7 ~]# mdadm -E /dev/sdb
/dev/sdb:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x44
     Array UUID : 5978222a:8f2c320c:c7059108:c3d6dc41
           Name : centos7:0  (local to host centos7)
  Creation Time : Sat Apr 28 05:15:00 2018
     Raid Level : raid4
   Raid Devices : 3

 Avail Dev Size : 23437508608 (11175.88 GiB 12000.00 GB)
     Array Size : 23437508608 (22351.75 GiB 24000.01 GB)
    Data Offset : 262144 sectors
     New Offset : 260096 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : 9a75cd7e:bb469dab:2e0db890:69a68f54

  Reshape pos'n : 620094464 (591.37 GiB 634.98 GB)
  Delta Devices : 1 (2->3)

    Update Time : Wed Aug  1 06:12:00 2018
  Bad Block Log : 512 entries available at offset 8 sectors
       Checksum : d239a780 - correct
         Events : 608

     Chunk Size : 512K

   Device Role : Active device 0
   Array State : AA. ('A' == active, '.' == missing, 'R' == replacing)
[root@centos7 ~]# mdadm -E /dev/sdc
/dev/sdc:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x46
     Array UUID : 5978222a:8f2c320c:c7059108:c3d6dc41
           Name : centos7:0  (local to host centos7)
  Creation Time : Sat Apr 28 05:15:00 2018
     Raid Level : raid4
   Raid Devices : 3

 Avail Dev Size : 23437508608 (11175.88 GiB 12000.00 GB)
     Array Size : 23437508608 (22351.75 GiB 24000.01 GB)
    Data Offset : 262144 sectors
     New Offset : 260096 sectors
   Super Offset : 8 sectors
Recovery Offset : 620094464 sectors
          State : clean
    Device UUID : ce6e93f9:729557dc:a1afc6a4:39b954f9

  Reshape pos'n : 620094464 (591.37 GiB 634.98 GB)
  Delta Devices : 1 (2->3)

    Update Time : Wed Aug  1 06:12:00 2018
  Bad Block Log : 512 entries available at offset 264 sectors
       Checksum : 5b8389b4 - correct
         Events : 608

     Chunk Size : 512K

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

Growing a 1-disk RAID-0 (essentially, linear data) to 2-disk RAID-0 (striped data) involves reshaping / redistributing all that data. Simply creating a new RAID instead would result in complete data loss.

As such, the re-sync is useless only if there was no data on the RAID array in the first place. And obviously without data you can do whatever you want.

If you're going to re-create that RAID array from scratch, I suggest you also put a partition table on your drives and then work with partitions. For unpartitioned drives, it's easy to create a partition table by accident and doing so would damage your RAID metadata.

2
  • Oh. I forgot about striping. So the kernel is basically copying half the data to the other disk? Is it safe to write to the array (e.g. extend the filesystem) while reshape is in progress? – Anton Tykhyy Aug 1 '18 at 12:02
  • 2
    It copies half the data to the other disk, while also moving half the data on the first disk. Using the array during reshape is usually safe (mdadm would have told you otherwise) but added storage may not be available until reshape is finished. – frostschutz Aug 1 '18 at 12:45

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.