![引导 2 紧急模式:无法挂载 /Var](https://linux22.com/image/196962/%E5%BC%95%E5%AF%BC%202%20%E7%B4%A7%E6%80%A5%E6%A8%A1%E5%BC%8F%EF%BC%9A%E6%97%A0%E6%B3%95%E6%8C%82%E8%BD%BD%20%2FVar.png)
CentOS7 启动进入紧急模式。以下是发现的错误journalctl -xb
sd 0:0:0:0: [sda] Asking for cache data failed
sd 0:0:0:0: [sda] Assuming drive cache: write through
gspca_vc032x: reg_r err -32
bcma: bus0: No SPROM available
EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
Failed to mount /borg
Failed to mount /var
我在 fstab 中看到 /var 所以 /var 确实有一个挂载点
/dev/nvmeVg/var /var ext4 defaults 0 0
就在之前,我缩小了尺寸,这样我就可以增加我成功做到的nvmeVg-var
尺寸。nvmeVg-home
然后我调整了文件系统的大小并期望正常重新启动,但进入了紧急模式。命令是
lvreduce -L44G /dev/mapper/nvmeVq-var
lvextend -L181G /dev/mapper/nvmeVg-home
resize2fs /dev/mapper/nvmeVg-home
│ ├─nvmeVg-var 254:0 0 44G 0 lvm
│ └─nvmeVg-home 254:1 0 181G 0 lvm
我跑了sudo e2fsck -C0 /dev/mapper/nvmeVg-var
,得到了/dev/mapper/nvmeVg-var is in use
我也尝试过
[root@localhost-live DataCabinet]# e2fsck -C0 -f /dev/mapper/nvmeVg-var
e2fsck 1.45.6 (20-Mar-2020)
The filesystem size (according to the superblock) is 32768000 blocks
The physical size of the device is 11534336 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no
Pass 1: Checking inodes, blocks, and sizes
Error reading block 11534368 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 11534369 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 11534370 (Invalid argument) while getting next inode from scan. Ignore error<y>? no
Error while scanning inodes (2759055): Can't read next inode
Error writing block 11534368 (Invalid argument). Ignore error<y>? yes
Error writing block 11534369 (Invalid argument). Ignore error<y>? yes
e2fsck: aborted
我已经找到了备份 /var/www
现在接下来的步骤是在恢复之前调整文件系统的大小或尝试修复文件系统?后者对我来说很有意义。
[root@localhost-live snapshots]# fdisk -l /dev/mapper/nvmeVg-var
Disk /dev/mapper/nvmeVg-var: 44 GiB, 47244640256 bytes, 92274688 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
[root@localhost-live snapshots]# fdisk /dev/mapper/nvmeVg-var
Welcome to fdisk (util-linux 2.36.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x26e63ccd.
答案1
如果您在运行之前确实没有执行 aresize2fs /dev/mapper/nvmeVg-var 44G
或等效操作lvreduce -L44G /dev/mapper/nvmeVg-var
,那么您肯定已经通过切断文件系统的尾部而损坏了文件系统。
lvmcfgrestore
而且由于您已经扩展了其他文件系统,因此使用标准备份回滚到以前的配置/etc/lvm/backup
可能也不是一个好的选择,因为它很可能会/home
以同样的方式破坏您的系统。
/var
从最近的备份中恢复将是一个很好的解决方案。但我想你没有这个,是吗?
您可能必须运行e2fsck -C0 -f /dev/mapper/nvmeVg-var
并接受一条关于文件系统的大小大于底层设备的可怕错误消息。然后它有望完成您无意中执行的尾部截肢过程,并将文件系统大小设置为与 LV 当前大小匹配的值。