# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): 3 First sector (20971520-41943039, default 20971520): Using default value 20971520 Last sector, +sectors or +size{K,M,G} (20971520-41943039, default 41943039): Using default value 41943039 Partition 3 of type Linux and of size 10 GiB is set
Command (m for help): t Partition number (1-3, default 3): 3 Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000bc924
Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 20971519 9436160 8e Linux LVM /dev/sda3 20971520 41943039 10485760 8e Linux LVM
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
重启系统 reboot
查看当前分区类型,本例类型为xfs
# df -T /dev/sda1 Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 xfs 1038336 188240 850096 19% /boot123
# pvcreate /dev/sda3 WARNING: xfs signature detected on /dev/sda3 at offset 0. Wipe it? [y/n]: y Wiping xfs signature on /dev/sda3. Physical volume "/dev/sda3" successfully created. # pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name cl PV Size 9.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2303 Free PE 0 Allocated PE 2303 PV UUID MlRwjY-TmVF-H8PV-heSz-ALGL-Q7sp-jFU6Al
"/dev/sda3" is a new physical volume of "10.00 GiB" --- NEW Physical volume --- PV Name /dev/sda3 VG Name PV Size 10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID 0hmgH0-0wVg-jWUW-65WX-1TYb-sUGH-6jF1qm 12345678910111213141516171819202122232425262728
PV加入VG,vgextend后接VG Name,本例中为cl
# vgdisplay --- Volume group --- VG Name cl System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 9.00 GiB PE Size 4.00 MiB Total PE 2303 Alloc PE / Size 2303 / 9.00 GiB Free PE / Size 0 / 0 VG UUID dYdb4l-wMUh-e2xv-WiaJ-Oa52-NvdF-s5ICJC