使用 fdisk 增大卷大小,但不使用 df

使用 fdisk 增大卷大小,但不使用 df

我正在尝试增加 /dev/mapper/centos-root 上的可用磁盘空间,但是,我不确定为什么 df -h 没有报告增加的大小。

$ sudo fdisk -l

Disk /dev/sda: 68.7 GB, 68719476736 bytes, 134217728 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: 0x000a12e4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   132120575    65547264   8e  Linux LVM

Disk /dev/mapper/centos-swap: 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: 64.6 GB, 64634224640 bytes, 126238720 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

相对:

$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   18G   13G  4.8G  73% /
devtmpfs                 906M     0  906M   0% /dev
tmpfs                    914M     0  914M   0% /dev/shm
tmpfs                    914M  8.6M  906M   1% /run
tmpfs                    914M     0  914M   0% /sys/fs/cgroup
/dev/sda1                497M  140M  357M  29% /boot
.host:/                  465G  432G   34G  93% /mnt/hgfs
.host:/-vagrant          465G  432G   34G  93% /vagrant
.host:/-etc-bolt         465G  432G   34G  93% /etc/bolt

在 fdisk 命令中有: Disk /dev/mapper/centos-root: 64.6 GB, 64634224640 bytes, 126238720 sectors 在 df -h 命令中有: /dev/mapper/centos-root 18G 13G 4.8G 73% /

答案1

这为我解决了这个问题:

sudo xfs_growfs /dev/mapper/centos-root

相关内容