I have set up a RAID-6 on my Linux host using four, 2TB drives. I've also copied about 1.8TB of data to the RAID and it has been a live production NAS device on the office LAN for the past 32 hours.
I followed the well written and extensive instructions at https://raid.wiki.kernel.org/index.php/RAID_setup
. However, while this wiki drills down into mind numbing benchmark stats and numerous esoteric configuration options, it doesn't actually give the fundamental, straightforward HOWTO on starting and stopping the RAID at boot and shutdown time.
Here's what I've done so far:
mdadm --create /dev/md0 --metadata 1.2 --verbose --level=6 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
mke2fs -v -m .1 -b 4096 -E stride=128,stripe-width=38
mdadm --assemble --scan --uuid=39edeb69:297e340f:0
In /etc/fstab I have the following entry, and I have mounted the RAID via `mount /mnt/RAID`:
/dev/md0 /mnt/RAID ext2 defaults,uid=99,gid=99,uma
ask=0771 1 1
How do I start this at boot time? As configured, the fstab entry will automatically mount the /dev/md0 device, but I've gleaned from the docs that the RAID has to be "assembled" each time it is started (and perhaps "assemble" is a synonym for "start"?). I've created a boot script as:
/sbin/mdadm --assemble --scan --uuid=39edeb69:297e340f:0
which will run at boot time. Is this correct? If so, is this sufficient? Should I do this step before or after the device is mounted? I don't remember whether I did the mdadm --assemble or mount first when I did all the by-hand (that was 3 days ago). If I should "assemble" first, then I'll change the fstab entry to 'noauto' and have the startup script mount after assembling
What about shutdown? I can put the command `/sbin/mdadm --stop /dev/md0` into a shutdown script, but the same question about the mount: should I unmount /dev/md0 before doing the "stop", or just do the stop and let the system handle the unmount? It seems to me the unmounts happen after all shutdown scripts have been run, so does stopping the RAID device before the unmount mess up the flush?
This is relatively urgent because I am very reluctant to shut down this computer right now. I am worried that 3 days work of data copying might be corrupted or lost.
PLEASE ADVISE! THX.