If I create a file in a file system and then snapshot the file system. Then delete the file. Is it guaranteed that while the snapshot exists no new file will be created with the same inode number as the deleted file? --chris -- This message posted from opensolaris.org
> From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- > > If I create a file in a file system and then snapshot the file system. > > Then delete the file. > > Is it guaranteed that while the snapshot exists no new file will be > created with the same inode number as the deleted file?I believe the answer to your question is No. Meaning, Yes an inode number could be recycled, in the present filesystem, although that inode number exists for some other object in a snapshot gone by. AFAIK. Informed guesses aside, here''s what I really have to say: You must have a special case, if you care about this. Because a snapshot is treated as a different device, it''s allowed for a new inode to be created in the present filesystem, having the same inode number. Generally speaking, there''s no reason you should care if an inode number gets recycled.
The reason for wanting to know is to try and find versions of a file. If a file is renamed then the only way to know that the renamed file was the same as a file in a snapshot would be if the inode numbers matched. However for that to be reliable it would require the i-nodes are not reused. If they are able to be reused then when an inode number matches I would also have to compare the real creation time which requires looking at the extended attributes. --chris -- This message posted from opensolaris.org
On Wed, May 19, 2010 at 05:33:05AM -0700, Chris Gerhard wrote:> The reason for wanting to know is to try and find versions of a file.No, there''s no such guarantee. The same inode and generation number pair is extremely unlikely to be re-used, but the inode number itself is likely to be re-used.> If a file is renamed then the only way to know that the renamed file > was the same as a file in a snapshot would be if the inode numbers > matched. However for that to be reliable it would require the i-nodes > are not reused.There''s also the crtime (creation time, not to be confused with ctime), which you can get with ls(1).> If they are able to be reused then when an inode number matches I > would also have to compare the real creation time which requires > looking at the extended attributes.Right, that''s what you''ll have to do. Nico --
Just to close this. It turns out you can''t get the crtime over NFS so without access to the NFS server there is only limited checking that can be done. I filed CR 6956379 Unable to open extended attributes or get the crtime of files in snapshots over NFS. --chris -- This message posted from opensolaris.org