1. 操作命令
操作命令如下:
df -Th
lsblk
fdisk /dev/sdb
lsblk
pvcreate /dev/sdb1
pvdisplay
vgdisplay
vgextend centos /dev/sdb1
vgdisplay
pvdisplay
lvdisplay
lvextend -l +100%FREE /dev/centos/root
df -Th
xfs_growfs /dev/centos/root
df -Th
2. 操作过程
[root@iser-monitor01 alertmanager]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 15G 36G 29% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 8.4M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 xfs 1014M 153M 862M 16% /boot
/dev/sda1 vfat 200M 9.9M 190M 5% /boot/efi
/dev/mapper/centos-opt xfs 15G 33M 15G 1% /opt
/dev/mapper/centos-home xfs 8.8G 34M 8.8G 1% /home
/dev/mapper/centos-var xfs 25G 901M 25G 4% /var
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
[root@iser-monitor01 alertmanager]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 98.8G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-home 253:1 0 8.8G 0 lvm /home
├─centos-var 253:2 0 25G 0 lvm /var
└─centos-opt 253:3 0 15G 0 lvm /opt
sdb 8:16 0 1000G 0 disk
sr0 11:0 1 1024M 0 rom
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# fdisk /dev/sdb
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 0x47379b16.
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
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-2097151999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151999, default 2097151999):
Using default value 2097151999
Partition 1 of type Linux and of size 1000 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 98.8G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-home 253:1 0 8.8G 0 lvm /home
├─centos-var 253:2 0 25G 0 lvm /var
└─centos-opt 253:3 0 15G 0 lvm /opt
sdb 8:16 0 1000G 0 disk
└─sdb1 8:17 0 1000G 0 part
sr0 11:0 1 1024M 0 rom
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name centos
PV Size 98.80 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25293
Free PE 0
Allocated PE 25293
PV UUID ODqte0-9QiK-RlxG-8xb0-aYvJ-yfHT-KcR865
"/dev/sdb1" is a new physical volume of "<1000.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size <1000.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Fv2FF9-TUW9-lZID-NFO3-ukAI-ECh3-mNXtQL
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 98.80 GiB
PE Size 4.00 MiB
Total PE 25293
Alloc PE / Size 25293 / 98.80 GiB
Free PE / Size 0 / 0
VG UUID t7qcU4-pN1v-DaeN-keN1-oWDI-4tLY-epo0Xg
[root@iser-monitor01 alertmanager]# vgextend centos /dev/sdb1
Volume group "centos" successfully extended
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.07 TiB
PE Size 4.00 MiB
Total PE 281292
Alloc PE / Size 25293 / 98.80 GiB
Free PE / Size 255999 / <1000.00 GiB
VG UUID t7qcU4-pN1v-DaeN-keN1-oWDI-4tLY-epo0Xg
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name centos
PV Size 98.80 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25293
Free PE 0
Allocated PE 25293
PV UUID ODqte0-9QiK-RlxG-8xb0-aYvJ-yfHT-KcR865
--- Physical volume ---
PV Name /dev/sdb1
VG Name centos
PV Size <1000.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 255999
Free PE 255999
Allocated PE 0
PV UUID Fv2FF9-TUW9-lZID-NFO3-ukAI-ECh3-mNXtQL
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID gleQmV-qoeH-ZHz3-HSUG-IvDh-a77j-mIMkDn
LV Write Access read/write
LV Creation host, time localhost, 2019-12-19 16:17:52 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID V63xl5-dp70-FIlc-rjHm-93nm-LoJz-wWfi36
LV Write Access read/write
LV Creation host, time localhost, 2019-12-19 16:17:55 +0800
LV Status available
# open 1
LV Size 8.80 GiB
Current LE 2253
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/var
LV Name var
VG Name centos
LV UUID WqXYBN-MpWJ-WuIv-06oh-CDhp-f38c-14W587
LV Write Access read/write
LV Creation host, time localhost, 2019-12-19 16:17:56 +0800
LV Status available
# open 1
LV Size 25.00 GiB
Current LE 6400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/opt
LV Name opt
VG Name centos
LV UUID BDLVE6-sYIw-a4yD-Vodu-83Fl-UyAi-sgixFk
LV Write Access read/write
LV Creation host, time localhost, 2019-12-19 16:17:58 +0800
LV Status available
# open 1
LV Size 15.00 GiB
Current LE 3840
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
[root@iser-monitor01 alertmanager]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to <1.03 TiB (268799 extents).
Logical volume centos/root successfully resized.
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 15G 36G 29% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 8.4M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 xfs 1014M 153M 862M 16% /boot
/dev/sda1 vfat 200M 9.9M 190M 5% /boot/efi
/dev/mapper/centos-opt xfs 15G 33M 15G 1% /opt
/dev/mapper/centos-home xfs 8.8G 34M 8.8G 1% /home
/dev/mapper/centos-var xfs 25G 901M 25G 4% /var
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
[root@iser-monitor01 alertmanager]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 98.8G 0 part
├─centos-root 253:0 0 1T 0 lvm /
├─centos-home 253:1 0 8.8G 0 lvm /home
├─centos-var 253:2 0 25G 0 lvm /var
└─centos-opt 253:3 0 15G 0 lvm /opt
sdb 8:16 0 1000G 0 disk
└─sdb1 8:17 0 1000G 0 part
└─centos-root 253:0 0 1T 0 lvm /
sr0 11:0 1 1024M 0 rom
[root@iser-monitor01 alertmanager]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 275250176
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]#
[root@iser-monitor01 alertmanager]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 1.1T 15G 1.1T 2% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 8.4M 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 xfs 1014M 153M 862M 16% /boot
/dev/sda1 vfat 200M 9.9M 190M 5% /boot/efi
/dev/mapper/centos-opt xfs 15G 33M 15G 1% /opt
/dev/mapper/centos-home xfs 8.8G 34M 8.8G 1% /home
/dev/mapper/centos-var xfs 25G 901M 25G 4% /var
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
[root@iser-monitor01 alertmanager]#
文章来源:https://www.cnblogs.com/yizhipanghu/p/15028786.html