Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two identical drives that I intend to mirror in in the interest of data safety. These are data-only drives, not a primary OS drive.

In such a system, is it better to create single partition (Linux raid auto: type 0xfd) on each drive and raid together the partition from each drive (e.g. /dev/sdb1 and /dev/sdc1)? Or should I instead create a mirrored array of the unpartitioned drives directly (e.g. /dev/sdb and /dev/sdc)?

Ultimately I intend to create an LVM container from the resultant array for storing the actual data. Are there any considerations that might make one or the other option safer or more desireable down the road?

share|improve this question

2 Answers 2

If you're going to create a mirrored array, you'll use mdadm first to create the mirror, then set up a logical volume to create your physical volume, volume group, and logical volumes. Then, lay a filesystem on top. While this example is in a Kickstart context, it will still illustrate the order of operations:

  • Create the physical partitions to mirror. The example puts five partitions on each of two physical devices, but you can just lay down a single partition on each disk.

  • The "raid pv.01" line uses two partitions to create a mirror pair to use as an LVM physical volume.

  • The remaining lines (volgroup, logvol) create the volume group and logical volumes.

So, how would you do this on a running system? Well, if you're talking about your root and related filesystems, you probably shouldn't. Mirroring those filesystems should really be done at installation time. Otherwise, for running systems:

  1. Start with fdisk or parted (my preference) to create the physical disk partitions.

  2. Then, mirror those partitions as described here. Here is more information on mdadm.

  3. Finally, use the Logical Volume Manager to put a physical volume on that new mirror-pair, create a volume group, and create logical volumes to use for your filesystems.

Good luck!

share|improve this answer
    
A well written answer, but not actually answering the OP's question. :) –  Daniel Lawson Nov 15 '12 at 1:27

No, there is no fundamental reason why you should create a single, full-disk partition on each member drive as opposed to using it unpartitioned. I use this method all the time, and haven't seen any issues.

The only likely issues are going to documentation/social issues. If the array breaks for some reason and some other admin is trying to recover it, and they assume you partitioned each drive first and can't find the partitions, they might assume the data is totally lost.

Of course, this is somewhat trivially avoided because md's metadata is still there, so if they do a scan with mdadm they should still be able to find it.

share|improve this answer
1  
in-kernel autodetect would not work unless you have partitions. Aside from that, it mainly is a matter of preference. I always would create partitions even if I am the only person administering the disk - this way the disk would self-document its membership in an mdraid array and the operator would not have to guess, even if the drive has been pulled a while ago and there is no one who can remember its origin or purpose any more. –  the-wabbit Nov 15 '12 at 2:18
    
@syneticon-dj if you have an answer, why not put it as a stand-alone answer instead of as a comment to someone else's answer? –  tylerl Nov 15 '12 at 2:55
    
@tylerl because technically, Daniel's answer is mostly correct - except that he did not mention the autodetect issue. Since "in-kernel autodetect is not recommended for new installations" (mdadm docs), it is just a minor detail to add. As would be our disagreement on the aspect whether partitioning is adviseable or not. –  the-wabbit Nov 15 '12 at 8:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.