LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-21-2014, 03:54 AM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
Any way to calculate a time estimate for a fsck


I have a server with multiple multi-terabyte volumes , comprised mostly of single-digit MB files, that haven't been fsck'd in years, even though looking in a tune2fs -l they all report clean. So of course we want to run an fsck on them (and I know most people will say if it says clean you don't need to, but we want to).

We know we will have to schedule a considerable amount of downtime for the system, but is there any way to get a rough idea of how much time it should theoretically take? I don't see a "dry run" option in the man page, so I guess there's no just-checking-but-not-making-any-changes option we could just run and see how long it takes, right?

Thanks for any tips you can provide.
 
Old 02-21-2014, 04:57 AM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 872

Rep: Reputation: 267Reputation: 267Reputation: 267
Since you mention tune2fs I'll assume your running one of the ext2/3/4 file systems.

You can pass -n to e2fsck to check but not do anything on these file systems, you'll also have to add the -f to force the check otherwise it will see the clean flag and just exit.

Note that the output on a mounted filesystem will be inaccurate with respect to the actual error count but it will give you an idea on how long it will run for when you do it properly.
 
Old 02-21-2014, 05:08 AM   #3
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Is that safe to do though while the system is up and running? I totally missed the -n option when reading the man page apparently.
 
Old 02-21-2014, 06:23 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,594

Rep: Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510
Quote:
Originally Posted by rjo98 View Post
I have a server with multiple multi-terabyte volumes , comprised mostly of single-digit MB files, that haven't been fsck'd in years,
Let's assume that means you don't use ext4 which has (quite) some investment in speeding up fsck.
ext3 (or god forbid ext2) will take close to forever (in operational terms with users hanging on the outcome).

Let's hope the backup you take immediately prior to this is good. fsck is a filesystem consistency tool - not a file consistency tool. That difference may prove to be hugely significant.
 
Old 02-21-2014, 06:32 AM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Hi syg. They're all ext3 unfortunately. We're not having any issues with the server, no errors in /var/log/messages, but were thinking it would be good to check it, just in case it finds anything minor with the file system.
 
Old 02-21-2014, 06:51 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,594

Rep: Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510Reputation: 3510
Just because you don't see any messages doesn't guarantee fsck won't find something awry - and presumably you'll reply "yes", or use "-y".
So the fs will be good, but you'll never know what got "fixed" - cross-linked files maybe, that means (at least) one may finish up truncated.

The backup is non-optional (IMHO). If it was me, I'd do the backup, fsck, and convert to ext4 while I had the outage. Might save you in future.
 
Old 02-21-2014, 06:54 AM   #7
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Exactly, that's what we're thinking, just because it says it's clean, doesn't necessarily mean it's clean, I'm sure a check would find some minor issues at least.

We do have a good backup, so that part I'm not worried about. I was more worried if there was a way to figure out how long it might actually take to check all the volumes, or even if I have to do it volume by volume from single-user mode, how long each volume would take. I want to avoid saying "the system will be done for 6 hours" when there was a way I could have figured out beforehand it really will be down for 24 hours while the checks run.
 
Old 02-21-2014, 09:48 AM   #8
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by syg00 View Post
ext3 (or god forbid ext2) will take close to forever (in operational terms with users hanging on the outcome).
that's my impression, too. The system I'm working with right now has a 400GB ext3 data partition which is about 3/4 full, and every now and then, when the routine check at startup kicks in, I can just as well leave the computer and have another coffee, as it will usually take 20..30 minutes for that partition.

You mention that the whole thing is considerably faster with ext4, and I've heard other people say the same. Is there any rule of thumb as to how much faster an fsck would be? A 10th of the time? Mere seconds??

I'm not thinking abput converting this filesystem, though, because I'm going to completely reinstall the system shortly. And then I'll very probably go for ext4.

Quote:
Originally Posted by syg00 View Post
Let's hope the backup you take immediately prior to this is good. fsck is a filesystem consistency tool - not a file consistency tool. That difference may prove to be hugely significant.
Yes. In other words: During an fsck, the tool might sacrifice a single file for the sake of consistency of the whole filesystem. Not usually, but there is that risk. Like amputating a foot may be the only chance for a badly wounded guy to survive.

[X] Doc CPU
 
Old 02-21-2014, 10:01 AM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,538

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
You can run "fsck -n -f" quite safely on a mounted filesystem. You will get a good idea of how long the check takes, but unless you are familiar with the inconsistencies that are to be expected on a read-write mounted filesystem the results won't be terribly meaningful. If by any chance there are filesystems that can be temporarily mounted read-only, you can get a valid check. If that check happens to report that the filesystem is clean, you can run "tune2fs -C 0 -t now" on the containing device to record that check in the super block. But never allow fsck to make any repairs on a mounted filesystem, even one that is read-only. That can cause serious problems, including a possible kernel panic.
 
Old 02-21-2014, 10:16 AM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,538

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
Quote:
Originally Posted by Doc CPU View Post
You mention that the whole thing is considerably faster with ext4, and I've heard other people say the same. Is there any rule of thumb as to how much faster an fsck would be? A 10th of the time? Mere seconds??
https://www.google.com/search?q=fsck+time+ext4 yields a bunch of good hits. Here is one with a graph that is quite illuminating. Note that filesystems converted from ext3 will not see the improvement from extent-based allocation, but will see the inode count related improvement.
 
Old 02-21-2014, 11:18 AM   #11
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
thanks rknichols. unfortunately I can't switch any of them to read-only, so was thinking my options were to either do the larger volumes one at a time from single-user mode, or if I could figure out how much of a time investment I was looking for, go for the gusto with all them in one maintenance window.
Good to know I can do a fsck -n -f though safely it something is mounted though, I figure that has to at least give me a decent estimation, then add a little fudge factor to it in case the real run takes longer.

Doc, I have ext4 on some other servers, and while I can't say it's X times faster on volumes that were ext4 from the start, it definitely makes a noticeable impact on the time needed to complete the check.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to Calculate Time Difference? santosh0782 Linux - Newbie 9 02-22-2014 08:57 PM
Time estimate for RHEL 6.1 install Sanford Stein Red Hat 2 12-06-2011 04:50 PM
[SOLVED] How to calculate time kasparov29 Linux - General 4 11-11-2011 06:45 PM
Gentoo upgrade time estimate pressman57 Linux - Newbie 2 04-17-2009 07:51 PM
Time estimate for a Gentoo install LinuXP Linux - Distributions 6 02-25-2004 02:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration