Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [45]

By Root 1451 0
cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid5]

read_ahead not set

unused devices:

This /proc/mdstat indicates that support for linear mode RAID devices, as well as RAID-0, RAID-1, and RAID-4/5, is compiled into the running kernel. There are currently no active arrays. When there are active arrays, information about each one is reported by /proc/mdstat. In this example, there is an active RAID-1 with two member disks (/dev/sdb1 and /dev/sdc1) and one spare disk (/dev/sdd1):

# cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid5]

read_ahead 1024 sectors

md0 : active raid1 sdd1[2] sdc1[1] sdb1[0]

17920384 blocks [2/2] [UU]

unused devices:

/proc/mdstat is a read-only file that is used only to examine arrays and the RAID subsystem. Chapter 4 contains a detailed discussion of /proc/mdstat and other related parts of the /proc filesystem. The rest of this chapter provides more examples of how to use /proc/mdstat to make sure you are creating arrays properly.

Existing Arrays

If you have inherited a system that already uses software RAID, you need to decide whether you're going to continue maintaining that array or retire it and migrate the data to a new array (hardware or software). The rest of this chapter focuses on constructing new software arrays. If you plan to keep maintaining an array that already exists, read Chapter 4 and Chapter 7.

If you want to scrap an existing RAID, this section offers some advice that will help you dismantle the array. It's vital to keep in mind that reconfiguring an array or reusing its member disks in new arrays means that existing data will be lost. So it's very important to back up any data before proceeding.

* * *

Tip

In certain cases, it's possible to remove a member disk without losing data on an array. For example, removing an unused spare disk from a RAID-1 or RAID-5 will not cause data loss, although it might reduce fault tolerance.

* * *

If you plan to scrap all your existing arrays and use hardware RAID, skip straight to Chapter 5; the preparatory steps in this section do not apply to that situation.

Finally, if you are experimenting with various RAID levels and plan to reuse partitions that you have already included in another array, you might need to take some additional steps before building the new array. Remember that reusing these partitions means that the data on them will be destroyed, along with your array. Furthermore, you will not be able create a new array using partitions that are members of an array that is already running. So to reuse disks, you'll first have to stop any active arrays of which they are members.

Stopping an array

The raidstop command can be used to deactivate a running array created or started using raidtools:

# raidstop /dev/md0

Here's how to stop an array using mdadm:

# mdadm -S /dev/md0

If an array contains a mounted filesystem, both raidstop and mdadm will return an error. Filesystems should be unmounted using the umount command before they are stopped.

Once an array is stopped, its resources (member disks and md device special files) can be reclaimed and used in new arrays. If you attempt to use a member disk that is already part of a running array, mkraid and mdadm will generate errors on the command line, warning that the device is already part of an array. The md driver will also generate errors using syslog. Likewise, if you attempt to create an array using a device special file that is already in use, mkraid and mdadm will generate device busy errors, and the md driver will record them using syslog.

Reusing member disks

* * *

Warning

Some of the techniques used in this section can result in data loss or corruption if they are used improperly, or even if you make a simple typo at the command line. Please be extremely cautious when attempting them.

* * *

Whenever you attempt to create new array using mdadm or mkraid, 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

Return Main Page Previous Page Next Page

®Online Book Reader