LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2011, 11:00 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Rep: Reputation: 47
How to perform an e2fsck -y on only two volumes at restart


I want to perform an e2fsck with the y switch (so I dont have to answer yes to every question) on two volumes on a server the next time I restart it.

I don't want to do a shutdown -rF because 1) I dont want to check the other volumes and 2) it seems when I do that, the e2fsck doesn't keep restarting itself over and over to fix all the problems. Seems like it runs once, then if it fails it drops you to the repair console in single user mode. I'd rather just have it start the check that will keep repeating over and over right away, because I know it'll take more than one pass.

Can anyone tell me how to do this, or confirm my observations?
 
Old 03-10-2011, 12:59 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,776

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
Append to rc.local

echo "Checking Drive 1"
e2fsck -fcvy /dev/drive1 > logfile 2>&1
echo "Checking Drive 2"
e2fsck -fcvy /dev/drive2 >> logfile 2>&1


Options: f=force check; c=check surface with badblocks; v=say something; y=yes, do it.
When it finally boots, remove the offending lines from rc.local.

Alternatively play with tune2fs. Man tune2fs
 
1 members found this post helpful.
Old 03-10-2011, 01:24 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Original Poster
Rep: Reputation: 47
thanks. I've messed with tune2fs before to get it to do a check, but it always seems those checks never continually run till its clean, seems like they run for a while then die and drop you into the rescue command line, where you can then do you e2fsck -y which keeps running till its clean.

so that rc.local file runs before all the volumes are mounted, so that's why this would work?
 
Old 03-11-2011, 03:42 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,776

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
It runs before you mount any drives, but after the drives in fstab are mounted. You would have to fiddle fstab as well if they are things like / or /var.

The other way is to do it would be something like this. Presuming you know the approximate interval between checks, you can try

tune2fs -T 19750101 /dev/volume1
tune2fs -T 19750101 /dev/volume2

which tells it the system was last checked on 1st January 1975, which is probably longer back than you set as the time check interval :-D. No tidy up after is necessary, as e2fsck updates to the last time checked, but you lose the ability to set e2fsck options without digging through startup stuff.
 
1 members found this post helpful.
Old 03-11-2011, 03:44 AM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,674

Original Poster
Rep: Reputation: 47
that's pretty clever!

Thanks for the info. The volumes i was talking about are in fstab, so i'd have to comment them out first it sounds like if i were to try this. Thanks for the info. I've learned a lot the last couple of days.
 
Old 03-12-2011, 03:58 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,776

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
Quote:
Originally Posted by rjo98 View Post
that's pretty clever!

Thanks for the info. The volumes i was talking about are in fstab, so i'd have to comment them out first it sounds like if i were to try this. Thanks for the info. I've learned a lot the last couple of days.
I've done my share of suffering. You learn well if there's a bit of pain attached to the lesson - ever notice that? ;-)
 
  


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
why does an e2fsck restart itself? rjo98 Linux - Newbie 4 03-11-2011 09:46 AM
[SOLVED] How to tell if e2fsck will automatically run when I restart RHEL server? rjo98 Linux - Newbie 7 09-30-2009 08:03 PM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 12:24 PM
e2fsck Eugney Slackware 2 06-03-2005 12:13 PM
e2fsck -c question! Finlay Linux - Hardware 4 03-30-2004 10:20 AM


All times are GMT -5. The time now is 07:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration