Assembling Linux software partitions
I thought there was an easier way to do this but perhaps I have forgotten. I am a fan of Linux software RAID because of the fact you can transport the drives to other systems without having to worry about hardware RAID compatibility. Linux software RAID 1 also possesses good performance and reliability. However, sometimes you need to repair file system damage or create an image of the filesystem or perform other tasks needing the arrays to be accessible from either a Live CD or from another system. Here’s how I accomplished this recently.
The drive in question had 3 RAID 1 partitions (I believe /boot, swap, and /). To assemble and run the arrays I ran the following commands:
mdadm --assemble --run /dev/md0 /dev/sdb1
mdadm: /dev/md0 has been started with 1 drive (out of 2).mdadm --assemble --run /dev/md1 /dev/sdb2
mdadm: /dev/md1 has been started with 1 drive (out of 2).mdadm --assemble --run /dev/md2 /dev/sdb3
mdadm: /dev/md2 has been started with 1 drive (out of 2).
I was then able to mount the md devices. This was on a machine without RAID in which I had attached the drive via a USB enclosure. I assume it would work even if the md device numbers were not the same as the original drive but I did not test that. I had thought there was a way to do this more easily but the scan option seems to only check the config file, which of course is not helpful in these situations at all.




Recent comments
1 day 21 hours ago
11 weeks 1 day ago
11 weeks 1 day ago
13 weeks 1 day ago
16 weeks 3 days ago
17 weeks 5 hours ago
18 weeks 3 days ago
22 weeks 2 days ago
22 weeks 2 days ago
23 weeks 22 hours ago