TechRepublic : A ZDNet Tech Community

Linux software RAID with mdadm

Tags: Storage, OPEN SOURCE, Vincent Danen, Linux software, RAID, RAID1, software RAID, Linux, Linux Tips Newsletter

  • Save
  • Print
  • Recommend
  • 12

Takeaway: Software RAID is an inexpensive way to create instant backups and protect your systems against data loss in the event that one drive fails. Learn some basic RAID management.

Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

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 \
/dev/hda1 /dev/hdc1

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[0] hdc1[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/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.

  • Save
  • Print
  • Recommend
  • 12

What do you think?

White Papers, Webcasts, and Downloads

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

SmartPlanet

Click Here