[CentOS] RAID help

Tue Dec 14 18:53:45 UTC 2010
Paul Heinlein <heinlein at madboa.com>

On Tue, 14 Dec 2010, Jason T. Slack-Moehrle wrote:

> Hi All,
>
> I have a new system with 2 Seagate 1TB SATA Enterprise level drives 
> in it.
>
> I want to RAID1 (mirror) these drives. <snip/>
>
> So if I simplify, I must:
> 1. Create a software raid partition on each drive
> 2. Create a RAID 1 out of that partition and use a mount point of /boot
>
> 3. Create other mount points I might want i.e swap, /home, etc
> 4. Create RAID1 out of these partitions
>
> 5. rinse and repeat this for each mount point I want
>
> A few questions:
>
> 1. This system support 16gb of RAM. I have 9gb in it, but I will max
>    it out over the next few months as I find great deals on RAM,
>    what should my SWAP space be? I recall a long while ago that SWAP
>    should match physical RAM.
>
> 2. Any reason I can't just create a single mount point taking up the
>    entire drive and RAID1 the entire thing? Can anyone recommend
>    some ideal mount points and sizes?
>
> 3. What should I account for if my /var/www/html will be very large?

If you have time to experiment a bit, I'd highly suggest encapsulating 
your RAID design in a kickstart file. You'll need to do some up-front 
work to get it ready, but once it's done you can re-do your 
arrangement easily (and repeat as necessary). Here's a sample (that 
requires two identical drives):

# disk work
bootloader --location=mbr
clearpart --all --initlabel
part raid.01 --size=300    --ondisk=hda --asprimary
part raid.02 --size=300    --ondisk=hdb --asprimary
part raid.11 --size=1024   --ondisk=hda --asprimary
part raid.12 --size=1024   --ondisk=hdb --asprimary
part raid.21 --size=20000  --ondisk=hda --asprimary
part raid.22 --size=20000  --ondisk=hdb --asprimary
part raid.31 --size=1      --ondisk=hda --asprimary --grow
part raid.32 --size=1      --ondisk=hdb --asprimary --grow
# mirrored mountpoints
raid /boot --fstype ext3 --level=RAID1 --device=md0 raid.01 raid.02
raid swap  --fstype swap --level=RAID1 --device=md1 raid.11 raid.12
raid /     --fstype ext3 --level=RAID1 --device=md2 raid.21 raid.22
raid /srv  --fstype ext3 --level=RAID1 --device=md3 raid.31 raid.32

There are many, many ways to alter this setup (e.g., using LVM, using 
a different set of mount points, not relying on primary partitions).

The reason that /srv gets the lion's share of the disk is that I try 
to differentiate between files

  * created/maintained by running processes (e.g., MySQL)
  * installed by RPM (e.g., /var/www/error)

both of which belong in /var, and

  * data created elsewhere and "fed" to a process (e.g., your
    video files or HTML pages)

which goes into /srv.

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/