Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [47]

By Root 1339 0
specifies how many blocks to advance (also using the 1 KB block size) in the output file. Finally, count=4 tells dd to write only 4 blocks' worth of data to the output file.

* * *

dd performs a seek to block 17920384 of /dev/sdb1 (using a 1 KB block size) and then writes null bytes (/dev/zero) into each location for the next four blocks.

Repeat this process for each old member disk that you wish to reuse. If you're experimenting, it might be useful to create a shell script to help automate this process.

mdadm also provides a mechanism, --zero-superblock, that allows you to remove the RAID superblock from disks that were part of an array. mdadm allows you to remove the superblock from more than one disk at a time:

# mdadm --zero-superblock /dev/sd{b,c}1

Now when you create a new array, you will not be prompted for additional confirmation before the new array is created. It might seem that going through these steps is more complicated and time-consuming than simply confirming the additional warning messages produced by mkraid and mdadm. This is undeniably true for mdadm, but remember that mkraid forces you to wait an additional five seconds before creating the array. Also, there are other times when it is desirable to remove unwanted RAID superblocks. For example, it's a good idea to remove the RAID superblock from any disk that's no longer part of an array. After all, you don't want the kernel to inadvertently start an array you are no longer using or consider a disk that should no longer be part of any array, especially when that might mean vital arrays cannot be built because their disks are already in use.

Creating an Array

Now that the kernel supports RAID and you have the required utilities, it's time to partition disks and create arrays. At this point, all disks that you plan to include in an array should be connected to the system. Remember that each array can contain a maximum of MD_SB_DISK, as defined by the kernel. By default, that maximum is 27, but since arrays can also act as member disks, this limit is avoidable. In addition, a maximum of 256 software RAID devices are available for use.

Partitioning with fdisk

You don't need to partition disks before using them in an array, but partitioning does provide a couple of advantages. First, partitioning is necessary if you want the kernel to automatically start arrays, because the md driver uses the partition type to identify member disks. Second, md devices don't support partitioning directly, but in some cases, having a filesystem that spans an entire array is undesirable. Using software RAID for system partitions means that smaller partitions are necessary. After all, you don't want /var or /boot to span a whole array.

* * *

Warning

If you have a lot of disks, then you might not want to go through the trouble of partitioning each disk—a process that can take a lot of time if you have more than a few drives. In that case, you can simply use a whole, unpartitioned disk as an array member (/dev/sda, for example). This means that you won't be able to autostart arrays, however, so you'll have to include commands to start md devices in your system initialization scripts.

* * *

The rest of this chapter assumes that disk-sized partitions are used, but unless you want to subpartition or need to automatically start arrays, you can skip the rest of this section. Replace the use of partitioned disks found in the examples throughout the rest of this chapter with unpartitioned devices. Where I use /dev/sdb1 to denote a single disk-sized partition as an array member disk, you could simply use /dev/sdb.

The site http://cgi.cse.unsw.edu.au/~neilb/patches/linux/ contains patches that enable you to subpartition software arrays. The web page is indexed by kernel revision and patch name.

Use any standard partitioning utility to partition disks connected to your system. Since fdisk is generally available on all Linux systems, I'll discuss it here, but you can use whichever utility you prefer. The partitioning utility you choose doesn't need any special

Return Main Page Previous Page Next Page

®Online Book Reader