Parted 显示 2TB 分区,但 df 显示其为 98GB

Parted 显示 2TB 分区,但 df 显示其为 98GB

我的根分区空间不足,df 输出:

Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              3.1G  2.0M  3.1G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   98G   98G     0 100% /
tmpfs                               16G     0   16G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1p2                     2.0G  379M  1.5G  21% /boot
/dev/nvme0n1p1                     1.1G  5.3M  1.1G   1% /boot/efi
tmpfs                              3.1G  4.0K  3.1G   1% /run/user/1000

lvm 卷组有~2TB:

  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.86 TiB
  PE Size               4.00 MiB
  Total PE              487599
  Alloc PE / Size       487599 / 1.86 TiB
  Free  PE / Size       0 / 0
  VG UUID               5faYrE-8xXv-a4A7-yD6L-acvL-w0rr-Qx9oNN

并且逻辑卷也显示~2TB:

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                y2SzMl-qmb6-cr3r-wphB-6F28-3xfs-nJXN7Y
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2022-07-21 19:40:30 +0000
  LV Status              available
  # open                 1
  LV Size                1.86 TiB
  Current LE             487599
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

因此我以为我只需要扩展分区,但是当我使用 parted 来扩展分区时,它已经显示为 2TB。

parted /dev/mapper/ubuntu--vg-ubuntu--lv
GNU Parted 3.4
Using /dev/mapper/ubuntu--vg-ubuntu--lv
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 2045GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  2045GB  2045GB  ext4

(parted)

有人知道我这里漏掉了什么吗?为什么/只有 98G,而 lvm 和 parted 都暗示它比这大得多?

答案1

看起来像:

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

解决了我的问题。

相关内容