如何从可启动 USB 在加密(luks)磁盘上运行 fsck?

如何从可启动 USB 在加密(luks)磁盘上运行 fsck?

我使用 LUKS 加密了我的磁盘。每次启动后,我的机器都会抛出“磁盘很可能很快会失效”消息。为了解决这个问题,我尝试fsck在根分区上运行。我尝试fsck在恢复模式下运行,但失败了,并显示以下消息:

/lib/recovery-mode/recovery-menu: line 80: /etc/default/rcs: No such file or directory
fsck from utli-linux 2.37.2
/dev/mapper/vgubuntu-root is mounted. 
e2fsck: Cannot continue, aborting.

因此,我尝试从 USB 启动并从那里运行 fsck。但是,似乎不起作用,因为我得到以下输出并且 fsck 立即终止:

fsck from util-linux 2.37.2
[/usr/sbin/fsck.ext4 (1) -- /dev/mapper/vgubuntu-root]
fsck.ext4 -y -C0 /dev/mapper/vgubuntu-root 
e2fsck 1.46.5 (30-Dec-2021)
/dev/mapper/vgubuntu-root: clean, 1254485/60784640 files, 52105495/243116032 block

以下是的输出lsblk

NAME        FSTYPE FSVER     LABEL                    UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
/dev/loop0  squash 4.0                                                                             0   100% /rofs
/dev/loop1  squash 4.0                                                                             0   100% /snap/bare/5
/dev/loop2  squash 4.0                                                                             0   100% /snap/firefox/1635
/dev/loop3  squash 4.0                                                                             0   100% /snap/gnome-3-38-2004/112
/dev/loop4  squash 4.0                                                                             0   100% /snap/gtk-common-themes/1535
/dev/loop5  squash 4.0                                                                             0   100% /snap/snapd/16292
/dev/loop6  squash 4.0                                                                             0   100% /snap/snap-store/582
/dev/loop7  squash 4.0                                                                             0   100% /snap/snapd-desktop-integration/14
/dev/loop8  squash 4.0                                                                             0   100% /snap/core20/1587
/dev/sda                                                                                                    
├─/dev/sda1 vfat   FAT32                              DFFE-1B40                                             
├─/dev/sda2 ext4   1.0                                b3b523d0-b935-40f1-9bea-f387cf4a4282                  
└─/dev/sda3 crypto 2                                  80422624-4c6b-4cbb-a969-eb110f60b15e                  
  └─/dev/mapper/luks-80422624-4c6b-4cbb-a969-eb110f60b15e
            LVM2_m LVM2 001                           iYBO3Z-pyDY-9Yd7-IqGA-CNaq-jFrU-BArfra                
    ├─/dev/mapper/vgubuntu-root
    │       ext4   1.0                                123ef630-60c6-45de-a2d2-da21d415b98d                  
    └─/dev/mapper/vgubuntu-swap_1
            swap   1                                  0bf6ba3c-a03a-4386-9d5a-c5b49765b8d6                  
/dev/sdb    iso966 Joliet Ex Ubuntu 22.04.1 LTS amd64 2022-08-10-16-21-45-00                                
├─/dev/sdb1 iso966 Joliet Ex Ubuntu 22.04.1 LTS amd64 2022-08-10-16-21-45-00                       0   100% /cdrom
├─/dev/sdb2 vfat   FAT12     ESP                      8D6C-A9F8                                             
├─/dev/sdb3                                                                                                 
└─/dev/sdb4 ext4   1.0       writable                 0498f4be-7be3-4d80-9ffa-53cb6e2797af     49.9G     0% /var/crash
                                                                                                            /var/log

输出pvdisplay

  --- Physical volume ---
  PV Name               /dev/mapper/luks-80422624-4c6b-4cbb-a969-eb110f60b15e
  VG Name               vgubuntu
  PV Size               <929.33 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              237907
  Free PE               0
  Allocated PE          237907
  PV UUID               iYBO3Z-pyDY-9Yd7-IqGA-CNaq-jFrU-BArfra

输出vgdisplay

  --- Volume group ---
  VG Name               vgubuntu
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               929.32 GiB
  PE Size               4.00 MiB
  Total PE              237907
  Alloc PE / Size       237907 / 929.32 GiB
  Free  PE / Size       0 / 0   
  VG UUID               zUsuN2-Juyn-1l1V-hyRN-VHbf-dtOh-lyByGZ

输出lvdisplay

  --- Logical volume ---
  LV Path                /dev/vgubuntu/root
  LV Name                root
  VG Name                vgubuntu
  LV UUID                2Iwd2Y-VcsI-fhf6-atcw-ijVb-lcsN-Rw3ZS3
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2022-09-16 09:46:16 +0000
  LV Status              available
  # open                 0
  LV Size                927.41 GiB
  Current LE             237418
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/vgubuntu/swap_1
  LV Name                swap_1
  VG Name                vgubuntu
  LV UUID                YtYA2H-aKVB-f3bT-Fvi3-m46S-upM1-vWMRwR
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2022-09-16 09:46:17 +0000
  LV Status              available
  # open                 0
  LV Size                1.91 GiB
  Current LE             489
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

我在运行 fsck 命令之前已解锁磁盘。

为什么 fsck 在我的机器上无法正确运行?我这里遗漏了什么?

uname -a输出:

Linux ubuntu 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a输出:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

相关内容