This is version 0.31.0 of the MD list of frequently asked questions (FAQ). This FAQ accompanies version 0.31 of the MD software and was last revised on August 29, 1995. MD is the Multi-Device disk driver for the Linux kernel. This driver provides RAID support in software as well as a linear mode of joining 2 or more disks into a single logical device that can be formatted as a single file system. MD was written by Marc Zyngier. Marc can be reached at zyngier@amertume.ufr-info-p7.ibp.fr. The package for md is available at ftp://sweet-smoke.ufr-info-p7.ibp.fr/public/Linux. This directory is mirrored in the USA at ftp://linux.nrao.edu/pub/linux/packages/MD-driver. The mailing list for MD is linux-raid@vger.rutgers.edu. Send a message to Majordomo@vger.rutgers.edu with a line in the body of the form "subscribe linux-raid", you can optionally add your email address to the line if that is not the same as your return email path. The subject line will be ignored. [FAQ related issues should be sent to me] This FAQ is maintained by Constantine Rasmussen at cdr@star.net. Please feel free to contact me about any mis-information, bad grammar or omissions. List of Questions 1: Device mdadd was successful but all accesses fail. 2: Df and /proc/mdstat don't show the same device size. 3: Is MD RAID0 really slow? 4: Why does the command "mdstop /dev/md0" say the device is busy? 5: How does the chunk size influence the speed of my raid device? 6: I always let the driver use the default chunk size. In what situations is this less than optimal? 7: Does the chunk size tuning parameter apply to linear mode? 8: How does MD handles a situation where you have say a 50MB drive, a 100MB and a 150MB under RAID0? After you put 150 MB on, the the 50MB drive would be full, the 100 would be half full, and so on, what does MD do? 9: When I compile mdadd.c, the compiler find Questions & Answers 1: Device mdadd was successful but all accesses fail. When I access /dev/md0, the kernel spits out a lot of errors like 'md0: device not running, giving up !' and 'I/O error...'. I've successfully added my devices to the virtual device. A: To be usable, the device must be running. Use mdrun -px /dev/md0 where x is l for linear, 0 for raid-0 or 1 for raid-1, or even better, create a mdtab and do a mdadd -ar. -- 2: Df and /proc/mdstat don't show the same device size. I've created a linear md-dev with 2 devices. /proc/mdstat shows the total size of the device, but df only shows the size of the first physical device. A: You must mkfs your new md-dev before using it the first time, so the fs will cover the whole device. For the ext2 filesystem use mke2fs instead of mkfs. But you already knew that, right? -- 3: Is MD RAID0 really slow? I've created a raid0 device on /dev/sda2 and /dev/sda3. The device is a lot slower than a single partition. Is md a real dog? A: To have a raid0 device running a full speed, you must have partitions from physically different disks. You can also tune the chunk size to find the best performance. -- 4: Why does the command "mdstop /dev/md0" say the device is busy? A: There's a process that keeps a file descriptor on /dev/md0, or /dev/md0 is still mounted. Terminate the process or umount /dev/md0. If its a swap partition, you'll have to run swap-off. The rule of thumb is: if you can umount the device then you can run mdstop successfully. -- 5: How does the chunk size influence the speed of my raid device ? A: The chunk size is the amount of data contiguous on the virtual device that is also contiguous on the physical device. Depending on your workload, the best is to let the chunk size match the size of the requests that the kernel uses to write to the physical device. This way two requests will probably be written to different disks and therefore be run at the same time. This assumes a lot of testing with different chunk sizes to match the average request size, and to get the best performance. -- 6: I always let the driver use the default chunk size. In what situations is this less than optimal? A: The default chunk size is rather good for swap, since it is the size of a page. All other settings MUST be tested, since it depends on the size of the requests accessing the virtual device. -- 7: Does the chunk size tuning parameter apply to linear mode? A: Chunk size doesn't apply to linear mode. -- 8: How does MD handles a situation where you have say a 50MB drive, a 100MB and a 150MB under RAID0? After you put 150 MB on, the the 50MB drive would be full, the 100 would be half full, and so on, what does MD do? A: Here's how md handles such a situation under raid0: Lets call D0 the 50MB disk, D1 the 100MB disk and D2 the 150MB disk. When you start the device, the driver calculates 'strip zones'. In this case, it finds 3 zones, defined like this: Z0 : (D0/D1/D2) size 150MB Z1 : (D1/D2) size 100MB Z2 : (D2) size 50MB You can see that the total size of the zones is the size of the virtual device, but, depending on the zone, the striping is different. Z2 is rather inefficient, since there's only one disk. This adds overhead to the kernel only when you start the device, but from then on there is no additional cost. The benefit of all this is that you can handle multiple disk sizes on the same virtual device. A lot of commercial products cannot handle such a case, see HPUX SDS, for example. -- 9: When I compile mdadd.c, the compiler find A: This file is created by the makefile in the kernel source directory, /usr/src/linux, when "make config" is run. Before it can generate the correct autoconf.h file you must patch the kernel sources with the md patch file. [sentinel line marking the end of the faq]