我有几个由 virt-resize 创建的 vps guest 虚拟机。我通过创建快照和 rsync 文件内容对来宾进行日常备份。但其中一些没有干净的磁盘映像。
一旦我创建快照并挂载快照逻辑卷:
lvcreate -L5G -s -n guest15_snapshot /dev/vgroup/guest15
mount -o loop,offset=262144 /dev/group/guest15_snapshot /mnt/snapshot_dir
不良 inocdes 可通过以下方式找到/var/log/messages
:
Jul 2 11:21:41 server lvm[10346]: Monitoring snapshot group-guest17_snapshot
Jul 2 11:21:41 server kernel: EXT4-fs warning (device loop0): ext4_orphan_get: bad orphan inode 198! e2fsck was run?
Jul 2 11:21:41 server kernel: ext4_test_bit(bit=197, block=145) = 0
Jul 2 11:21:41 server kernel: inode=(null)
Jul 2 11:21:41 server kernel: EXT4-fs (loop0): recovery complete
Jul 2 11:21:41 server kernel: EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts:
Jul 2 11:21:42 server lvm[10346]: No longer monitoring snapshot group-guest17_snapshot
Jul 2 11:21:46 server lvm[10346]: Monitoring snapshot group-guest19_snapshot
Jul 2 11:21:46 server kernel: EXT4-fs warning (device loop0): ext4_orphan_get: bad orphan inode 25964! e2fsck was run?
Jul 2 11:21:46 server kernel: ext4_test_bit(bit=1387, block=148) = 0
Jul 2 11:21:46 server kernel: inode=(null)
Jul 2 11:21:46 server kernel: EXT4-fs (loop0): recovery complete
Jul 2 11:21:46 server kernel: EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts:
Jul 2 11:22:22 server lvm[10346]: No longer monitoring snapshot guest-vm19_snapshot
我试过guestfish
:
guestfish -a /dev/vgroup/guest17
><fs> run
><fs> fsck ext4 /dev/sda1
大多数时候它返回0x1
,这意味着错误已修复。
但是一旦我再次挂载图像,坏的索引节点就会再次出现。
如何永久修复坏的 inode?