lvm expansion
[the root @ localhost ~] # lsblk
NAME the MAJ: the TYPE MOUNTPOINT the RO SIZE MIN RM
SDA. 8: 0 0 0 8G Disk
├─sda1. 8: Part. 1 0 0. 1G / Boot
└─sda2. 8: Part 2 0 0 7G
├ the root-253 ─cl: 6.2G 0 0 0 LVM /
└─cl the swap-253: LVM. 1 0 0 820M [the SWAP]
SDB 8:16 0 disk # 0 8G disk is not formatted
sr0 11: 0 1 1024M 0 rom
Disk Format
[root@localhost ~]# fdisk /dev/sdb
Welcome to the fdisk (util-linux 2.23.2).
Change will stay in memory until you decide to write the changes to disk.
Please think twice before using the write command.
Device does not contain a recognized partition table
using the disk identifier 0x4079b702 create a new DOS disk label.
Command (input m to get help): n # Create Partition
the Partition type:
P Primary (Primary 0, 0 Extended, Free. 4)
E Extended
the Select (default P): P # Select the primary partition, followed by default to
the partition number (1 -4, default 1):
starting sector (2048-16777215, the default is 2048):
the default value 2048
Last sector, sector + or + size {K, M, G} (2048-16777215, default 16777215):
the default value 16777215
partition 1 has been set for Linux type, size to 8 GiB
Command (input m to get help): t #t to modify the partition type
selected partition. 1
Hex Code (L list all input codes):
Hex Code (L list all input codes): L
0 empty 24 the NEC the DOS 81 the Minix / Old the Solaris BF Linu . 1 FAT12 27 hidden Win the NTFS 82 the Linux exchange / So C1 DRDOS / sec (FAT- 2 XENIX the root 39 Plan . 9 83 the Linux C4 DRDOS / sec (FAT- . 3 XENIX. 3C usr PartitionMagic 84 the OS / 2 hidden C: C6 DRDOS / sec (FAT- . 4 the FAT16 <32M 40 Venix 80286 85 the Linux extended Syrinx C7 . 5 extended 41 The PReP the Boot the PPC 86 the NTFS file system volume data set of the non-da . 6 the FAT16 42 is the SFS 87 the NTFS volume sets the CP DB / M / CTOS / . . 7 the HPFS / the NTFS / 4D QNX4.x the exFAT 88 the Linux plaintext de Dell tool . 8 the AIX QNX4 4E. x part of the LVM DF BootIt the Linux 8E 2 . 9 the AIX bootable 4f QNX4.x part 3 93 Amoeba access to the DOS E1 A the OS / 2 boot manager 50 OnTrack the DM 94 Amoeba BBT the DOS R & lt E3 / O B the FAT32 W95 51 is OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad 休 eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT f W95 扩展 (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC 11 隐藏的 FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor 12 Compaq diagnostic 5C of Priam Edisk A9 the NetBSD F4 SpeedStor 14 hide the FAT16 < . 3 61 is SpeedStor ab & the Darwin start f2 DOS secondary 16 to hide the FAT16 63 is the GNU the HURD or Sys AF the HFS / the HFS + FB the VMware a VMFS . 17 hide the HPFS /, NTF 64 the Novell Netware B7 FS fc VMware vmkcore BSDI 18 AST intelligent sleep 65 Novell Netware B8 swap BSDI fd Linux RAID automatically 1b hidden FAT3 W95 70 DiskSecure multi Kai bb Boot Wizard hidden LANstep Fe 1C hidden FAT3 W95 75 PC /IX be Solaris BBT start FF 1E hidden FAT1 W95 80 old Minix
Hex Code (Code list all input L): 8e ## 8e is the corresponding linux LVM
Changed Partition "Linux" is of type "Linux LVM"
Command (input m to get help): w ## w is to save and exit
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
. 8 SDA: 0 0 0 8G Disk
├─sda1. 8: Part. 1 0 0. 1G / Boot
└─sda2. 8: Part 2 0 0 7G
├─cl the root-253: 6.2G 0 0 0 LVM /
└─cl the swap-253 : LVM. 1 0 0 820M [the SWAP]
SDB 8:16 0 0 8G Disk
└─sdb1 8:17 0 0 8G Part # here already a primary partition
sr0 11: 0 1 1024M 0 rom
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name cl
PV Size <7.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1791
Free PE 0
Allocated PE 1791
PV UUID wPBPoM-GBux-HzKx-R8rW-psTH-eTDq-SQ5IER
"/dev/sdb1" is a new physical volume of "<8.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size <8.00 GiB #新增的物理卷
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID eiACN6-Nemn-PXPu-S2hb-lzEb-kTJh-GIDz28
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name cl # existing logical volume name
the System ID
the Format LVM2
the Metadata Areas. 1
the Metadata Sequence No. 3
VG of Access Read / Write
VG of the Status resizable
MAX the LV 0
the Cur the LV 2
the Open the LV 2
Max 0 the PV
the Cur the PV. 1
Act. 1 the PV
VG of Size < GiB 7.00
the PE Size 4.00 MiB
the Total 1791 the PE
of Alloc the PE / Size 1791 / <7.00 GiB
as Free the PE / Size 0/0
VG of the UUID 1JXjOk-88hK-Uoep-bok4-qADb-C1wJ-I86Qyz
# extend physical volume
[root@localhost ~]# vgextend cl /dev/sdb1
Volume group "cl" successfully extended
# View Logical Volume Path
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/cl/swap
LV Name swap
VG Name cl
LV UUID Zcqrk2-0IlJ-G1oA-jCHo-80v9-hJyX-SvEWD0
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-09-02 15:07:20 +0800
LV Status available
# open 2
LV Size 820.00 MiB
Current LE 205
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/cl/root #使用这个路径
LV Name root
VG Name cl
LV UUID mYdL16-2qSC-6Iaf-PS1h-3xtT-wilD-tAZMik
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-09-02 15:07:20 +0800
LV Status available
# open 1
LV Size <6.20 GiB
Current LE 1586
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
# Extending a Logical Volume
[root@localhost ~]# lvextend -l +100%FREE /dev/cl/root
Size of logical volume cl/root changed from <6.20 GiB (1586 extents) to 14.19 GiB (3633 extents).
Volume Cl the Logical / root successfully Resized.
# Refresh logical volume
[root@localhost ~]# xfs_growfs /dev/cl/root
# View has bigger size
[root@localhost ~]# df -h
File system capacity has been available with a mount point%
/dev/mapper/cl-root 15G 6.0G 8.3G 43% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.6M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup