Saturday, February 16, 2019

windows - Dual-booting RAID 1


I have three drives: two 1TB hard disks, one 120GB SSD. I want to install Ubuntu (preferably, but justified alternatives are fine) and Windows 7 on the SSD, and have them both read from the other two drives as a mirrored RAID pair (RAID-1). These drives do not need to be bootable, just accessible from both OSs (and properly mirrored on both.)


I've had a good look through my bios, and there's no support there, and I'd rather not go out and get a hardware card. Another SU post suggested just setting up the 1TB disks as mirrored volumes in Windows 7, and seemed to suggest that would just work, but Ubuntu ignores that completely, and seems to show the drives as independent disks, which happen to have the same thing on them, and that is not a good solution.


TL;DR: Does anybody know how to set up software RAID-1 data disks that work from both Windows 7 and Ubuntu?


Answer



I found a solution in the end! Steps:



  • Install everything and get it working on the boot drive.

  • Go into Administrative Tools in windows, dig about a bit, and find the disk management section. From there, select one of the drives and set it up to mirror onto the other. It should demand that it become a dynamic disk; that's fine. It'll also probably want to format, that's fine too.

  • Go into linux and install mdadm.

  • From there, run 'mdadm --build /dev/md0 --level=1 --raid-devices=2 /dev/DRIVE1 /dev/DRIVE2', replacing DRIVE1 and DRIVE2 with the ids of partitions that windows has created.

  • Try and mount /dev/md0 somewhere, and make sure it works (will require NTFS drivers, but I think they're everywhere now anyway)

  • Rock out.


To do this at boot, you'll want to add the mdadm command to rc.local, or similar. Since this is NTFS you'll get partition issues, but you can mostly just ignore them. I'm just mounting the whole partition as my home directory, with uid=me,gid=me,umask=0077, and that's very usable.


Essentially with this you've built a RAID with no metadata on the relevant drives, they just happen to be in sync, and each of the OSs tries to keep them in sync as they go. This is not a perfect solution: Linux goes through both drives everytime you boot to check they match, which seems wasteful, and Windows likely does similar. Nonetheless, it does work, and if any drive ever fails (look up mdadm, there's lots of ways to tell, or even to get it to email you) you'll still have all your data, perfectly intact.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...