Ubuntu 上的卷组损坏

Ubuntu 上的卷组损坏

遇到了 FDISK/LVM 问题:需要向 Ubuntu Server 20 添加额外的新磁盘。它使用默认设置配置使用 LVM/VG 进行存储设置。

使用fdisk /dev/mapper/ubuntu--vg-ubuntu--lv,尝试在这里添加一个新的分区(这是错误)。

当前设置:

root@ubuntu-2004:~# lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0 55.5M  1 loop /snap/core18/2284
loop1                       7:1    0 55.5M  1 loop /snap/core18/2409
loop2                       7:2    0 61.9M  1 loop /snap/core20/1518
loop3                       7:3    0 61.9M  1 loop /snap/core20/1434
loop4                       7:4    0 67.2M  1 loop /snap/lxd/21835
loop5                       7:5    0 67.8M  1 loop /snap/lxd/22753
loop6                       7:6    0   47M  1 loop /snap/snapd/16010
loop7                       7:7    0 44.7M  1 loop /snap/snapd/15534
sda                         8:0    0   16G  0 disk
├─sda1                      8:1    0  512M  0 part /boot/efi
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0 14.5G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0 14.5G  0 lvm  /


root@ubuntu-2004:~# fdisk -l
Disk /dev/loop0: 55.52 MiB, 58204160 bytes, 113680 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 /dev/loop1: 55.55 MiB, 58232832 bytes, 113736 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 /dev/loop2: 61.95 MiB, 64933888 bytes, 126824 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 /dev/loop3: 61.92 MiB, 64909312 bytes, 126776 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 /dev/loop4: 67.25 MiB, 70508544 bytes, 137712 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 /dev/loop5: 67.83 MiB, 71106560 bytes, 138880 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 /dev/loop6: 46.98 MiB, 49233920 bytes, 96160 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 /dev/loop7: 44.69 MiB, 46845952 bytes, 91496 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 /dev/sda: 16 GiB, 17179869184 bytes, 33554432 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E79D83A9-F2D1-4756-B8B3-1F47B0C95638

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 33552383 30404608 14.5G Linux filesystem


Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 14.51 GiB, 15565062144 bytes, 30400512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


root@ubuntu-2004:~# lvs
  LV        VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <14.50g


root@ubuntu-2004:~# pvs
  PV         VG        Fmt  Attr PSize   PFree
  /dev/sda3  ubuntu-vg lvm2 a--  <14.50g    0


root@ubuntu-2004:~# vgs
  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n- <14.50g    0


root@ubuntu-2004:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               915M     0  915M   0% /dev
tmpfs                              192M  964K  191M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   15G  7.8G  5.8G  58% /
tmpfs                              959M     0  959M   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              959M     0  959M   0% /sys/fs/cgroup
/dev/loop1                          56M   56M     0 100% /snap/core18/2409
/dev/loop0                          56M   56M     0 100% /snap/core18/2284
/dev/loop2                          62M   62M     0 100% /snap/core20/1518
/dev/loop3                          62M   62M     0 100% /snap/core20/1434
/dev/loop4                          68M   68M     0 100% /snap/lxd/21835
/dev/loop5                          68M   68M     0 100% /snap/lxd/22753
/dev/loop6                          47M   47M     0 100% /snap/snapd/16010
/dev/loop7                          45M   45M     0 100% /snap/snapd/15534
/dev/sda2                          976M  208M  701M  23% /boot
/dev/sda1                          511M  5.3M  506M   2% /boot/efi
tmpfs                              192M     0  192M   0% /run/user/1000

这是包含所有分区的系统 LVM。当按上述方式运行 fdisk 时,收到以下通知:

Be careful before using the write command.

The old ext4 signature will be removed by a write command.

The device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x622b37e2.

分区表已写入,并且似乎覆盖/删除了 ext4 签名并设置了 dos 类型磁盘标签。

新驱动器最终被添加到 LVM,但在尝试添加可用空间时,使用resize2fs -p /dev/ubuntu-vg/ubuntu-lv有关Bad magic number in super-block while trying to open...

似乎 VG 的完整性存在问题,这将阻止系统启动。我可以恢复旧的 ext4 签名,然后安全地重启系统吗?添加新空间不太重要,可以稍后再做。

相关内容