将 SSD 1TB 升级到 2TB:pv、vg、lv 和 fdisk 正常。df 显示无变化

将 SSD 1TB 升级到 2TB:pv、vg、lv 和 fdisk 正常。df 显示无变化

我正在将 20.04 服务器 SSD 从 1TB 升级到 2TB。传输过程很顺利,但我似乎在最后一步卡住了,试图让新空间出现。、、pvdisplay和都显示 2TB 的空间。当我用检查时,它仍然反映原始分区大小。Resize2fs 抛出错误“找不到有效的文件系统超级块”。我遗漏了什么?vgdisplaylvdisplayfdiskdf

>> user@host ~ % sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               ubuntu-vg
  PV Size               <1.82 TiB / not usable <3.07 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              476547
  Free PE               0
  Allocated PE          476547
  PV UUID               Dq...Op

>> user@host ~ % sudo vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <1.82 TiB
  PE Size               4.00 MiB
  Total PE              476547
  Alloc PE / Size       476547 / <1.82 TiB
  Free  PE / Size       0 / 0
  VG UUID               jl...pz

>> user@host ~ % sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                Hw...Qx
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-03-20 20:20:34 -0700
  LV Status              available
  # open                 1
  LV Size                <1.82 TiB
  Current LE             476547
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

>> user@host ~ % sudo fdisk -l
Disk /dev/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: SanDisk SDSSDH3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 29...AB

Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624    3147775    2097152    1G Linux filesystem
/dev/sda3  3147776 3907029134 3903881359  1.8T Linux filesystem

Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 1.82 TiB, 1998782988288 bytes, 3903873024 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

>> sudo resize2fs /dev/sda3
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Device or resource busy while trying to open /dev/sda3
Couldn't find valid filesystem superblock.

>> user@host ~ % df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                               26G  3.6M   26G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  937G  462G  435G  52% /
tmpfs                              126G     0  126G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/sda2                          976M  317M  593M  35% /boot
/dev/sda1                          511M  7.9M  504M   2% /boot/efi
tmpfs                               26G     0   26G   0% /run/user/1000

答案1

解决方法:我关注的是 LVM 同意已调整大小的物理分区。我需要做的是调整 (编辑)文件系统内的映射的 LV。

而不是这样: resize2fs /dev/sda3

应该是: resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

相关内容