This is a disclaimer: Using the notes below is dangerous for both your sanity and peace of mind. If you still want to read them beware of the fact that they may be "not even wrong". Everything I write in there is just a mnemonic device to give me a chance to fix things I badly broke because I'm bloody stupid and think I can tinker with stuff that is way above my head and go away with it. It reminds me of Gandalf's warning: "Perilous to all of us are the devices of an art deeper than we ourselves possess." Moreover, a lot of it I blatantly stole on the net from other obviously cleverer persons than me -- not very hard. Forgive me. My bad. Please consider it and go away. You have been warned!
HowTo activate a Linux Raid Mirror —aka a RAID1
Convention: the system’s command line prompt below is represented by >.
Yours might be different.
It is assumed, through the use of ‘sudo’, that you have been given privileges to use some of the commands below as some require root access.
Finally, this recipe suppose that a RAID1 volume has already been configured with its disk components and that it is is an healthy state even though it is not active.
Alright, let’s roll!
1) Prior to doing anything, ALWAYS check the status of the disks array with:
> cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
[multipath]
unused devices: <none>
There is nothing to be seen. The system is not aware of any array.
2) Make the mirror available by forcing a system scan with:
> sudo /sbin/mdadm --assemble --scan
mdadm: /dev/md/1 has been started with 2 drives.
/dev/md/1 is actually a link to the real raid device, /dev/md1:
> ls -l /dev/md/1
lrwxrwxrwx 1 root root 6 Aug 20 12:52 /dev/md/1 -> ../md1
3) Check the status of the array using as in 1):
> cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
[multipath]
md1 : active (auto-read-only) raid1 sdc1[0] sdb1[1]
1953512312 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Look at the line starting with md1.
You see that there is an active device md1 in a raid1 (mirror) configuration
built from 2 disks partitions, sdc1[0] sdb1[1]. The [UU] thing tells you that
there are ‘UP’, ie it’s fine. If you see [U_] or [_U] then something is
wrong and one part of the mirror is broken. Contact us immediately.
4) Mount the array:
> sudo /bin/mount /dev/md1
5) check that it is really there:
> df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 36G 14G 20G 41% /
tmpfs 4.0G 0 4.0G 0% /lib/init/rw
udev 4.0G 264K 4.0G 1% /dev
tmpfs 4.0G 2.4M 4.0G 1% /dev/shm
/dev/sda1 248M 49M 187M 21% /boot
/dev/sda9 1.8T 1.5T 231G 87% /export01
/dev/sda6 12G 130M 11G 2% /tmp
/dev/sda8 3.9G 11M 3.7G 1% /var/tmp
/dev/md1 1.9T 561G 1.3T 31% /media/md1
/media/md1 is where you can access your data, ie, the mount point.
6) Once you’re done with it, FIRST, un-mount it with:
> sudo /bin/umount /dev/md1
7) Then BEFORE physically removing the drives, you MUST stop the array:
> sudo /sbin/mdadm --stop /dev/md1
8) Check that all iѕ good:
> cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5]
[raid4] [multipath]
unused devices: <none>
All gone. You can now safely remove the drives from the docks.
Note that I used /dev/md1 in the above. It’s possible that another device will
be reported, like /dev/md0. Just substitute md1 → md0 in all the commands
above. This is why it is important to always check the array status with cat /proc/mdstat
BEFORE and AFTER each command to know the device name and status.
Do the same substitution for the mount/umount command. In all these commands
except the cat /proc/mdstat you HAVE to use sudo. Not doing so will give
you an error like:
> /sbin/mdadm --assemble --scan
mdadm: must be super-user to perform this action
You can also add the option ‘-v’ to the mount/umount commands to have a more verbose output.
