df 和 fdisk 中的分区大小不同

df 和 fdisk 中的分区大小不同

使用 df 和 fdisk 命令时,我看到的大小不同。请帮忙!

DF-H

Filesystem                  Size  Used Avail Use% Mounted on
udev                         16G  4.0K   16G   1% /dev
tmpfs                       3.2G  820K  3.2G   1% /run
/dev/mapper/spar1--vg-root  9.7G  6.2G  3.1G  68% /
none                        4.0K     0  4.0K   0% /sys/fs/cgroup
none                        5.0M     0  5.0M   0% /run/lock
none                         16G     0   16G   0% /run/shm
none                        100M     0  100M   0% /run/user
/dev/sda1                   236M   41M  183M  19% /boot

sudo fdisk -l

Disk /dev/sda: 292.3 GB, 292326211584 bytes
255 heads, 63 sectors/track, 35539 cylinders, total 570949632 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 identifier: 0x0009bd3a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   570947583   285222913    5  Extended
/dev/sda5          501760   570947583   285222912   8e  Linux LVM

Disk /dev/mapper/spar1--vg-root: 54.5 GB, 54525952000 bytes
255 heads, 63 sectors/track, 6629 cylinders, total 106496000 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 identifier: 0x00000000

Disk /dev/mapper/spar1--vg-root doesn't contain a valid partition table

Disk /dev/mapper/spar1--vg-swap_1: 125.8 GB, 125829120000 bytes
255 heads, 63 sectors/track, 15297 cylinders, total 245760000 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 identifier: 0x00000000

Disk /dev/mapper/spar1--vg-swap_1 doesn't contain a valid partition table

答案1

调整分区大小您可以使用以下方法扩展逻辑卷:

sudo lvextend -L +5g foo/bar

这将为 foo 卷组中的 bar 逻辑卷添加 5 GB。您可以根据需要指定绝对大小,而不是相对大小,只需省略前导 + 即可。空间是从 bar 卷组中任何位置的可用空间分配的。如果您有多个物理卷,您可以将其中一个或多个的名称添加到命令末尾,以限制应使用哪些物理卷来满足请求。

扩展逻辑卷后,您需要扩展文件系统以使用新空间。对于 ext 3/4,您只需运行:

sudo resize2fs /dev/foo/bar

相关内容