2014-04-17 0:33 GMT+08:00 Andreas Dilger <adilger@xxxxxxxxx>: > On Apr 16, 2014, at 2:46 AM, Wayne Chou <gmmark12@xxxxxxxxx> wrote: >> I create a LVM snapshot from a mounted ext4 file system by: >> "lvcreate -kn --snapshot --name snap1 /dev/mapper/vg1/lv1" >> >> And after I mount this snapshot to another folder like: >> "mount -t ext4 /dev/mapper/vg1-snap1 /mnt/test" >> the following messages prompted in dmesg: >> >> [ 2445.480908] EXT4-fs (dm-6): orphan cleanup on readonly fs >> [ 2445.502317] EXT4-fs (dm-6): ext4_orphan_cleanup: deleting >> unreferenced inode 131180 >> [ 2445.502355] EXT4-fs (dm-6): ext4_orphan_cleanup: deleting >> unreferenced inode 131176 >> [ 2445.502360] EXT4-fs (dm-6): ext4_orphan_cleanup: deleting >> unreferenced inode 131175 >> [ 2445.502366] EXT4-fs (dm-6): ext4_orphan_cleanup: deleting >> unreferenced inode 131174 >> [ 2445.502372] EXT4-fs (dm-6): ext4_orphan_cleanup: deleting >> unreferenced inode 131173 >> [ 2445.502376] EXT4-fs (dm-6): 5 orphan inodes deleted > > The first question is whether you are experiencing any actual problems > as a result of the orphan inode cleanup? This is normal behaviour if > there are applications with open-unlinked files when the snapshot is taken, > or if the system crashes at this point. The orphan cleanup will free up > these open-unlinked inodes and their blocks at mount time, keeping the > filesystem consistent. > >> To find out what the reason is, I use 'lsof' on lv1's mount point before I take >> the snapshot. Then I got some MySQL services that opened these temporary files >> which causes the orphan inodes in LVM snapshots: >> mysqld 26257 admin 7u REG 253,5 0 131173 >> /LV1/.system/tmp/ibTidhzb (deleted) >> mysqld 26257 admin 8u REG 253,5 0 131174 >> /LV1/.system/tmp/ibgWhCYc (deleted) >> mysqld 26257 admin 9u REG 253,5 0 131175 >> /LV1/.system/tmp/ibJE5pne (deleted) >> mysqld 26257 admin 10u REG 253,5 0 131176 >> /LV1/.system/tmp/ibsvL9hg (deleted) >> mysqld 26257 admin 14u REG 253,5 0 131180 >> /LV1/.system/tmp/ibcz1qOM (deleted) >> >> >> From the above investigation, the problem gets solved if I >> disable the MySQL service before taking the LVM snapshot. >> >> However, I wonder if there's any other way to solve this issue. >> For example, can I just blindly remove these orphan inodes when >> ext4_freeze() is called? Thank you. > > What problem needs to be solved? Is it just the printing of these > error messages that is confusing, or something else? > > Cheers, Andreas > > Thank you Andreas for the quick reply. Recently I use lvm2 to take some snapshots with a mounted file system, and sometimes I'll take some read-only LVM snapshots with: "lvcreate -kn -pr --snapshot --name snap2 /dev/mapper/vg1/lv1" The read-only snapshots still can be mounted and works fine, but the orphan inodes (caused by those open-unlink file) cannot be cleaned at mount time. So what my question is: If I cannot clean them now, can I prevent this to happen? Currently to prevent any open-unlink file during taking LVM snapshots works for me. On the other hand, I thought LVM2 would call ext4_freeze() and ext4_unfreeze() before and after the snapshot taking, so I also want to ask if it's possible to put ext4_fs into a consistent state when the ext4_freeze() is called? Thank you for your help. Best regards, - Wayne -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html