GPT分区格式
[root@localhost ~]# gdisk /dev/sdb
-bash: gdisk: 未找到命令
[root@localhost ~]# yum -y install gdisk
- gdisk命令用于查看磁盘使用情况和磁盘分区(GPT分区格式)
- 命令格式:gdisk [选项...] [设备路径]
- 常用选项:-l 列出磁盘分区表类型与分区信息
[root@localhost ~]# gdisk /dev/sdb
[root@localhost ~]# fdisk -l
[root@localhost ~]# mkfs.xfs /dev/sdb1
[root@localhost ~]# blkid /dev/sdb1
/dev/sdb1: UUID="adb85183-9036-4e9c-ba48-aa008bcbebf2" TYPE="xfs" PARTLABEL="Linux filesystem" PARTUUID="5dd8dd16-0e61-47fd-9c24-58ac87f1ceb3"
[root@localhost ~]# lsblk
[root@localhost ~]# vgdisplay -v--- Volume group ---VG Name centosSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size <19.00 GiBPE Size 4.00 MiBTotal PE 4863Alloc PE / Size 4863 / <19.00 GiBFree PE / Size 0 / 0 VG UUID HI5U81-Hkvk-fmqC-UHnx-CDqk-RjLj-fLzHJB--- Logical volume ---LV Path /dev/centos/swapLV Name swapVG Name centosLV UUID GDGd2c-eZch-K97v-zSi0-2eNX-fgUF-fh5xunLV Write Access read/writeLV Creation host, time localhost, 2021-04-11 05:45:36 +0800LV Status available# open 2LV Size 2.00 GiBCurrent LE 512Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/centos/rootLV Name rootVG Name centosLV UUID 8PsH48-HedQ-jXHq-H7rP-Xj9O-Ligh-CairgBLV Write Access read/writeLV Creation host, time localhost, 2021-04-11 05:45:36 +0800LV Status available# open 1LV Size <17.00 GiBCurrent LE 4351Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0--- Physical volumes ---PV Name /dev/sda2 PV UUID RYZCne-Xpic-a6Fe-TDQO-M4AI-tsmf-vkHFmQPV Status allocatableTotal PE / Free PE 4863 / 0
[root@localhost ~]# pvcreate /dev/sdb1
WARNING: xfs signature detected on /dev/sdb1 at offset 0. Wipe it? [y/n]: yWiping xfs signature on /dev/sdb1.Physical volume "/dev/sdb1" successfully created.
[root@localhost ~]# pvdisplay --- Physical volume ---PV Name /dev/sda2VG Name centosPV Size <19.00 GiB / not usable 3.00 MiBAllocatable yes (but full)PE Size 4.00 MiBTotal PE 4863Free PE 0Allocated PE 4863PV UUID RYZCne-Xpic-a6Fe-TDQO-M4AI-tsmf-vkHFmQ"/dev/sdb1" is a new physical volume of "<50.00 GiB"--- NEW Physical volume ---PV Name /dev/sdb1VG Name PV Size <50.00 GiBAllocatable NOPE Size 0 Total PE 0Free PE 0Allocated PE 0PV UUID WVt5dy-mqhY-O9oo-OKQ8-1ll4-682A-xFLuTp
[root@localhost ~]# vgextend centos /dev/sdb1Volume group "centos" successfully extended
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm /└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 part
sr0 11:0 1 4.3G 0 rom
[root@localhost ~]# lvextend -L +49G /dev/centos/root Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to <66.00 GiB (16895 extents).Logical volume centos/root successfully resized.
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 66G 0 lvm /└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 part └─centos-root 253:0 0 66G 0 lvm /
sr0 11:0 1 4.3G 0 rom
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1113856 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4455424 to 17300480
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 66G 0 lvm /└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 part └─centos-root 253:0 0 66G 0 lvm /
sr0 11:0 1 4.3G 0 rom
[root@localhost ~]# df -hl
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 66G 2.0G 64G 4% /
devtmpfs 898M 0 898M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.6M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 1014M 146M 869M 15% /boot
tmpfs 182M 0 182M 0% /run/user/0
[root@localhost ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 66G 2.0G 64G 4% /
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.6M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 146M 869M 15% /boot
tmpfs tmpfs 182M 0 182M 0% /run/user/0