In the event I want to set up a RAID 1 mirror utilizing mdadm, is it needed to have a file system on the drives first? Reason I ask is my desktop which has RAID 1 (built from the alternate install CD) says both drives (via GParted) are EXT4, along with /dev/md0 which is the usable volume of course. I just set up my server, which is currently resyncing the drives now, but it too had a RAID 1 mirror. My drives were unformatted when I added them to the mdadm array via terminal. I had set them as unformatted + set the RAID flag via GParted on a LiveUSB session prior to starting the array build process.
That being said, I'm sitting here wondering - if mdadm basically clobbers the data on the HDDs during the rebuild process, how are my desktop RAID drives coming up as EXT4 when independently looked at? Likewise, does that mean my server will come up in GParted through a LiveUSB session as unformatted when I look at each drive independently since they were unformatted before I started? And lastly... does it matter?
Thanks!
No, the filesystem is not relevant before creating the array.
mdadm
does not "clobber" both drives, it just copies the contents of the primary to the secondary when mirroring. If the primary already had an ext4 filesystem in it, then it will still look like it does, and after the resync, so will the second. The new defaultmdadm
metadata format of 1.2 is stored 4k from the start, so it will have overwritten and damaged the filesystem that was there before. If you use format 1.0, which is stored at the end, then you can look at an individual disk and still use it without mdadm, though writing to it this way is a very bad idea because mdadm won't know what has changed if you put the drive back into the array.