Disk labels, such as/dev/mapper/volgroup-lv_root,/dev/mapper/volgroup-lv_home, and so on, are often encountered in production environments, which are actually logical volumes (virtual disks)
Today just learned this piece, summed up a bit to share to everyone, so as not to encounter this logical volume management encountered problems.
First say a few nouns:
LVM (Logical Volume Manager), logical Volume Manager
PV (physical Volume), physical volume
VG (Volume Group), Volume group
PE (physical Extend), logical volume, default size 4M, up to 65,534 PE per volume group, to increase the capacity of the logical volume, increasing the PE size
LG (Logical Group), logical group
Is the analysis of the above several concepts (the picture is ugly, make a look at it):
As can be seen, the logical volume is the physical volume through the LVM virtual out, the advantage is the ability to adjust the capacity of the file system flexibly, that is, the logical volume can be increased capacity on demand.
Here's how:
1. Add HDD SDB to the machine
2, I here will be the physical disk SDB zoned a partition SDB1
FDISK/DEV/SDB, specifically ask Baidu Bar
3. Use parted to set the disk partition flag to (8e)
4. View Disk
5. Create physical volume related commands: Pvcreate pvscan pvdisplay Pvremove
Pvcreate/dev/sdb1
6. Create Volume group related commands: Vgcreate vgscan vgdisplay vgextend vgreduce vgchange vgremove
VGCREATE/DEV/SDB1 Newvolgroup
7. Create logical Volume related commands: Lvcreate lvscan lvdisplay lvextend lvreduce lvremove lvresize
Lvcreate–l 3842–n Lv_data Newvolgroup
-L is the specified number of PE, the above command is divided into 3,842 pe from the Newvolgroup to Lv_data (3842*4m)
8, after the format of the mount, such as a series of commands, as follows
Mkfs.ext4/dev/mapper/newvolgroup-lv_data
Mkdir/mnt/data
Mount/dev/mapper/newvolgroup-lv_data/mnt/data
Finally, don't forget to change the/etc/fstab file to add the disk information
Linux LVM Logical Volume Learning Notes