Software RAID on Linux is a snap, thanks to the mdadm tool that comes with most modern Linux distributions. Software RAID, particularly RAID1, is an inexpensive way to create instant backups and protect your systems against data loss in the event that one drive fails.
To create a RAID device, execute the following command:
# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 \
There are two ways to obtain information about the RAID array. You can query the device with mdadm, which provides detailed information on a particular device, or you can get an overview of the entire RAID system by looking at /proc/mdstat directly. For example:
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 hda1 hdc1
56261376 blocks [2/2] [UU]
Here you can see that the personality is RAID1, the device /dev/md0 is active, and both disks are active (noted by [UU]). To obtain more detailed information about this device, use the following command:
# mdadm --detail /dev/md0
This will print out a variety of information about the device, including when it was created, its size, and the time it was last updated.
If you want to change drives, you can remove a device from the array. This command will prevent the partition /dev/hdc1 from appearing in the /dev/md0 array:
# mdadm /dev/md0 -r /dev/hdc1
You can also add the device back into the array. Here's how:
# mdadm /dev/md0 -a /dev/hdc1
While RAID management can be extremely complex, simple drive mirroring (like this RAID1 setup) is fairly easy. In addition, it offers a more flexible and cost-effective backup solution than expensive tape or removable media solutions. This information is useful for determining what programs are listening for connections. It also allows you to see what outbound and inbound connections are currently established on the system.