1: Add two new disks to the virtual machine settings, 1 2g,1 5G (i mount two because I'm going to do a swap experiment, if I just mount a 5G with LVM)
2: Log in the system, use Fdisk-l to view the disk information (please restart)
3:LVM Management
A) Creating logical partitions
Fdisk/dev/sdc
#因为磁盘是空的, so I first created a primary partition to play with, size is 1G
N (Create a new partition)
P (primary partition)
Carriage return (mode start position)
+1G (primary partition size)
=========== Note that there is a selection on the top of the serial number, the default can be =================
Start creating an extended partition
N (new partition)
E (extended partition)
Enter (default start position)
Carriage return (default size, which is the remaining size of the disk)
============ Create complete =======================================
To start creating the logical partition, the logical partition is created on the extended partition that we just created, and after we have an extended partition, I enter n and then I automatically come out with this option.
N (new partition)
L (logical partition)
Enter (default start position)
+1G (1g size)
By default, the same is true, creating two logical partitions, my logical partitions are/DEV/SDC5,/DEV/SDC6 respectively 1g,2g
=========================================================
Input W Save
PARTPROBE/DEV/SDC (Synchronizing information)
===========================================================
b) Start LVM
Create PV
pvcreate/dev/sdc{5,6}
Create VG
Vgcreate vg_01/dev/sdc{5,6}
Once the creation is successful, start creating the LV
Lvcreate-n lvol0-l vg_01
Here small L is the number of blocks, a piece of my default is 4M, a specific piece of how much can be vgdisplay to view the pesize, this value can be changed
Well, this time lvol0 was created.
Formatting lvol0
Mkfs.ext4/dev/vg_01/lvol0
Then close at the mount point ABC.
Mount/dev/vg_01/lvol0/abc
If you need to mount the boot automatically, you need to write to/etc/fstab
/DEV/VG_01/LVOL0/ABC EXT4 Defaults 0 0
Reboot
Virtual machines use LVM to manage new disks