Install logical volumes (LVM)

Prepare and install volumes

Prepare a single disk or a disk raid:

mkfs.ext3 <phsvol>
lvm
lvm> pvcreate <physvol>
lvm> vgcreate <physvol> // or several physical volumes: <physvol1> <physvol2> <physvol3>
lvm> lvcreate <volgroup> <physical>
lvm> quit
mkfs.ext3 /dev/mapper/<volgroup-logvol>
mount /dev/mapper/<volgroup-logvol> <dir>

Auto-mount during boot:

vim /etc/fstab
/dev/mapper/<volgroup-logvol> <dir> ext3 noatime,user_xattr 0 0

Install LVM manually

If you need to install LVM after having setup the base system, note that there is a bug in Edgy and Feisty where the executable files will not be found. To fix it, execute the 2nd instruction below:

apt-get install lvm2
ln -s /lib/lvm-200 /lib/lvm-0

Install LVM volumes

  1. lvm > pvcreate /dev/sde1 > pvcreate /dev/md2
  2. lvm > vgcreate vg_backup /dev/sde1 > vgcreate vg_data /dev/md2
  3. lvm > vgdisplay vg_backup to check ### of free extents (following steps same for vg_data, but 2 logical volumes)
  4. lvm > lvcreate -l### vg_backup (do not use -LxxGB, use size with -l### which is number of extents)
  5. lvm > lvrename vg_backup lvol0 lv_backup
  6. lvm > vgcfgbackup to backup volume group configurations
  7. lvm > exit
  8. umount /home > umount /srv
  9. mkfs -t ext3 /dev/vg_backup/lv_backup > mkfs -t ext3 /dev/vg_data/lv_home > mkfs -t ext3 /dev/vg_data/lv_srv
  10. mkdir /backup
  11. mount /dev/vg_backup/lv_backup /backup > mount /dev/vg_data/lv_home /home > mount /dev/vg_data/lv_srv /srv
  • As I use this machine as a server I did not consider to upgrade Edgy to Feisty, but I would expect that this can be done without problems. I'm not sure this is the best way or the fastest, but it worked for me.

Check wether all volumes get mounted during system boot

For whatever reason, my swap volume which resides on raid1 was not mounted during system boot. After some searching I found that the uuid where not matching between /dev/disk/by-uuid and /etc/fstab.

to check wether root and swap are mounted, enter:

mount
free -m -t

to check mismatching uuid's, enter:

ls -la /dev/disk/by-uuid
cat /etc/fstab

to fix, do:

vim /etc/fstab

replace the uuid's found in fstab with the ones found in /dev/disk. Make sure you copy the correct uuid (md0, md1) to the respective entry in fstab.

Copy content of entire partition

rsync -avH /backup /mnt/new_backup/