Page 1 of 2
noatime mount and find command
Posted: 30. Nov 2010, 22:39
by witek
I`ve added an entry regarding
/tmp cleanup. Another method often used is using find, ie:
Code: Select all
#!/bin/bash
find /tmp -type f -atime +5 -exec rm {} \\;
I don`t understand one thing here: the filesystem in Salix is mounted with
noatime option by default. Does it influence
find -atime behaviour? I tested and it looks that
find is able to see access time but why should it if mounted with noatime? Or maybe it depends on the type of filesystem (I`m using XFS)
Re: notime mount and find command
Posted: 30. Nov 2010, 22:44
by gapan
I would advise against removing files from /tmp with a cronjob. There are files in there that are actually needed in a running session. The safest way to do it would be during shutdown by adding the appropriate entries in rc.local_shutdown. Or by mounting /tmp in RAM with tmpfs in the first place as I'm doing.
Re: noatime mount and find command
Posted: 30. Nov 2010, 22:46
by thenktor
File access time still is updated when the files are modified but not if the files are read.
If a file system has been mounted with this option, reading accesses to the file system will no longer result in an update to the atime information associated with the file like we have explained above. The importance of the noatime setting is that it eliminates the need by the system to make writes to the file system for files which are simply being read. Since writes can be somewhat expensive, this can result in measurable performance gains. Note that the write time information to a file will continue to be updated anytime the file is written to.
source:
http://tldp.org/LDP/solrhe/Securing-Opt ... sec73.html
Re: noatime mount and find command
Posted: 30. Nov 2010, 22:48
by witek
@gapan:
As you can read in what I`ve written in the wiki I`m modifying rc.S, not using cron. But I wonder aboyt noatime and find by the way.
Re: noatime mount and find command
Posted: 30. Nov 2010, 22:48
by Shador
witek wrote:I don`t understand one thing here: the filesystem in Salix is mounted with noatime option by default. Does it influence find -atime behaviour?
"noatime" doesn't mean there is no atime at all. It just means the access time of files isn't updated on access.
I didn't confirm this but by common sense I assume that it's updated together with ctime and mtime even though "noatime" is activated.
So with noatime enabled you're actually using the ctime and not the atime.
Seems thenktor was faster.

Re: noatime mount and find command
Posted: 30. Nov 2010, 22:52
by witek
Thanks for clarifying this issue. What do you think about the method I described in the wiki? Why isn`t /tmp completely wiped during boot in Salix by default?
Re: noatime mount and find command
Posted: 30. Nov 2010, 22:52
by gapan
witek wrote:@gapan:
As you can read in what I`ve written in the wiki I`m modifying rc.S, not using cron. But I wonder aboyt noatime and find by the way.
You're specifically mentioning crontab and listing a script that you're proposing to be run from crontab. Not a good idea.
Re: noatime mount and find command
Posted: 30. Nov 2010, 22:54
by thenktor
witek wrote:Why isn`t /tmp completely wiped during boot in Salix by default?
Because there is no need to do it

Re: noatime mount and find command
Posted: 30. Nov 2010, 22:58
by witek
gapan wrote:
You're specifically mentioning crontab and listing a script that you're proposing to be run from crontab. Not a good idea.
I must have been misunderstood: I meant to modify rc.S (crontab is only a possibility not described in my entry). I hope now it reads better.
Re: noatime mount and find command
Posted: 30. Nov 2010, 23:15
by gapan
No, it really doesn't. Crontab is simply not a safe option here and it should not be mentioned at all. Also, editing rc.S or any other standard rc script is not advisable. An update of the sysvinit-scripts will wipe all edits. That's what rc.local and rc.local_shutdown are for.