Couple Raid10/LVM Questions for TC and the other Raid Experts.

Forum: LinuxTotal Replies: 1
Author Content
techiem2

Apr 30, 2009
4:21 PM EDT
So I'm preparing for my file server upgrade (waiting for the molex->sata cables to arrive that I forgot to order with the drives...) and I've been reading over TC's Raid10 articles from last year and have a couple questions.

For reference here's the articles: http://www.linuxplanet.com/linuxplanet/tutorials/6514/1/ http://www.linuxplanet.com/linuxplanet/tutorials/6518/1/

First off, the base system is on a plain old non-raid disk, so I don't have to think about that (for now, though it would be a good idea to raid that eventually).

This array will be purely for data storage (I haven't decided if it will be broken up into multiple mountpoints or not yet).

Second, my plan is to start off with these 2 320GB disks, then eventually add 2 more 320GB, maybe upgrade to bigger ones later, etc.

So, I notice that when TC creates the RAID10 array, she initially has only 2 disks in it. I assume that in this case it will act simply as a mirror? What happens when the third disk is added? The Fourth? I'm trying to understand how the mirroring and striping work as you add disks.

What about adding larger disks? Or replacing existing disks with larger ones one at a time (like say I had the 2 disks, then wanted to replace one of them with a nice fat 1TB disk)?

I see that LVM was used on top of the array. If I understand right (I haven't actually messed with LVM yet), this means that your volumes could be expanded as you add more space to the array? How would you go about this?

Thanks guys/gals! Eventually I'll understand all this RAID/LVM stuff. :P
caitlyn

Apr 30, 2009
6:47 PM EDT
The main advantage of RAID10 over RAID5 is that you are mirroring everything. For every byte of original you have a byte of duplicate copy. The reliability of mirroring this way is superior to RAID5 and recovery is much faster. The advantage over pure mirroring is that you are still striping across multiple drives.

The disadvantage compared to pure 1:1 mirroring where you don't stripe across physical volumes is that you can't just break the mirror and drop the copy in as a replacement for the original. The disadvantage compared to RAID5 is that you use more storage. In a large array this can add substantial cost.

RAID5 striping allows you to continue to work even if a physical drive fails but it has to recover the data to rebuild what has been lost. Since this isn't a 1:1 copy RAID5 requires more overhead during the rebuild process so it is much slower at recovering. The system does keep working during RAID5 recovery, BTW, so downtime should be zero, but the system can become painfully slow.

In your proposed initial setup with just two identical drives you could just do pure mirroring. Carla doesn't start with two physical volumes in her article. She starts with four. She sets up two arrays. For the root filesystem she uses a pure mirror, or RAID1. This is actually what I generally recommend as a failure in the root filesystem can be repaired by just breaking the mirror and rebooting off the mirrored drive. That's a super fast recovery. If you just are going to have two indentical drives you really don't need or want RAID10. You want RAID1. That gives you maximum reliability and redundancy with minimal overhead. When you add an additional two drives you can create a second array exactly as Carla did and make it RAID10. Then segregate the OS/apps (system partition) on RAID1 from everything else on the new RAID10 array.

The advantage of setting up RAID10 as Carla did in the article is that the original and copy aren't each one separate identical physical drive. She uses her second array, also just two drives, for everything except the OS. Note that she is also using dissimilar drives, one IDE and one SCSI. We don't know if they are the same size or not and we don't really care. Since she's striping she has to allocate 50% of her space to the mirror but not necessarily a physical drive. You'll use mdadm when you add additional drives to assign them to an existing RAID10 array.

What LVM does is allow you to parse the space any which way you want. The concepts I think you are looking for are physical volumes, volume groups, and logical volumes. LVM is actually the last step and the last piece of the puzzle. Carla covers this very well in her articles. You initialize a physical volume, assign it to a volume group, and use LVM to carve it up into logical volumes. So long as you have extra space somewhere assigned to the volume group you are concerned about you can use LVM to tack it on to an existing logical volume, effectively increasing the storage available to that volume. You can also use LVM to shrink a logical volume that has extra space and then use the created free space in a logical volume that needs it.

If the space you need isn't available in the volume group in which your logical volume lives you can use the lvreduce and vgreduce command to remove space from a logical volume in a different volume group and then use the vgextend command to increase the size of the volume group and then add the space to the logical volume.

You asked about adding a larger drive to replace a smaller one. To do this on a live system you will need to fail the smaller drive. You do this with mdadm. Note that this is at the physical drive level, not at the higher level where the logical volumes live. Regardless of whether you have RAID 10 or RAID 5 the system will then begin rebuilding the array. You need to let that happen. You can remove the failed drive, install the bigger drive, and then use mdadm to make the new drive part of the array. Then rebuilding starts all over again. Once that's done you can extend any existing volume group or add a new one to take advantage of the additional space. Only then can you use lvextend to tack that extra storage onto an existing logical volume.

You asked about what happens in a RAID 10 array as you add drives. Basically nothing happens until you make it happen with mdadm, pvcreate, and then either vgcreate or vgextend. Fifty percent of your space is for the mirror and fifty percent is for the original data. Since you're striping and you're using Linux you don't need exactly matched drives. The point, I guess, is that you can't just drop a new drive in and expect things to get configured automagically. It's a manual process.

I'm sure this is becoming as clear as mud. Hopefully I've clarified some things. If you come back with specific questions I can give you specific commands and go beyond what Carla wrote if you want.

You cannot post until you login.