The purpose here is about adding the 'noatime' property in /etc/fstab. We're running CentOS5.
On both servers A and B, we called a maintenance window with our users and stopped MySQL and Apache services.
On Server A, my client properly installed /var/lib/mysql and /home into separate partitions when I checked /etc/fstab. I was able to set the noatime property and remount the volumes, and when I checked with "mount -l" they showed the noatime property. Indeed, the server performance was much snappier when we fired up MySQL and Apache and told the users to get back on.
On Server B, however, my client just put everything on /. Is there an easy way at command line to break up /home and /var/lib/mysql from / so that we can apply noatime?
I'm just wanting to avoid having to do a complete server OS reinstall and then restoring cPanel accounts again.
Well, first you need to create a partition to hold
/home
.(This is the hard part and is left as an exercise for the reader -- It could be as simple as just carving off a chunk of unallocated disk space (not likely), moderately difficult via LVM & filesystem resizing, or as complex/painful as "You're screwed. Make a backup and reinstall with a proper partition table.")
Then you need to get everyone to log off so you can move the data from your old
/home
to the new partition.(If it's your workstation just go single-user and move everything over to the new partition. If you had to reinstall based on the above you'll be restoring from the backup.).
Then you need to update
/etc/fstab
to reflect the new partition & mount point(If you were reinstalling this is done for you. If not
man fstab
has everything you could ever want to know about editing/etc/fstab
:-) -- Reboot and you should be done :)Is there any reason you can't apply
noatime
to the whole filesystem? I run several systems like that without issues.Modify
/etc/fstab
adding noatime to make it stick.If you can't do that you just have to partition some extra space and copy the files over. Edit: Follow @voretaq7's post for this, which explains the procedure more thoroughly than I did.
You can modify
/etc/fstab
to reflect thenoatime
parameter on the/
filesystem. Edit/etc/fstab
and make the entry for/
look something like:This would need to be followed by a reboot.
Granted, there are other practical reasons to split the partitions apart like on Server A, but this will work for the short-term.
See: Turning off atime on a filesystem