How to always mount removable devices with "noatime"?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to always mount removable devices with "noatime"?
I've noticed mounting USB-drives and USB-sticks with "noatime" boosts writing big files to them even by 50-80 % (measured with clock). I am very familiar with udev rules, too.
What I want to do, is not to create an udev rule for any specific drive or stick (I know how to do this), but to cause the Linux kernel to ALWAYS mount ANY USB or FireWire drive with certain options, in this case "noatime".
This includes automatic (KDE, GNOME, etc.) and also manual mounting - I tend to forget to specify "-o noatime" when I issue the "mount" command and while I can of course "mount -o remount,noatime" while it's copying, it tends to freeze and in the end I either have to abort the copying operation or wait for ages. One way coming to my mind is aliasing "mount" with "mount -o noatime", but I fear this might cause issues in the system. I also prefer to use autofs only for network drives (NFS).
Where could I specify "noatime" as the default option for all removable devices?
For gnome, theres a couple of options: in gconf-editor /system/storage/default_options, you can add filesystems and put the noatime option onto every one of those (you really only need ntfs, vfat, ext*).
Gnome uses gnome-mount to do its actual mounting. Hacking the source to include noatime into the mount flags is very easy too, but slightly more advanced.
If you want to be even more advanced, you can hack the kernel. The relevant file is fs/namespace.c around line 1927, you can change that to allow noatime permanently for all calls to mount. This option might seem radical, but Ive been using this since 2.20 kernels with no issues whatsoever.
As for KDE, I am not too sure. I believe kde 3.5 uses HAL, but KDE4 dont know.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.