Software RAID on Linux is a snap
Trang 1Software 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/md0O level=1 raid-devices=2 \
/dev/hdal /dev/hdcl
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 : [|[raldl]
read ahead 1024 sectors
mdQ : active raidl hdal[0] hdc1l [1]
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/md0O
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/hdcl from appearing in the /dev/mdoO array:
Trang 2# mdadm /dev/md0O -r /dev/hdcl
You can also add the device back into the array Here's how:
# mdadm /dev/mdO -a /dev/hdcl