Logical Volume Management
Logical Volume Management
Table of Contents
- What is LVM?
- Conceptions
- How to
- create PV
- create VG
- create LV
1 What is LVM?
LVM stands for Logical Volume Management, which is one kind of virtual disk partition. In the traditional way, We need to separate a disk into multiple partitions, then format that partition with a filesystem. Once you write the partition table to the disk, rewrite this table will lose all your disk data.
But, LVM gave more scalable and dynamic options, we can adjust and re-create partitions without reboot and re-mount process.
But, LVM gave more scalable and dynamic options, we can adjust and re-create partitions without reboot and re-mount process.
2 Conceptions
- VG: Volume Groups
- PV: Physical Volumes
- LV: Logical Volumes
Topology of these concepts:
- one Volume Group can include more than one Physical Volumes;
- one Physical Volume can only belong to one Volume Group;
- one Volume Group can have multiple Logical Volumes;
- one Logical Volume can only belong to only one Volume Group;
3 How to
3.1 create PV
Use fdisk to create disk partitions with system id 8e which stands for Linux LVM.
In my case, I create a Physical Volume above my RAID-0 virtual disk partition /dev/md0p1.
In my case, I create a Physical Volume above my RAID-0 virtual disk partition /dev/md0p1.
# write lvm system id to md0p1 partition by fdisk tool # sudo fdisk /dev/md0 sudo pvcreate /dev/md0p1
3.2 create VG
sudo vgcreate foo /dev/md0p1
3.3 create LV
# create LV bar above the VG foo sudo lvcreate -n bar -L 10g foo
format LV /dev/foo/bar with ext4 filesystem
sudo mkfs.ext4 /dev/foo/bar
resize /dev/foo/bar partition
sudo lvextend -L +10g foo/bar sudo resize2fs /dev/foo/bar
Comments
Post a Comment