Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

You can modify /etc/fstab to reflect the noatime parameter on the / filesystem. Edit /etc/fstab and make the entry for / look something like:

LABEL=/                 /                       ext3    noatime         1 1

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

share|improve this answer
    
Not a bad idea provided you're willing to lose atime on / (possibly the whole system from what was described above). Potentially much less painful than repartitioning too. –  voretaq7 May 24 '11 at 21:26
    
Uh, I would think there's a huge risk in implementing noatime on the entire filesystem. Better to do it only on /var/lib/mysql and /home since we know it doesn't affect those from a programming standpoint. The /home only stores WordPress sites for the most part. –  ServerChecker May 25 '11 at 1:28
    
Nope. No risk to running without atime. There's more risk involved in trying to separate partitions in your case. –  ewwhite May 25 '11 at 1:53
1  
1  
I have a lot of different servers all running with noatime on all partitions. No problems with it. –  rvs May 25 '11 at 8:13
show 3 more comments

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 :)

share|improve this answer
    
You're faster than me -- I was writing pretty much the same answer. I will add, though, that after you unmount the new partitions from their temporary mount points, you can simply run mount -a to mount them to their proper places -- a full reboot isn't necessary (although doesn't hurt). –  Kromey May 24 '11 at 21:27
    
@kromey true - mount -a & going back to multi-user mode is also fine. The big point is "Don't manually mount it without testing your new fstab, lest you screw up and render the machine unusable" –  voretaq7 May 24 '11 at 21:40
    
What if I could resize / back to only used space + 2GB, then take the unallocated space and map it to /home2 and /var/lib/mysql2, and then do the switcheroo to remount them as /home and /var/lib/mysql? Is that possible? –  ServerChecker May 25 '11 at 1:35
    
Ah, looks like I follow the instructions at the bottom of this web page: centos.org/docs/5/html/Deployment_Guide-en-US/… However, it doesn't look easy and can come with its risks. –  ServerChecker May 25 '11 at 1:39
add comment

Is there any reason you can't apply noatime to the whole filesystem? I run several systems like that without issues.

mount -o remount,noatime /

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.