# 根目录扩容
[root@sc1 ~]
磁盘 /dev/sda:64.4 GB, 64424509440 字节,125829120 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000a2dae
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 125829119 61864960 8e Linux LVM
磁盘 /dev/sdb:214.7 GB, 214748364800 字节,419430400 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xdd080451
设备 Boot Start End Blocks Id System
/dev/sdb2 2048 419430399 209714176 83 Linux
磁盘 /dev/mapper/centos-root:249.3 GB, 249292652544 字节,486899712 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-swap:6442 MB, 6442450944 字节,12582912 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-home:18.7 GB, 18668847104 字节,36462592 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
[root@sc1 ~]
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xf60c7ee0 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM”
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@sc1 ~]
meta-data=/dev/sdb2 isize=512 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@sc1 ~]
lvm> pvcreate /dev/sdb2
WARNING: xfs signature detected on /dev/sdb2 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/sdb2.
Physical volume "/dev/sdb2" successfully created.
lvm> vgextend centos /dev/sdb2
Volume group "centos" successfully extended
lvm> lvextend -l +204800 /dev/mapper/centos-root
Size of logical volume centos/root changed from <38.30 GiB (9804 extents) to <238.30 GiB (214604 extents).
Logical volume centos/root successfully resized.
lvm> lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID OeHFno-diSX-xWuQ-K8j6-tdpT-D0KE-YB3jxG
LV Write Access read/write
LV Creation host, time localhost, 2021-02-01 22:26:07 -0500
LV Status available
LV Size <238.30 GiB
Current LE 14924
Segments 3
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 ne6xL1-fepP-cE9h-WJzc-12Kw-FVzK-NNYU6i
LV Write Access read/write
LV Creation host, time localhost, 2021-02-01 22:26:07 -0500
LV Status available
LV Size <18.70 GiB
Current LE 4786
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 7mtj59-3PN7-1UbZ-QiJa-He5b-hGTz-SCpicW
LV Write Access read/write
LV Creation host, time localhost, 2021-02-01 22:26:07 -0500
LV Status available
LV Size 200.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
lvm> exit
Exiting.
[root@sc1 ~]
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=2333696 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=9334784, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=4558, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 9334784 to 60862464
[root@sc1 ~]
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 910M 0 910M 0% /dev/shm
tmpfs tmpfs 910M 9.5M 901M 2% /run
tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 233G 37G 196G 16% /
/dev/sda1 xfs 1014M 150M 865M 15% /boot
/dev/mapper/centos-home xfs 18G 33M 18G 1% /home
tmpfs tmpfs 182M 0 182M 0% /run/user/0