ext4 fs 的 LVM 快照看起来不太干净

ext4 fs 的 LVM 快照看起来不太干净

我创建了一个已安装的 ext4 fs 的 LVM 快照:

lvcreate -L 10GiB -s -n "root-snapshot" "/dev/myvgname/root"

如果我在 /dev/myvgname/root-snapshot 上运行 e2fsck,它会显示:

e2fsck 1.42.5 (29-Jul-2012)
Clearing orphaned inode 263640 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 260744 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 266864 (uid=0, gid=0, mode=0100600, size=0)
Clearing orphaned inode 261058 (uid=103, gid=107, mode=0100600, size=0)
Clearing orphaned inode 261057 (uid=103, gid=107, mode=0100600, size=0)
Clearing orphaned inode 261001 (uid=103, gid=107, mode=0100600, size=0)
Clearing orphaned inode 260918 (uid=103, gid=107, mode=0100600, size=0)
Clearing orphaned inode 260913 (uid=103, gid=107, mode=0100600, size=0)
root: clean, 52533/977280 files, 811160/3905536 blocks

为什么要清除这些孤立的 inode?LVM 不应该使底层 fs 处于一致(干净)状态吗?

答案1

拍摄快照时,文件系统会被冻结,但该状态与完全卸载的文件系统的状态并不完全相同。来自man fsfreeze

Note that even after freezing, the on-disk filesystem  can  con‐
tain  information  on  files  that  are  still in the process of
unlinking.  These files will not be unlinked until the  filesys‐
tem is unfrozen or a clean mount of the snapshot is complete.

相关内容