1

I'm trying to setup a raid 5 for my Nextcloud but when I run the mdadm --create command it stops.

Here is my configuration :

Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 732566646 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x42f4f4a0

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1         256 471859455 471859200  1.8T fd Linux raid autodetect


Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0xfdae88e1

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3907029167 3907027120  1.8T fd Linux raid autodetect


Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x8c71de97

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdc1        2048 3907029167 3907027120  1.8T fd Linux raid autodetect
  • sdb and sdc are Seagate IronWolf 2 To 3.5" 5900 RPM 64 Mo Serial ATA 6 Gb/s.
  • sda is a Maxell E-series USB 3.0 HDD 3.5 EXT 3TB 5400RPM 8Mo 5 Gb/s.

Then I did this :

pi@raspberrypi:~ $ sudo mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
mdadm: largest drive (/dev/sdb1) exceeds size (1887305728K) by more than 1%
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
pi@raspberrypi:~ $ cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid5 sdc1[3] sdb1[1] sda1[0]
      3774611456 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
      [>....................]  recovery =  0.0% (788432/1887305728) finish=2213.9min speed=14201K/sec
      bitmap: 0/15 pages [0KB], 65536KB chunk

unused devices: <none>

But after few hours I got this :

pi@raspberrypi:~ $ cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid5 sdc1[3](S) sdb1[1] sda1[0](F)
      3774611456 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/1] [_U_]
      bitmap: 0/15 pages [0KB], 65536KB chunk

unused devices: <none>

I know that it's supposed to take something like 2 days to create it with my raspberry and 2T disks. So something was wrong. I tried to delete everything and restart but the same issue occurred.

Searching on the web I found that (F) means faulty, so it's because of my sda disk but I don't know what to do.

Can you help me to find out what is wrong ?

Thank you very much !

  • From this speed=14201K/sec and size 1.8T you can calculate you need 1800000/14~=120000 seconds which mean ~36 hours – Romeo Ninov Jan 7 at 16:16
  • Yes, it's the case when the speed is constant. But in this case the speed was changing a lot. Sometimes it was around 14000k/sec, sometimes 200k/sec. – Izaya Jan 7 at 16:21
  • In such case will take a lot of time. For the test you can play with small partitions (1G for example) and test the things and if all is OK start the process with big disks – Romeo Ninov Jan 7 at 16:23
  • With partitions of 1G it works well and it took 1 minute to build. So I did exactly the same for 1.8T partitions but I had the same issue : after few hours it stopped to build the raid. After hours on the web I still don't know why and how to arrange. – Izaya Jan 7 at 22:55
  • 1
    In /var/log/messages I found sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08; sd 0:0:0:0: [sda] tag#0 Sense Key : 0x5 [current]; sd 0:0:0:0: [sda] tag#0 ASC=0x24 ASCQ=0x0; sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 30 14 44 00 00 01 00; md/raid:md0: read error not correctable (sector 25205280 on sda1); md0: unable to read partition table. So it's clear that it's because of sda. – Izaya Jan 8 at 10:31
0

It was because of dead sectors on my sda drive. The solution was to create a partition without dead sectors.

How to find what's wrong

Go to /var/log/messages to figure out which partition isn't working and why. For example I had : md/raid:md0: read error not correctable (sector 25205280 on sda1); md0: unable to read partition table. That means your disk has dead sectors.

How to create a partition without dead sectors

Now you can try again with another partition of the bad disk that doesn't contains the dead sectors indicated in your log. To do it you can use fdisk /dev/sda, delete the previous partion and create a new one by selecting precisely the beginning and the end.

How to remove the current raid

Before running again mdadm --create don't forget to remove the current dysfunctional raid.

  • Remove raid : mdadm --stop /dev/md0, mdadm --remove /dev/md0 and rm /dev/md0
  • Clean disks : mdadm --zero-superblock /dev/sda1, mdadm --zero-superblock /dev/sdb1 and mdadm --zero-superblock /dev/sdc1
  • If needed, delete your partitions to have bare disks : fdisk /dev/sda, fdisk /dev/sdb, fdisk /dev/sdc. Each time you do 'd' for delete then 'w' for save.

Thanks a lot to Romeo Ninov !

|improve this answer|||||

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.