Linux Performance: Remount EXT3 partitions using ‘noatime’

Increase Drive Performance by 40% using noatime

Are you feeling the heat on your dedicated server, getting high I/O wait times?

If you are using EXT3 partitions then it is worth checking to see if they are mounted using ‘noatime’. If they are not, then every read to your partition is also a write which can massively reduce hard drive performance.

First, find all partitions mounted as EXT3 mount without noatime:

# mount | grep ext3
/dev/sda1 on / type ext3 (rw,noatime)
/dev/sdb1 on /backup type ext3 (rw)

Any not showing the noatime attribute, simply remount like so:

# mount -o remount,noatime /backup

You can do this without a server reboot, you can do this with the server live and with the partitions already mounted.

Useful Find Examples

Find all HTML files that contain the text “Loading”

# find . -name *.html -exec grep -il "Loading" {} \;

Find all files modified in last 7 days

# find . -mtime -7

Find all .PHP files modified in last 7 days

# find . -name *.php -mtime -7

Find and Remove all PHP files modified in last 7 days

# find . -name *.php -mtime -7 | xargs rm

Find all  files modified in last 10 days that contain text “Loading” and move to /trash

# find . -type f -mtime -10 -exec egrep -l "Loading" {} \; -exec mv -f {} /trash \;

WordPress File and Folder Permissions

Tighten Up WordPress File and Folder permissions

If you used an auto installer for WordPress you may find that many of your files and folders have 777 attributes, this can be a risk and this permissions can be abused by compromised plugins.

To tighten up your folder, use SSH and locate your /httpdocs folder:

# find . -type d -exec chmod 755 {} \;
# find . -type f -exec chmod 644 {} \;
# chmod 750 ../httpdocs

At the same time, you might want to execute maldet to ensure there is no malware present:

# maldet -a ../httpdocs

Always ensure you are using the latest revision of WordPress. This is the single most important rule for ensuring maximum security of your WordPress site.

Solution: ERROR 2006 (HY000) at line XXXXX: MySQL server has gone away

Getting MYSQL server has gone away when importing database from .sql file

Problem: You are trying to import a .sql file using the command line mysql command but it is unsuccessful as follows:

# mysql -u douser -pdbpass yourdb < db_file.sql
ERROR 2006 (HY000) at line XXXXX: MySQL server has gone away

The solution is to edit /etc/my.cnf and add the following line to the [mysqld] section:

max_allowed_packet=64M

Then restart mysql:

# service mysqld restart

Re-run your import query (you may need to delete the partly database first and re-create it) and it will now succeed.