Performance Tip: Disable Optimizefs
Posted by Vanessa | Posted in Misc | Posted on June 22, 2010
1
CPanel utilizes a script called “optimizefs” that removes the atime attribute from certain files on the system. For larger servers, this can create a lot of i/o load for a problem that can be fixed simply by mounting your file systems with the noatime flag if your file system is ext2 or higher.
The atime attribute is used by Linux to mark when a file was last accessed, and is understood to be a resource drain when enabled for an entire filesystem. cPanel attempts to address this by removing atime attributes from a specific list of files. You may see a command like this in your root crontab:
45 */8 * * * /usr/bin/test -x /usr/local/cpanel/bin/optimizefs && /usr/local/cpanel/bin/optimizefs
This cron basically applies the following command to a number of files and directories:
chattr +A /path/to/file/or/directory
Instead of using cPanel’s band-aid fix, it’s preferred to remove the atime attribute from the filesystem altogether. To do this, add noatime to the file system properties for each usable partition listed in /etc/fstab. For example:
LABEL=/ / ext3 defaults,usrquota,noatime 0 0
/tmp /var/tmp ext3 defaults,usrquota,bind,noauto,noatime 0 0
Then remount each file system. For the example above using the root partition ( / ):
mount -o remount /
*In some cases, a reboot may be necessary
Now, you can remove the cron job and still get the same benefits of not having your operating system record file access times:
sed ‘/optimizefs/d’ -i /var/spool/cron/root && service crond reload
Additional Resources:






sending...