Installation manual
3. 5. Configuration of LVM 11
Kernel Config for LVM support:
—— Multi−Device Support (RAID and LVM) ——
yes Multiple devices driver support (RAID and LVM)
yes Logical volume manager (LVM) support
Compiling and installing the new kernel:
#> cd /usr/src
#> tar xjf kernel−source−2.4.18.tar.bz2
#> cd kernel−source−2.4.18
#> make menuconfig
#> make−kpkg clean
#> make−kpkg −rev Custom.1 kernel_image
#> cd ..
#> dpkg −i kernel−image_2.4.18
When the newkernel has been installed and lilo been updated sucessfully,wereboot.
Nowweare ready to create the physical volume on /dev/hda6, add it to our volume group /dev/disk, create our
logical volumes /dev/disk/usr,/dev/disk/tmp, /dev/disk/var and /dev/disk/home and the filesystems in them.
Creating the physical and logical volumes and filesystems:
#> pvcreate /dev/hda6
#> vgcreate disk /dev/hda6
#>
#> lvcreate −L 3072M −n usr disk
#> lvcreate −L 128M −n tmp disk
#> lvcreate −L 1024M −n var disk
#> lvcreate −L 1536M −n cdr disk
#> lvcreate −L 10G −n home disk
#>
#> mke2fs −j −m 0 /dev/disk/usr
#> mke2fs /dev/disk/tmp
#> mke2fs −j /dev/disk/var
#> mke2fs −j −m 0 /dev/disk/cdr
#> mke2fs −j /dev/disk/home
Nowwemount these newpartitions consecutively to /mnt and transfer the contents of the respective directories
currently residing on /dev/hda2.
Relocating the directory structuretothe new filesystems:
#> mount /dev/disk/var /mnt
#> cd /var; tar cf − . | (cd /mnt; tar xf −)
#> umount /mnt
#>
#> mount /dev/disk/usr /mnt
#> cd /usr; tar cf − . | (cd /mnt; tar xf −)
#> umount /mnt
#>
#> mount /dev/hda5 /mnt
#> mkdir /mnt/dev /mnt/cdrom /mnt/cdr /mnt/usr /mnt/var /mnt/tmp /mnt/home /mnt/proc
#> mkdir −p /mnt/mnt/cdrom
#> chmod 1777 /mnt/tmp /mnt/cdr
#>
#> cd /; tar cf − bin boot dev etc lib opt root sbin | (cd /mnt; tar xf −)
Note: Creating the newdevice directory /devmanually before anyother directory might save the day,when some
idiot goes for rm -rf * in the root directory.Asrmdescends the directory tree not alphabetically but in order of
creation, /devwill be first to go. But if /dev/hda is gone, rm can’taccess the disk anymore.
After this step, we update the filesystem layout in /mnt/etc/fstab.
/etc/fstab:
/dev/hda1 /boot ext2 defaults,ro 02
/dev/hda5 / ext2 defaults,errors=remount−ro 01