LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   When to e2fsck a drive? (https://www.linuxquestions.org/questions/linux-newbie-8/when-to-e2fsck-a-drive-814119/)

anon091 06-14-2010 03:14 PM

When to e2fsck a drive?
 
Other than when there are errors in the messages log or when you have file system problems, when should you e2fsck volumes? I have a lot of volumes that have 500GB to 1TB of data on them, and it takes quite a while to e2fsck them, so wondering if its something that should be done regularly, or only when there are actually problems.

rweaver 06-14-2010 03:17 PM

I would suggest migrating to a journaling file system once you get above about 250g (even 250g is a long fsck.) That being said, if you see an error it's a good idea and anytime you get a unexpected reboot it's likely to be forced and also anytime it goes longer than a set period of time it will force a fsck on reboot to ensure consistency... really though, journaled is good and non-journaled is becoming increasingly less feasible as file system sizes increase.

anon091 06-14-2010 03:19 PM

All my largers volumes are ext3 so they have the journal. A lot of my systems have the automated checks after a certain date and after a certain number of mount counts disabled. So I'm really not sure if i should re-enable that stuff or what.

frieza 06-14-2010 03:21 PM

i would say regularly, perhaps either weekly or monthly and set it up perhaps on a cron job to be done when you are going to be away from the computer
of course if memory serves a properly configured fstab will force an fsck after so many mounts (or is that just a function of the FS?) either way on ounce of prevention is often worth at least a pound of cure hence the recommendation that fsck be a regular thing, how often should be based on how much time you can spare vs how much you can afford to lose the data ON the drives

also backup backup backup, at least the stuff you can absolutely not afford to do without, obviously terebyes of data woudnt necessarily be practical to completely back up all the time. again an ounce of prevention is worth a pound of cure.

anon091 06-14-2010 03:25 PM

Thanks frieza. That's kinda my problem, as the servers are used 7 days a week, so my downtime windows are small, especially if a check runs on that much data. but sounds like its something I should do regularly though. I just wasn't sure if there were no actual errors in the messages file if it was just a waste of time or not.

onebuck 06-14-2010 03:29 PM

Hi,

Quote:

Originally Posted by rjo98 (Post 4003486)
Other than when there are errors in the messages log or when you have file system problems, when should you e2fsck volumes? I have a lot of volumes that have 500GB to 1TB of data on them, and it takes quite a while to e2fsck them, so wondering if its something that should be done regularly, or only when there are actually problems.

The usage and filesystem type may be one indicator. If you reboot a lot then the 'tune2fs' would be what you should look into for ext3/4;

Quote:

excerpt from 'man tune2fs';
NAME

tune2fs - adjust tunable filesystem parameters on ext2/ext3 filesystems SYNOPSIS

tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ] [ -f ] [ -i interval-between-checks ] [ -j ] [ -J journal-options ] [ -m reserved-blocks-percentage ] [ -o [^]mount-options[,...] ] [ -r reserved-blocks-count ] [ -s sparse-super-flag ] [ -u user ] [ -g group ] [ -C mount-count ] [ -L volume-name ] [ -M last-mounted-directory ] [ -O [^]feature[,...] ] [ -T time-last-checked ] [ -U UUID ] device DESCRIPTION

tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2/ext3 filesystems.
Look at the 'man tune2fs' for available options. Plus I would perform maintenance on low usage periods for any form of maintenance. If you do use the 'e2fsck' then it should be performed while in single user mode. Either boot into single or use a LiveCD or installer CD to boot the machine then do the maintenance, this will prevent potential problems during the maintenance.
:hattip:

Just a few more links to aid you;

Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Bash Reference Manual
Advanced Bash-Scripting Guide
Linux Home Networking
Virtualiation- Top 10

:hattip:
The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

frieza 06-14-2010 03:31 PM

Quote:

Originally Posted by rjo98 (Post 4003506)
Thanks frieza. That's kinda my problem, as the servers are used 7 days a week, so my downtime windows are small, especially if a check runs on that much data. but sounds like its something I should do regularly though. I just wasn't sure if there were no actual errors in the messages file if it was just a waste of time or not.


yep, even big servers like the World of warcraft game servers undergo scheduled downtime for such maintenance, that would be my recommendation, create a check-list of routine maintenance tasks that require downtime (file system checks, database maintenance, system updates/patches, etc..) then schedule the downtime based on a worst case scenario of how long it would take to perform said tasks (baring something going horribly wrong) and make sure that the user base of your server is aware of this downtime.

my company manages a web server that is in constant use and even we have to occasionally schedule downtime to perform system updates/patches etc..

onebuck 06-14-2010 03:32 PM

Hi,

Quote:

Originally Posted by rjo98 (Post 4003506)
Thanks frieza. That's kinda my problem, as the servers are used 7 days a week, so my downtime windows are small, especially if a check runs on that much data. but sounds like its something I should do regularly though. I just wasn't sure if there were no actual errors in the messages file if it was just a waste of time or not.

Definitely perform the maintenance off peak and in single user mode for a Server. Maintenance schedules will help you to prevent potential traps.
:hattip:

anon091 06-14-2010 03:33 PM

Really all these servers are are samba shares for the most part, no db's or anything like that. wish there was a way to get an idea of how long the e2fsck would actually take on the drives, then at least i'd know how long to schedule the downtime for, rather than a wait and see for the first time i go to run it.

anon091 06-14-2010 03:35 PM

Thanks everybody.

kwutchak 05-19-2011 05:18 AM

Cron online fsck
 
Is there any well known linux app to manage "online" fsck of disks?

I restarted one of my servers today, which has several Tb ext3 partitions. Many of these had come up to their "check forced" limit, so the server took a long time to come up.

It occurred to me that I could offline these partitions regularly and fsck them (I'm thinking cron job) so that the outage only affects one file system at a time at the most advantageous time and doesn't disable the entire server at the worst possible time.

I could write a cron script to achieve this, but is there already a package out there that does something like this?

anon091 05-23-2011 11:23 AM

no software out there to do it that i know of or anyone's every told me about, you'd just have to write a script and cron it just as if you were doing it manually. i think you just do a umount for the volume, your e2fsck with whatever options, then a mount for the volume again. you cant check a mounted volume.

hokie1999 02-12-2012 03:14 PM

Follow up on fsck
 
I am considering setting my servers - running Oracle Enterprise Linux 6 on HP blades, ext 3 filesystems - without a fsck every X reboots. That is, setting tune2fs -c 0 /dev/mapper/VGxxxlvyyyy. The servers run Web, application, and database platforms. The servers are less than a year old; about 30 total. What are your thoughts on this? Thanks.

anon091 02-12-2012 04:37 PM

Nothing wrong with doing that, you can always boot them into single user mode and check the filesystems during a maintenance window. What I usually do is leave it turned on for everything except my larger data volumes, as the other ones don't take long at all during a reboot. But it all depends on environment and uptime concerns.

chrism01 02-12-2012 05:22 PM

Just remember that for the root partition ('/'), that requires a reboot for fsck.
You can justify that by doing it whenever you do a kernel update, which also requires a reboot.
:)


All times are GMT -5. The time now is 12:49 PM.