Configure logical volumes
First edit the file logical-volumes.sh to your needs.
Its format is the same as fstab, however a column size is added.
In the example swap, boot and root are already there. You may
alter the size.
Var cannot be created here: when mounted after reboot, it would
hide /var/lock and alike, that would prevent the system to work.
You have to do that later, and create lock etc. immediately.
Be sure to create not more logical disk space than you can spend
from mirrired disk space at this moment.
(you may not have inserted all disks).
You can increase logical volumes later, as well as add new ones !
Create logical volumes
Run the script 3.create_logical_volumes.sh from a root terminal.
Check the results with the following commands:
- pvdisplay shows the md's forming the volume group
- vgdisplay shows info about the volume group
- lvdisplay shows the logical volumes created from the volume group
Want a separated /var partition ?
If you want a large root fileystem with all your data on it,
you entered a large number in variables.sh, and you're fine.
Skip the rest of this paragraph.
If you want a small root filesystem with a large separated (mounted) /var
filesystem, then:
- make sure root is small, like 10G to 30G,
- create a /var now; do NOT enter it in logical_volumes.sh.
Create extra logical volumes
- lvcreate --name $NAME --size $SIZE --stripes $STRIPES --stripesize 32 /dev/all_disks
to create a logical volume (virtual disk), where
- $NAME = the name of the partition, e.g.: var
- $SIZE = the size, e.g.: 10G or 120G,
- $STRIPES = the number of physical md's in the volume group
(optional, for performance only),
- stripesize = a power of 2, the size of a stipe in KBytes,
stripes and stripesize are optional.
- mkfs -t ext3 /dev/all_disks/$NAME creates a filesystem in $NAME
- mount /dev/all_disks/$NAME /mnt mounts the new filesystem as /mnt
- cd source_dir; find . -xdev | cpio -pdum /mnt
to copy files from the source directory to the new filesystem.
- Create more [empty] directories and mount-points on the target filesystem as needed.
- Remove all copied data from the source directory.
Don't bother about this, if it is on the disk yet-to-be-partitioned.
- umount /mnt unmount the new filesystem from /mnt
- update /etc/fstab to do this mount again every boot time
- mount -a to mount the new filesystem where it belongs
- check if it is correctly mounted.
And some more ...
Maybe you want some more partitions to prevent the rest of the system from
flooding with this data.
Candidates are:
- /var
- /home
- /home/your_name
- /var/log
- /var/www
- /var/mail
- /var/tmp
Just do as described before.
You might want to do this later,
when all mirrored devices are included into the volume group.
Then you have some more space.
You have also more partitions, allowing you to divide the data
over more md's (stripes) for better perfomance.