I've played around for half a day now until the config finally worked for me - I will now try to recall my progress as good as possible.
1. The RAID
1.1 Preparations for the RAID
First of all, please make sure you have the basic packages already installed:
Use fdisk to create a partition with Type 83 (Linux). As we are going to setup LVM, I used to whole disk space for a single partition.
Disk /dev/sdb: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors/track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 30515 245111706 83 Linux
Create a partition of the same size on /dev/sdc (no matter if the device has a higher capacity - the size of the partition is important here):
Disk /dev/sdc: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors/track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 30515 245111706 83 Linux
1.2 Setting up the RAID
Now, it's getting interesting. With these partitions set up, it's time to create the RAID:
You should get a confirmation:
Update the Information in your /etc/mdadm.conf. mdadm *should* be able to identify the partitions for the RAID based on a signature written during the creation process - but you never now...
Thumbs up - Your RAID is now set up! You may want to check the progress of the sync by the following command:
If everything is okay, it should look similar to this:
Personalities : [raid1] md0 : active raid1 sdb1 sdc1 245111616 blocks [2/2] [UU] unused devices: <none>
Install the LVM related packages:
After successful installation of the packages you need to load the dm_mod Kernel module:
Let's make this persistent, so that the module is available after reboot as well. Just add a line to /etc/modules
Create the Physical Volume on /dev/md0:
Create the Volume Group on this physical volume ('vg00' is how I named my Volume Group - feel free to choose whatever you like):
Maybe you need to activate the VG - just do, to be on the safe side:
Create logical volumes. I've choosen to have 30GB for my /home and 200GB for /media/storage
Setting up Filesystem on our new Logical Volumes:
This will now take some minutes - but we're nearly done!
3. Modifing the System to automatically recognize LVM devices.
Add the created partitions to your /etc/fstab:
Create /media/storage so that mount command will not fail:
Mount the new partitions:
And check if it works:
df -h ... /dev/vg00/home 30G 33M 30G 1% /home /dev/vg00/storage 200G 149G 52G 75% /media/storage ...
Now this is the point which took most of my time today - howto get the SLUG detect and mount the LVM stuff automagically after boot - played a bit with configs in /etc/modprobe.d/ but without success in the end.
What finally helped me out, was the file /etc/init.d/mountall.sh which is called during the boot process anyway. But before we edit something, let's make a backup of the file:
I added the following part right *after* the section for *mdadm* (line 17), but before the definite *mount* command and it's describing comment:
# # Added vgscan and vgchange to enable LVM2 configured partitions # if test -x /usr/sbin/lvm then test "$VERBOSE" != no && echo "Scanning for LVM volume groups and enable..." vgscan vgchange -a y fi
The next section contains the call of "mount -at (...)", so no need to add anything else at this stage.
Just reboot and check if everything works as expected. If not, lsmod helped me a lot to locate the problem. The following modules should be loaded for our config to work:
Module Size Used by raid1 16288 1 md_mod 61908 2 raid1 dm_mod 34056 6