simple RAID setup
Daniel Sobey
dns at dns.id.au
Sun Jan 6 23:18:04 UTC 2013
Sorry for the late reply, hopefully the below will still be useful.
Some things that i would like to share from setting up raid on my own home
server.
For all drives in your machine:
Create a partition table.
Create a 1gb partition to be used for software raid containing your /boot
partition.
For EFI based systems you may also need a efi boot partition, just create
it and copy the contents to the other drives after installation.
Create a partition for software raid / btrfs volume that uses the rest of
the drive.
Create a raid 1 containing all your drives.
This will make a 1gb raid disk, mount this as /boot and format it with
ext2/3
raid 1 copies the same data to all drives, so adding more drives does not
give you more space but more redundancy.
This is an advantage for /boot as you want to be able to boot from any
drive so if your first drive fails it will still continue.
You need to change the debconf priority when you get to the installing raid
to the highest so it will ask you where to install grub, choose to install
grub on all drives.
if you have already installed your os run: dpkg-reconfigure grub-pc and
select all drives.
What you do with the rest of your storage is up to you.
Things to consider are:
how many drives do you have?
You need at least 3 for raid 5, 4 for raid 10
are they all the same size?
You will be limited to the size of the smallest drive with raid.
Btrfs / zfs can work with different sized drives as long as there is enough
capacity in the system for the desired redundancy.
ie you have 3x1gb drives and a 3gb drive, you can set up a virtual raid 1
and it will give you 3gb of redundant storage.
are they all (roughly) the same speed?
If you use btrfs instead of raid this can take advantage of faster disks or
ssd's to have more frequently used files read faster.
What raid level do you want to use?
raid 0 - no redundancy, good performance, avoid this if you loose 1 drive
you loose everything.
raid 1 - You have redundancy but you use 1 drive for that redundancy.
raid 5 - You take advantage better advantage of the disks you have but your
write performance sucks.
raid 10 - You get good performance and redundancy but it becomes expensive
to get disks.
btrfs / zfs - This can be used in a similar way to software raid and lvm.
It has sub volumes giving options on how you use your storage.
I would recommend creating a raid 10 and putting lvm over the top.
If possible do not allocate all your storage to allow you to change your
mind later.
Having spare space also allows you to take lvm snapshots, these could be
used for testing.
The XFS file system is a better choice for large files than ext3/4, if you
are storing things like virtual machine disk images use xfs.
For smaller files such as photo's ext3 / ext4 is a good choice but it does
not matter as much.
Monitoring your raid:
---------------------
once you have your raid set up keep an eye on it.
This is done with the virtual file /proc/mdstat
This will tell you if you have a degraded array and the status of the
rebuild
dns at apoc:~$ cat /proc/mdstat
Personalities : [raid10] [linear] [multipath] [raid0] [raid1] [raid6]
[raid5] [raid4]
md1 : active raid10 sdd1[1] sdb1[0] sde1[2] sdf1[3]
3907023872 blocks 64K chunks 2 near-copies [4/4] [UUUU]
md0 : active raid10 sdi[3] sdh[2] sda[1] sdc[0]
3907028992 blocks 64K chunks 2 near-copies [4/4] [UUUU]
unused devices: <none>
The config file for software raid is /etc/madm.conf and using the tool mdadm
See http://en.wikipedia.org/wiki/Mdadm for commands.
Replacing a failed drive:
-------------------------
If one of your drives fails you can add a replacement with mdadm --add md0
/dev/sdb1
Another thing to consider is writing the serial number of the drive down
and having this list stuck to the side of the machine.
When your drive fails you do not know what drive is at fault you know what
to replace.
You can find the serial number printed on the disk, you can usually see
this information in the bios configuration screen as well.
you can find the serial number under linux with smartctl.
dns at apoc:~$ sudo smartctl --all /dev/sda
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-35-generic] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Caviar Green
Device Model: WDC WD20EADS-00R6B0
Serial Number: WD-WCAVY0815050
So when the disk fails, run smartctl on the remaining disks to work out
what disk is dead.
Create the same partition layout as before, a 1gb for your /boot and the
rest for raid storage.
Add the 1gb to the raid 1 array and wait for it to synchronise, it should
automatically balance across the new drive, there are commands you can use
to force it to balance.
Add the second partition to the other array and wait for it to balance.
run$ dpkg-reconfigure grub-pc to reconfigure grub and install grub on
all drives.
Hope this gives you some ideas.
Regards,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-au/attachments/20130107/5237abef/attachment.html>
More information about the ubuntu-au
mailing list