我正在將 20.04 伺服器 SSD 從 1TB 升級到 2TB。轉移進行得很順利,但我似乎陷入了試圖讓新空間出現的最後一步。pvdisplay
、vgdisplay
、lvdisplay
、fdisk
均顯示 2TB 空間。當我用 進行檢查時df
,它仍然反映原始分割區大小。 Resize2fs 拋出錯誤「無法找到有效的檔案系統超級區塊」。我缺什麼?
>> 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