码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-03-30 10:27:39      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:minimum   ica   ini   lan   linux lvm   line   access   free   physical   

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

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

标签:minimum   ica   ini   lan   linux lvm   line   access   free   physical   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!