[Sussex] Mixing SCSI, IDE and RAID with LVM

Mike mike at semantico.com
Tue Jul 3 08:32:21 UTC 2007


I would avoid software RAID5 on the three 80GB drives, especially if you 
don't trust them.

The problem with it is that when you eventually have a drive marked 
failed (which will happen if a bad block is discovered), you will be in 
a very high risk state until the failed drive is replaced. The really 
ugly problem is that when you replace the failed disk, you run a high 
risk of finding a bad block on one of the other two drives, which will 
mark that as failed and then crap out your entire raid5 array.

This has happened to me three times. I have since stopped using Linux raid5.

It also has rubbish database performance.

Another problem is that (i'm assuming) the 80GB drives are IDE - you 
would be putting two of the drives on the same IDE channel, which is 
also a big no for RAID (and performance).

I would recommend that you create a RAID1 mirror with two of the 80GB's, 
one on the primary IDE channel and the other on the secondary. Keep the 
other 80GB to one side in case of a failure of one of the others.

If you have a spare IDE card, there's no reason why you couldn't put the 
third 80GB on that and create a 3 disk RAID1 mirror - much more reliable 
than a 2 disk one, and also you should get better read performance.

If server reliability is not an issue, then put your /tmp and swap areas 
on the 9GB SCSI drive - having them logically separate from the other 
disks will help performance if you are swapping, and there's no need to 
RAID them if you don't care about a a disk crash knocking out your 
machine, just your data. If you are not putting the machine on a UPS, 
then there's not much point putting your swap on RAID, in other words.

For the LVM layer, I would recommend creating a VG for each of your 
'disk groups': One for your RAID group, another for the 9GB SCSI. This 
will prevent you accidentally extending an LV onto the non-raid disk.


Another point of note is whether you want to have /boot and / on LVM. 
This is acceptable, but personally I don't trust it completely - i've 
been bitten with LVM before, so I prefer to have them outside of it - 
I'm sure others will disagree, and one day I hope my mind changes about it.

Here's how I would set up your box:

Partition /dev/hda, /dev/hdb:   
    1 = 200MB - /boot, Linux RAID type
    2 = 8GB - /root, Linux RAID type
    3 = rest  - Linux RAID type

Partition /dev/sda
   1  = rest - Linux LVM type

Create three RAID1 MD devices:
   md0 = raid1, /dev/hda1 + /dev/hdb1
   md1 = raid1, /dev/hda2 + /dev/hdb2
   md2 = raid1, /dev/hda3 + /dev/hdb3

Mount /dev/md0 as /boot (ext3)
Mount /dev/md1 as / (ext3)

pvcreate /dev/md2
pvcreate /dev/sda1

vgcreate /dev/vg_raid /dev/md2
vgcreate /dev/vg_tmp /dev/sda1

lvcreate -n lv_var -L 8g /dev/vg_raid
lvcreate -n lv_mysql -L {size-you-need} /dev/vg_raid

lvcreate -n lv_tmp -L 2g /dev/vg_tmp

... and so on.

With sizing and creating LV's, I work on the principle of separating 
logical areas of the filesystem - so create an LV for /var, /tmp, 
/var/lib/mysql, /var/www/, and so on. I start small (1-8GB) and grow 
them as needed.

I use ext3 on RHEL4/CentOS4, and reiserfs on Debian Sarge/Etch for the 
filesystems - both can be grown reliably online (no need to unmount) 
with 'ext2online' and 'resize_reiserfs' respectively.


Hope this helps,

mike




Diego Moore wrote:
> Hi all,
>
> I'm not too hot with how LVM works but it seems useful and I want to
> replace my old home server with some spares I have lying around:
>
> 9Gb SCSI drive
> 3x identical 80Gb drives.
>
> As the drives are over 3 years old and I just don't trust them! So the
> idea to to have a RAID5 setup... but where would LVM and the SCSI
> drive fit with this?
>
> I've read that I might just as well have the swap partition on the
> RAID as if I don't one failure could bring the server down, but
> Ideally I would like to use the performance of the SCSI drive (boot,
> apache, mysql, etc)...
>
> So my question is how do I arrange this so that I get the flexibility
> of being able to grow the partitions at a later stage with LVM?
>
> Many thanks...
> DM
>
> __ Sussex mailing list
> Sussex at mailman.lug.org.uk
> E-mail Address: sussex at mailman.lug.org.uk
> Sussex LUG Website: http://www.sussex.lug.org.uk/
> https://mailman.lug.org.uk/mailman/listinfo/sussex




More information about the Sussex mailing list