Linux logical volume management
From the LVM HOWTO -
Logical volume management provides a higher-level view of the disk storage on a computer system than the traditional view of disks and partitions. This gives the system administrator much more flexibility in allocating storage to applications and users.
Storage volumes created under the control of the logical volume manager can be resized and moved around almost at will, although this may need some upgrading of file system tools.
These commands are useful:
- lvs - Display logical volumes
- vgs - Display volume group
- pvs - Display physical volume
Use vgs to find available space for creating a new logical volume in the volume group.
[root@jupiter ~]# vgs
VG #PV #LV #SN Attr VSize VFree
FC6_VG 1 5 0 wz–n- 48.81G 6.50G
This shows that I have 6.5GB free in the FC6_VG volume group. The size of the FC6_VG Volume Group is 48.81GB
Use lvs to display logical volumes.
[root@jupiter ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
lv_fc6_iso FC6_VG -wi-ao 3.72G
lv_home FC6_VG -wi-ao 19.53G
lv_root FC6_VG -wi-ao 14.62G
lv_svn_repos FC6_VG -wi-ao 3.44G
lv_swap FC6_VG -wi-ao 1.00G
Lets create a new physical volume called ’scratch’ with a size of 2.5GB.
[root@jupiter ~]# lvcreate -L 2.5G -n scratch FC6_VG
Logical volume “scratch” created
I think a name of “lv_scratch” would be better.
[root@jupiter ~]# lvrename FC6_VG scratch lv_scratch
Renamed “scratch” to “lv_scratch” in volume group “FC6_VG”
Create the ext3 filesystem using mkfs.
[root@jupiter ~]# mkfs.ext3 /dev/mapper/FC6_VG-lv_scratch
Modify /etc/fstab to mount this device onto /scratch
On second thoughts I would like the scratch partition to be 3GB. Make sure you unmount the device first.
[root@jupiter ~]# lvresize -L 3GB -t FC6_VG/lv_scratch
Test mode: Metadata will NOT be updated.
Extending logical volume lv_scratch to 3.00 GB
Logical volume lv_scratch successfully resized
This was a testrun. Run the above command once more without the -t option.
You should backup all files, then run mkfs once more, and then move the backed up files to your new partition.