1

Years and years ago, I set up a 4 TB RAID5 array using 3x 2 TB disks. Those are positioned in sda/b/c. I have a very old tiny disk in sdd, and I'm booting from a 1 TB SSD in sde. Yea, it's a mess.

Disks have gotten cheaper, so I'm trying to simplify my setup. I have two identical 4 TB disks, that I'd like to set up a new RAID1 to replace the existing array (I've had all sorts of issues with drives dropping, etc in the existing).

The problem is that I can replace sdd, but do not have two available slots to create the array. I could do something like the following link, but it seems that OP had additional complications because it was their boot disk. These disks/array are only for storage. Not sure if that simplifies the situation at all. Can I create a software RAID 1 with one device

Other choice would be to try and run the RAID5 with only two disks during the initial copy. Any chance this would screw things up?

Thanks a bunch!

Kusalananda
  • 333,661
Mike H
  • 11
  • You can most definitely create a RAID1 array with a missing disk. See https://unix.stackexchange.com/a/474877/100397 for an example with RAID5 that lets you try out the commands without loss of data. Note that the example creates a RAID5 with only two devices - the principle for RAID1 with only one is similar – Chris Davies Dec 22 '21 at 21:06
  • it should work exactly as shown in the question you linked (it specifies one drive as missing). alternatively just use a usb enclosure, mdadm is not picky as long as it works – frostschutz Dec 22 '21 at 21:16
  • 1
    I rolled back your latest edit where you added the solution to the question and tagged the title with "SOLVED". If you have an answer, then please add it as a proper answer. You may then "accept" it which would mark the question as resolved. See https://unix.stackexchange.com/help/self-answer – Kusalananda Jan 21 '22 at 18:18

1 Answers1

0

As mentioned in Build RAID 5 with mdadm and 1 disk with data, and actually in Can I create a software RAID 1 with one device, the question you linked to, you can create a RAID device without all devices present by marking the missing one as missing, e.g.

mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sdd missing

That should work as long as the device can run with the given devices, e.g. RAID 1 should work with just one device present, RAID 5 needs N-1, and RAID 6 needs N-2. But you can't do that with RAID 0 as there's no redundancy.

Then create the filesystem on the incomplete mirror /dev/md1, copy files over and later just add the remaining disk(s), and watch the recovery process:

mdadm /dev/md1 --add /dev/sda1
watch /proc/mdstat

Since RAID 5 can run in degraded mode with one device missing, you could drop one of sd[abc] to get more free ports for the new drives, as you suggest. But if there's an error on one of the drives with the device already running in degraded mode, there'll be trouble. I'm not sure if that would cause any actual issues that couldn't be resolved by just plugging the missing disk back — I expect it'd just fail the array or mark it read-only. But anyway, if you're going to do that, perhaps make sure the drives read ok beforehand, e.g. with the builtin read check, see: https://www.thomas-krenn.com/en/wiki/Mdadm_checkarray_function

ilkkachu
  • 138,973