centos7.6 磁盘分区及扩容vg lv

Last login: Sat Mar 30 07:38:24 2019 from 10.0.0.3
[root@vmhzpcentosdisk ~]# fdisk -l ----在esxi上给虚拟机新增磁盘,后重启虚拟机;

Disk /dev/sda: 1075 MB, 1075838976 bytes, 2101248 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: 0x741b59c1

Device Boot Start End Blocks Id System
/dev/sda1 * 128 2097279 1048576 83 Linux

Disk /dev/sdb: 5370 MB, 5370806272 bytes, 10489856 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: 0x4821b046

Device Boot Start End Blocks Id System
/dev/sdb1 128 10485887 5242880 8e Linux LVM

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System

Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/centos-root: 4718 MB, 4718592000 bytes, 9216000 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 /dev/mapper/centos-swap: 645 MB, 645922816 bytes, 1261568 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

[root@vmhzpcentosdisk ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb1
VG Name centos
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1279
Free PE 0
Allocated PE 1279
PV UUID XlSjh3-kTyb-wkzF-hk73-3tG1-zLZX-imxY82

[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0

[root@vmhzpcentosdisk ~]# vgdisplay centos
--- Volume group ---
VG Name centos
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 <5.00 GiB
PE Size 4.00 MiB
Total PE 1279
Alloc PE / Size 1279 / <5.00 GiB
Free PE / Size 0 / 0
VG UUID elZKnn-cOks-RapN-sZiu-tqIo-YE0w-G7qxfK

[root@vmhzpcentosdisk ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID bntBvT-ohQb-h5AS-g7Uz-S2IZ-MJXY-g5vHN2
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 1
LV Size 4.39 GiB
Current LE 1125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 1jlIZY-wZeS-rpqo-PZGl-TSzc-qQBY-cy1MVV
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 2
LV Size 616.00 MiB
Current LE 154
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

[root@vmhzpcentosdisk ~]# fdisk /dev/sdc
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 (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +1G
Partition 1 of type Linux and of size 1 GiB is set

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (2099200-4194303, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-4194303, default 4194303): +1G
Value out of range.
Last sector, +sectors or +size{K,M,G} (2099200-4194303, default 4194303):
Using default value 4194303
Partition 2 of type Linux and of size 1023 MiB is set

Command (m for help): p

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 83 Linux
/dev/sdc2 2099200 4194303 1047552 83 Linux

Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): l

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext‘d (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux‘ to ‘Linux LVM‘

Command (m for help): p

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 8e Linux LVM
/dev/sdc2 2099200 4194303 1047552 83 Linux

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): l

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext‘d (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux‘ to ‘Linux LVM‘

Command (m for help): p

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 8e Linux LVM
/dev/sdc2 2099200 4194303 1047552 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@vmhzpcentosdisk ~]# fdisk -l

Disk /dev/sda: 1075 MB, 1075838976 bytes, 2101248 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: 0x741b59c1

Device Boot Start End Blocks Id System
/dev/sda1 * 128 2097279 1048576 83 Linux

Disk /dev/sdb: 5370 MB, 5370806272 bytes, 10489856 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: 0x4821b046

Device Boot Start End Blocks Id System
/dev/sdb1 128 10485887 5242880 8e Linux LVM

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 8e Linux LVM
/dev/sdc2 2099200 4194303 1047552 8e Linux LVM

Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/centos-root: 4718 MB, 4718592000 bytes, 9216000 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 /dev/mapper/centos-swap: 645 MB, 645922816 bytes, 1261568 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

[root@vmhzpcentosdisk ~]# fdisk /dev/sdd
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x5e81ca7f.

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +1G
Partition 1 of type Linux and of size 1 GiB is set

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (2099200-4194303, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-4194303, default 4194303):
Using default value 4194303
Partition 2 of type Linux and of size 1023 MiB is set

Command (m for help): p

Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 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: 0x5e81ca7f

Device Boot Start End Blocks Id System
/dev/sdd1 2048 2099199 1048576 83 Linux
/dev/sdd2 2099200 4194303 1047552 83 Linux

Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): l

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext‘d (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux‘ to ‘Linux LVM‘

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux‘ to ‘Linux LVM‘

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@vmhzpcentosdisk ~]# fdisk -l

Disk /dev/sda: 1075 MB, 1075838976 bytes, 2101248 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: 0x741b59c1

Device Boot Start End Blocks Id System
/dev/sda1 * 128 2097279 1048576 83 Linux

Disk /dev/sdb: 5370 MB, 5370806272 bytes, 10489856 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: 0x4821b046

Device Boot Start End Blocks Id System
/dev/sdb1 128 10485887 5242880 8e Linux LVM

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 8e Linux LVM
/dev/sdc2 2099200 4194303 1047552 8e Linux LVM

Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 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: 0x5e81ca7f

Device Boot Start End Blocks Id System
/dev/sdd1 2048 2099199 1048576 8e Linux LVM
/dev/sdd2 2099200 4194303 1047552 8e Linux LVM

Disk /dev/mapper/centos-root: 4718 MB, 4718592000 bytes, 9216000 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 /dev/mapper/centos-swap: 645 MB, 645922816 bytes, 1261568 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

[root@vmhzpcentosdisk ~]# pvcreate /dev/sdc1
WARNING: ext3 signature detected on /dev/sdc1 at offset 1080. Wipe it? [y/n]: y
Wiping ext3 signature on /dev/sdc1.
Physical volume "/dev/sdc1" successfully created.
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdc2
WARNING: ext4 signature detected on /dev/sdc2 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdc2.
Physical volume "/dev/sdc2" successfully created.
[root@vmhzpcentosdisk ~]# fdisk -l

Disk /dev/sda: 1075 MB, 1075838976 bytes, 2101248 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: 0x741b59c1

Device Boot Start End Blocks Id System
/dev/sda1 * 128 2097279 1048576 83 Linux

Disk /dev/sdb: 5370 MB, 5370806272 bytes, 10489856 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: 0x4821b046

Device Boot Start End Blocks Id System
/dev/sdb1 128 10485887 5242880 8e Linux LVM

Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 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: 0x957753d6

Device Boot Start End Blocks Id System
/dev/sdc1 2048 2099199 1048576 8e Linux LVM
/dev/sdc2 2099200 4194303 1047552 8e Linux LVM

Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 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: 0x5e81ca7f

Device Boot Start End Blocks Id System
/dev/sdd1 2048 2099199 1048576 8e Linux LVM
/dev/sdd2 2099200 4194303 1047552 8e Linux LVM

Disk /dev/mapper/centos-root: 4718 MB, 4718592000 bytes, 9216000 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 /dev/mapper/centos-swap: 645 MB, 645922816 bytes, 1261568 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

[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 lvm2 --- 1.00g 1.00g
/dev/sdc2 lvm2 --- 1023.00m 1023.00m
[root@vmhzpcentosdisk ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb1
VG Name centos
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 1279
Free PE 0
Allocated PE 1279
PV UUID XlSjh3-kTyb-wkzF-hk73-3tG1-zLZX-imxY82

"/dev/sdc2" is a new physical volume of "1023.00 MiB"
--- NEW Physical volume ---
PV Name /dev/sdc2
VG Name
PV Size 1023.00 MiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID AiIywo-sV07-RxIG-giE0-8DqM-N0Sd-K904ko

"/dev/sdc1" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GlgU4F-l80g-qcc5-BdZw-wySh-Ugjq-Qcvfp6

[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 lvm2 --- 1.00g 1.00g
/dev/sdc2 lvm2 --- 1023.00m 1023.00m
[root@vmhzpcentosdisk ~]# pvscan
PV /dev/sdb1 VG centos lvm2 [<5.00 GiB / 0 free]
PV /dev/sdc2 lvm2 [1023.00 MiB]
PV /dev/sdc1 lvm2 [1.00 GiB]
Total: 3 [<7.00 GiB] / in use: 1 [<5.00 GiB] / in no VG: 2 [<2.00 GiB]

[root@vmhzpcentosdisk ~]# vgcreate mydata /dev/sdc1 /dev/sdc2 -s 64m
Volume group "mydata" successfully created
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
mydata 2 0 0 wz--n- <1.88g <1.88g
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 mydata lvm2 a-- 960.00m 960.00m
/dev/sdc2 mydata lvm2 a-- 960.00m 960.00m
[root@vmhzpcentosdisk ~]# vgdisplay mydata
--- Volume group ---
VG Name mydata
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size <1.88 GiB
PE Size 64.00 MiB
Total PE 30
Alloc PE / Size 0 / 0
Free PE / Size 30 / <1.88 GiB
VG UUID cDzX9b-GB2t-vdX1-H6SF-4Zra-wGGz-9WxVS4

[root@vmhzpcentosdisk ~]# lvcreate -L 0.8G -n lv1 mydate
Volume group "mydate" not found
Cannot process volume group mydate
[root@vmhzpcentosdisk ~]# lvcreate -L 0.8G -n lv1 mydata
Rounding up size to full physical extent 832.00 MiB
Logical volume "lv1" created.
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
mydata 2 1 0 wz--n- <1.88g 1.06g
[root@vmhzpcentosdisk ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 4.39g
swap centos -wi-ao---- 616.00m
lv1 mydata -wi-a----- 832.00m
[root@vmhzpcentosdisk ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID bntBvT-ohQb-h5AS-g7Uz-S2IZ-MJXY-g5vHN2
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 1
LV Size 4.39 GiB
Current LE 1125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 1jlIZY-wZeS-rpqo-PZGl-TSzc-qQBY-cy1MVV
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 2
LV Size 616.00 MiB
Current LE 154
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

--- Logical volume ---
LV Path /dev/mydata/lv1
LV Name lv1
VG Name mydata
LV UUID jz5eV4-dGeG-yjGD-JBbv-cN6P-t21g-Z3ujby
LV Write Access read/write
LV Creation host, time vmhzpcentosdisk, 2019-03-30 08:23:10 +0800
LV Status available
# open 0
LV Size 832.00 MiB
Current LE 13
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2

[root@vmhzpcentosdisk ~]# mkfs.ext4 /dev/mydata/lv1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
53312 inodes, 212992 blocks
10649 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=218103808
7 block groups
32768 blocks per group, 32768 fragments per group
7616 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

[root@vmhzpcentosdisk ~]# mkdir /data1
[root@vmhzpcentosdisk ~]# mount /dev/mydata/lv1 /data1
[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
/dev/mapper/mydata-lv1 803M 1.7M 744M 1% /data1

[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
mydata 2 1 0 wz--n- <1.88g 1.06g
[root@vmhzpcentosdisk ~]# lvextend -L +0.5G /dev/mydata/lv1
Size of logical volume mydata/lv1 changed from 832.00 MiB (13 extents) to 1.31 GiB (21 extents).
Logical volume mydata/lv1 successfully resized.
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
mydata 2 1 0 wz--n- <1.88g 576.00m
[root@vmhzpcentosdisk ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 4.8G 1.5G 3.3G 31% /
devtmpfs devtmpfs 507M 0 507M 0% /dev
tmpfs tmpfs 520M 0 520M 0% /dev/shm
tmpfs tmpfs 520M 7.4M 513M 2% /run
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
/dev/sda1 xfs 1.1G 163M 901M 16% /boot
tmpfs tmpfs 104M 0 104M 0% /run/user/0
/dev/mapper/mydata-lv1 ext4 842M 1.8M 780M 1% /data1
[root@vmhzpcentosdisk ~]# resize2fs /dev/mydata/lv1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mydata/lv1 is mounted on /data1; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mydata/lv1 is now 344064 blocks long.

[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
/dev/mapper/mydata-lv1 1.3G 2.5M 1.3G 1% /data1
[root@vmhzpcentosdisk ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 4.8G 1.5G 3.3G 31% /
devtmpfs devtmpfs 507M 0 507M 0% /dev
tmpfs tmpfs 520M 0 520M 0% /dev/shm
tmpfs tmpfs 520M 7.4M 513M 2% /run
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
/dev/sda1 xfs 1.1G 163M 901M 16% /boot
tmpfs tmpfs 104M 0 104M 0% /run/user/0
/dev/mapper/mydata-lv1 ext4 1.4G 2.6M 1.3G 1% /data1
[root@vmhzpcentosdisk ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1G 0 disk
└─sda1 8:1 0 1G 0 part /boot
sdb 8:16 0 5G 0 disk
└─sdb1 8:17 0 5G 0 part
├─centos-root 253:0 0 4.4G 0 lvm /
└─centos-swap 253:1 0 616M 0 lvm [SWAP]
sdc 8:32 0 2G 0 disk
├─sdc1 8:33 0 1G 0 part
│ └─mydata-lv1 253:2 0 1.3G 0 lvm /data1
└─sdc2 8:34 0 1023M 0 part
└─mydata-lv1 253:2 0 1.3G 0 lvm /data1
sdd 8:48 0 2G 0 disk
├─sdd1 8:49 0 1G 0 part
└─sdd2 8:50 0 1023M 0 part
sr0 11:0 1 1024M 0 rom
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 mydata lvm2 a-- 960.00m 0
/dev/sdc2 mydata lvm2 a-- 960.00m 576.00m
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created.
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdd2
Physical volume "/dev/sdd2" successfully created.
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 mydata lvm2 a-- 960.00m 0
/dev/sdc2 mydata lvm2 a-- 960.00m 576.00m
/dev/sdd1 lvm2 --- 1.00g 1.00g
/dev/sdd2 lvm2 --- 1023.00m 1023.00m

[root@vmhzpcentosdisk ~]# vgextend mydata /dev/sdd1
Volume group "mydata" successfully extended
[root@vmhzpcentosdisk ~]# vgextend mydata /dev/sdd2
Volume group "mydata" successfully extended
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
mydata 4 1 0 wz--n- 3.75g <2.44g

原文地址:https://www.cnblogs.com/tiantom/p/10625390.html

时间: 2024-11-09 09:25:48

centos7.6 磁盘分区及扩容vg lv的相关文章

LVM 管理之一:扩容VG/LV

这节主要演练在线扩容 VG 和 LV .  一 动态扩容 VG--1.1 查看硬盘信息[[email protected] lvm]# fdisk -l Disk /dev/hda: 19.3 GB, 19327352832 bytes255 heads, 63 sectors/track, 2349 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot      Start         End     

磁盘分区,扩容

##################################################### 查看硬盘[[email protected] /]# lsblk 2.修改硬盘的分区表[[email protected] /]# fdisk /dev/vdb n 创建新的分区----->回车----->回车---->回车----->在last结束时 +2Gp 查看分区表n 创建新的分区----->回车----->回车---->回车----->在la

(转载) Linux LVM分区之VG扩容、LV扩容、LV缩减、LVM快照

http://www.dwhd.org/20150521_225146.html Linux LVM分区之VG扩容.LV扩容.LV缩减.LVM快照 摘要 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它是Linux环境下对磁盘分区进行管理的一种机制,它由Heinz Mauelshagen在Linux 2.4内核上实现,于1998年发布到Linux社区中,它允许你在Linux系统上用简单的命令行管理一个完整的逻辑卷管理环境. 一.简介LVM是 Logical Volu

centos7上对LVM根分区扩容vg无法添加pv故障解决

一次,我们的备份数据库的虚拟机出现了异常,备份程序异常终止.经过检查是根分区满了.如下所示:因为根分区默认是采用LVM,所以我就想着直接添加一块硬盘,然后添加到LVM里面,直接对根分区扩容.根分区扩容方式参考之前的写的博客https://blog.51cto.com/11555417/2336797但是在执行到vgextend命令时,一直提示错误,无法对vg进行扩充 Couldn't create temporary archive name.后来查询到问题所在原来是根分区满了,无法创建归档名称

centos7 xfs磁盘管理(格式化、在线扩容)

centos7 xfs磁盘管理(格式化.在线扩容) 环境: centos 7 新增测试磁盘sdb :5G 新增测试磁盘sdb :10G 注意:分区新磁盘 如果大于2T磁盘使用parted工具,并且使用xfs不支持缩减 查看当前磁盘:# fdisk -l [[email protected] ~]# fdisk -l 磁盘 /dev/sda:32.2 GB, 32212254720 字节,62914560 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/

centos扩容(pv,vg,lv)

preFace: (应用场景需求分析) 由于安装系统前未合理规划存储,或是随着业务扩展对存储空间需求量成几何级增长,原先规划的系统存储不足服务当前业务需求,同时当前的系统app运行较完美,admin不想重新规划新架构OS,所以extend disk capacity 迫在眉睫,那么根据你OS架构该如何适应OS自动的CLI扩展文件存储呢? 下面我们简单演示如何适应linux下的相关CLI对Os系统存储进行扩容; 1,  查看待扩容的系统pv(physcial volume物理卷),vg(volum

烂泥:学习LVM之逻辑卷LV及卷组扩容VG

本文由秀依林枫提供友情赞助,首发于烂泥行天下. 上篇文章中介绍了有关LVM基础的知识,这篇文章我们来介绍如何给LVM的逻辑卷LV及卷组VG扩容. LVM的逻辑卷,我们知道它最后相当于一个分区,既然是一个分区那么它就有空间大小的区分.如果现在逻辑卷的空间不够了该怎么办呢? 别担心,LVM提供了给逻辑卷扩容的办法.我们可以通过lvextend命令来实. 在给逻辑卷扩容之前,我们先来看看现在逻辑卷/dev/vg1/data大小,如下: 通过上图我们可以逻辑卷/dev/vg1/data为500M,现在对

Win7 扩容磁盘分区

1.计算机->管理->磁盘管理,磁盘颜色代表意义 主分区:深蓝色: 扩展分区 :绿色的框: 逻辑分区:浅蓝色的分区: 可用空间:绿色分区 2.非主分区扩容 非主分区扩容十分简单,可是须要注意,须要扩容的盘的近邻磁盘必须是可用分区才行. 右键单击需扩容分区,选择扩展卷,点击下一步,输入合适的"选择空间量"就可以      3.主分区扩容(C盘[系统盘]扩容) 系统盘扩容就麻烦一点了,须要将扩展分区的盘都删除恢复成未分配状态,这样系统盘的"扩展卷"才干够点击

(转)centos7.4 fdisk磁盘分区 格式化 挂载

centos7.4 fdisk磁盘分区 格式化 挂载 原文:http://blog.csdn.net/capecape/article/details/78499351 1.查看系统中有多少可以识别的硬盘.U盘 [root@localhost ~]# fdisk -l 1 2.使用fdisk命令进行分区 [root@localhost ~]# fdisk /dev/sdb 1  记得输入w保存退出! 3.通知操作系统,分区表已经改变 [root@localhost ~]# partprobe 1