Create a RAID-1 (mirrored) array
/dev/md0 using two identical disks
/dev/sdc. The process of creating the array will go something like this:
- Partition the disks
- Use the partitioned disks to create the array
- Create a filesystem for the array
- Format the array
mdadmis already installed, make sure the service is currently running and active on boot.
Examining Arrays Using /proc/mdstat
/proc/mdstatwill provide information about the current state of RAID devices and the
Reusing the partitions on these disks also means destroying the data on them (along with the array). Whenever you attempt to create a new array using
mdadm, you will be warned about using member disks that already have a RAID superblock on them, even if they're not part of an array that's currently in use. You can suppress this prompt by using
mdadmto remove the RAID superblock from the disks that were part of an array. This command allows you to remove the superblock from more than one disk at a time:
Creating an Array
/dev/sdb1to Linux RAID (0xFD) so that it can be detected automatically at boot time:
wwrites the partition table to disk and exits.
Now do the same for
/dev/sdc. After that, use
mdadmto create a RAID-1 (mirrored) array:
Whenever a new mirror is created, resynchronization occurs. Check this by issuing the command
cat /proc/mdstat. Now create a filesystem for your new array:
/etc/mdadm/mdadm.conffile, but it will make managing arrays using
mdadmmuch easier. Let's start by looking at the output of
sudo mdadm --detail /dev/md0:
UUID. You should put the line
ARRAY /dev/md0 UUID=147987ca:fe805146:e6fc86f1:1ed7dbdbin your configuration file by doing
sudo gedit /etc/mdadm/mdadm.conf(make sure to hash any other
ARRAYlines corresponding to
/dev/md0). Next, let's create a mount point for the array:
/dev/md0 /media/joel/Linux auto defaults 0 0in your file systems table via the
sudo gedit /etc/fstabcommand. As a one-off, you should tell the kernel take a look at the system again to figure out how to boot properly:
After rebooting, don't forget to format the array, or you won't be able to use it.
ReferencesVadala, Derek. Managing RAID on Linux. Sebastopol: O'Reilly Media, 2002.
Leurs, Laurens. "RAID level 1 – Mirroring." Prepressure.com.
"Advantages / Disadvantages of RAID 0 vs. RAID 1." M-Tech Laptops.