[Scottish] Software RAID & LVM

Colin McKinnon scottish at mailman.lug.org.uk
Sun Jun 15 22:42:01 2003


On Sunday 15 June 2003 14:00, Craig Perry wrote:

> It will have 2x 60Gb and 1x4Gb drive to begin with, but this will be
> extended at a later date as needs increase/cash flow starts flowing again.
> I will add PCI IDE controllers to accomodate the extra drives. The 4Gb
> drive will have probably linux (possibly jumping ship to freebsd), and i
> want to set the other two up in some form of LVM/software RAID setup.
>
Jings, how much porn does one person need on their home server?

But seriously....

LVM was originally designed to allow very big filesystems to be built using 
small drives. There was no load balancing / redundancy. HP then built their 
software RAID solutions on top of LVM.

You don't need LVM to do RAID on Linux. Indeed, having looked after HPUX boxes 
for some years I'd stay away from it altogether:
1) it makes life more complicated than it has to be
2) If you do build disk spanning partitions using LVM then suddenly your 
backed into running a system which is not easily migrated to smaller 
partitions.
3) It makes your system more complicated than it has to be
4) backups / restores / replacing components is a lot simpler the more 
granular a system is - LVM doesn't just hide the granularity, it actually 
takes it away.

The only good things about LVM are it gives you the ability to take 'snapshot' 
backups (this is unlikely to be a priority for you, and anyway you can do 
this with software mirroring on Linux) and sometimes you do need very large 
filesystems (if you can find a DBMS which has large file support but no disk 
/ datafile spanning capability).

Read the excellent software RAID Howto. I'd also suggest you have a look at 
www.linux-ha.org since your main interest is in maintianing your data. 

You've said you want some redundancy - keeping the main drives mirrored but on 
seperate controllers will give you redundancy on the controllers as well as 
better throughput. 

If you already have a CDROM on this machine, I'd suggest you invest in an 
extra IDE controller and move the 4Gb and CDROM onto it (or the 60Gb drives 
if it is a higher spec than you MoBo adapter).

Take some time to think about how (if?) it will boot if hda goes down - do you 
need a boot floppy? If you need to edit the fstab how will you get access to 
it? How do you boot the root filesystem off a RAID device?

Starting with 2 disks mirroring is the obvious way to go, but where to next? 
If expect to extend the array, then your choice of level will have a lot of 
impact on what bits you need to add and how you go about integrating them. 
Note that you can mirror mirroed devices - so if you can comfortably backup 
120Gb, and know you'll be getting more disks soon, you might take a lyer and 
setup the current pair as a stripe set then, when money allows add another 
pair and mirror your existing stripe set on them. 

If, say you can divide the disks up into 10Gb chunks then you've got a lot 
more freedom to mix and match configurations without having to backup then 
restore *ALL* your data each time you make a change (e.g. mirroring for root 
filesystems, mirror+stripe on home directories, RAID 5 for data directories, 
swap and /var not on RAID and three way mirroring for GPG keys and x509 
certificates).

Have you got a backup solution / plan in place? If not, I'd make this more of 
a priority than building your array if your objective is data integrity - 
mirroring will write bad data to all disks! Even if you don't have the 
hardware in place to do backups - its worthwhile reading your entire 
filesystem regularly to highlight any bad blocks which may accumulate.
(tar --exclude=/etc/nobackup -cvf /dev/null / - or something like that).
 
Hope thats not all too obvious...

Colin