Linux Disk Management with LVM (Logical Volume Manager)
From Notes
LVM is a great way to manage physical hard disk drives. LVM allows the administrator to get away from managing disks using physical partitions and instead use logical volumes which reside on physical disks. Along with the ability to resize volumes online, the ability to enlarge ext3 filesystems with resize2fs saves time and effort along with preventing frustration after allocating a filesystem that may be too small for the current task.
All mature operating systems should provide the ability to enlarge volumes and filesystems online to prevent needless downtime. To facilitate this process, systems administrators must have a pool of storage with which to allocate additional space.
Quick Start - Using a 1TB Drive to Create a New Volume Group with one 100GB Logical Volume
Creating a partition is optional as LVM can manage a raw disk.
- Create the logical volume:
fdisk /dev/sdb pvcreate /dev/sdb1 vgcreate /dev/sdb1 lvcreate -L 100G -n lvol_videos vg01 mke2fs -j /dev/vg01/lvol_videos tune2fs -O dir_index /dev/vg01/lvol_videos tune2fs -O large_file /dev/vg01/lvol_videos e2label /dev/vg01/lvol_videos /srv/videos
- Create an fstab entry:
#/etc/fstab LABEL=/srv/videos /srv/videos ext3 defaults 0 0
- Create a mount point:
mkdir -p /srv/videos
- Mount the new volume:
mount /srv/videos
