Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't keep recently accessed files during housekeeping
I have just unpacked an old backup, changed the setting delete_device_after and tried to export a backup. This did not delete anything because all files were considered recent by their atime and crtime. Here is an example file statistics right after unpacking a backup: $ stat image_2021-03-06_21-40-28.jpg File: image_2021-03-06_21-40-28.jpg Size: 66715 Blocks: 136 IO Block: 4096 regular file Device: 254,3 Inode: 5338300 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ user) Gid: ( 1000/ user) Access: 2023-11-28 14:00:12.436093996 +0000 Modify: 2021-03-13 18:21:28.000000000 +0000 Change: 2023-11-28 13:57:56.641835196 +0000 Birth: 2023-11-28 13:57:56.641835196 +0000 atime is updated simply by opening a file, it is not a good time reference e.g. if user just viewed old media and then enabled deletion of files from device. mtime is the right thing to check, it is the time blob was written to the disk, this commit keeps this check. ctime is the time of metadata modification, such as permission changes, we are not interested in this. crtime is not even standardized and not implemented by some filesystems. In my case it is the time when I unpacked the backup, while the file in the backup is actually old.
- Loading branch information