1, create a 5G partition on the SDB, and format it as ext3, and boot automatically mount to/data2, create a 2G partition on SDB, as swap partition, and power on automatically use 3, create a logical volume, named lv222, divide 5G Space from volume group vg111, vg111 Volume group contains two physical volumes,/DEV/SDC1/DEV/SDD14, formatted lv222 ext3, boot automatically mounted to/LVM 5, add capacity to lv111 to 7g,6, reduce lv111 capacity to 2G
Step: Add four HDD 1, create a 5G partition on SDB and format it as ext3, and automatically mount to/data
Fdisk-lView disk usage spaceFdisk/dev/sdbNP1-(carriage return) +5GW
Flush Disk: Partprobe
Formatting:MKFS.EXT3/DEV/SDB1
Auto Mount:Vim/etc/fstab
2, create a 2G partition on the SDB, as a swap partition, and turn it on automaticallyfdisk/dev/sdb2+2gt82p
Power-on auto-use: Modify VIM/ETC/FSTAB/DEV/SDB2 Swap swap defaults 0 0
3, create a logical volume, named lv222, to divide 5G of space from volume group vg111, vg111 volume group contains two physical volumes, respectively/dev/sdc1/dev/sdd1/DEV/SDC1/DEV/SDD1, create these two partitions first, FDISK/DEV/SDCFDISK/DEV/SDD
Create a physical volume, PVCREATE/DEV/SDC1PVCREATE/DEV/SDD1Physical Volume View: Pvscan
Create a volume group; vgcreate VG111/DEV/SDC1/DEV/SDD1 Create a volume group named vg111, containing two physical volumes, SDC1,SDD1 Volume Group view: Vgdisplay
Example: Vgcreate-s 8M VFAST_VG/DEV/SDB1/DEV/SDC
Create Logical Volume: Lvcreate-l 5g-n lv222 vg111-l partition Capacity-L Specify how many pe-n specify the logical volume name
Lvdisplay Viewing logical volumes
4, formatted lv222 for ext3, boot automatically mount to/LVM
Format Logical Volume: mkfs.ext3/dev/vg111/lv222 boot automatically mount: VIM/ETC/FSTAB/DEV/VG111/LV222/LVM ext3 defaults 0 0
5, to lv111 to increase the capacity of 7G, the volume of the increase of capacity to reduce the volume is related to the file system, here can be likened to kettle in the kettle single and warm pot skin, file system is kettle single, logical volume LV is kettle skin to the logical volume increases the capacity of the need to first increase the LV, Increase the file system capacity (filesystem capacity is the initialization file system), provided that the mounted logical volume unloading instructions: lvextend-l 7g/dev/vg111/lv222 //Increase the LV capacity first
You can also lvextend +2g/dev/vg111/lv222
E2fsck-f/dev/vg111/lv222 //reinitialization of block devices
resize2fs/dev/vg111/lv222 //reinitialization of file Systems
View:
Now that the logical volume lv222 has increased the capacity to 7g6, reducing the capacity of the lv111 to 2G to the logical volume reduces the file system capacity and then the volume of the logical volume
directive: resize2fs/dev/vg111/lv222 2G
E2fsck-f/dev/vg111/lv222
Lvreduce-l 2g/dev/vg111/lv222
Now the capacity of the logical volume has changed to 2G:
Supplemental: PV: Physical Volume VG: Volume Group LV: Logical Volume PE: basic unit pe--"PV->>VG->>LV
Vgcreate-s 8M VFAST_VG/DEV/SDB1
-S: Specify the size of the PE, default is 4M
Lvcreate-l 100-n VFAST_LV 2 VGFAST_VG
-L: Indicates that 100 PE is included, and if the PE size specified above is 8M, the capacity of the LV logical volume is 800M
Formatting: Mkfs.ext3 /dev/vfast_vg/vfast_lvMount:Mount/dev/vfast_vg/vfast_lv/LVM This directory must be real in the back of the mount.
Volume group capacity decreases as long as the volume group must have the remaining capacityVgextendVFAST_VG/DEV/SDB2VgreduceVFAST_VG/DEV/SDB2Vgdisplay
Pvremove/DEV/SB2 Delete a physical volumeVgremove VFAST_VG Delete a volume group
From for notes (Wiz)
Linux Foundation Small case----use of LVM