“lvdisplay”显示的大小与“df -h”命令不同,为什么?

“lvdisplay”显示的大小与“df -h”命令不同,为什么?

让我们开始说,经过几次尝试,从这个开始邮政我可能搞乱了分区系统或其他东西。查看每个命令的以下输出:

# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda6
  VG Name               pc_rperez_lvm
  PV Size               105.38 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              26976
  Free PE               0
  Allocated PE          26976
  PV UUID               A3t5RY-fk2V-qud5-hQQ5-coJ0-5Z8X-wLerqT

# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/root
  LV Name                root
  VG Name                pc_rperez_lvm
  LV UUID                m7XejM-82cZ-hODn-nT8H-y2BM-3B4s-lq2xgn
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/home
  LV Name                home
  VG Name                pc_rperez_lvm
  LV UUID                Ehl9tF-XV30-uF4Y-T1Bc-WB8r-Pfim-ONQFn3
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                47.38 GiB
  Current LE             12128
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/swap
  LV Name                swap
  VG Name                pc_rperez_lvm
  LV UUID                pJuBnV-fhD1-NgOe-xMUc-gck8-CfeM-YkQHAX
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                8.00 GiB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

$ df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                             3.9G     0  3.9G   0% /dev
tmpfs                                3.9G   32M  3.9G   1% /dev/shm
tmpfs                                3.9G  1.4M  3.9G   1% /run
tmpfs                                3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/pc_rperez_lvm-root       50G   38G  9.2G  81% /
tmpfs                                3.9G  2.2M  3.9G   1% /tmp
/dev/sda5                            453M  140M  286M  33% /boot
/dev/mapper/pc_rperez_lvm-home       11G  9.3G  591M  95% /home
tmpfs                                798M   24K  798M   1% /run/user/1000

为什么lvdisplay显示的尺寸与 不同df -h?分区的实际大小是多少?我有多少可用空间?

答案1

根据乔丹的评论:

文件系统不跨越整个卷。resize2fs /dev/mapper/pc_rperez_lvm-home如果您使用的是 ext2/3/4,应该修复它。

顺便说一句,在实时系统上执行此操作是安全的,即使已安装文件系统,但您应该始终有备份以防万一。

相关内容