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

Is there a correct way to reboot a server to avoid FSCK and just avoid getting FSCK in general? I have been using the reboot command to reboot servers.

share|improve this question
1  
You want to have fsck. You want to have your filesystems checked.. believe me. –  Bonsi Scott Nov 13 '12 at 22:02
    
Sounds to me that the question is whether the OP is restarting her server the correct way. Not about preventing fsck - but inadvertently causing it to run. –  uSlackr Nov 14 '12 at 4:25

3 Answers 3

up vote 4 down vote accepted

The reboot command may reboot the system without shutting down system services or unmounting filesystems cleanly. It's supposed to shutdown the system normally, but apparently this doesn't always happen.

To avoid this problem, use the shutdown command with the appropriate options to have it reboot the system.

An example:

shutdown -r now

So long as the system shuts down cleanly, it will not normally attempt to fsck the drives on next restart (unless the filesystem mount/time count is exceeded, but that's another story).

share|improve this answer
1  
The question is about fsck, not reboot –  Dennis Kaarsemaker Nov 13 '12 at 18:18
    
It also asks Is there a correct way to reboot a server to avoid FSCK. There is. do not use reboot since its effects vary between OS's. Some do precisely what Michael said and thus cause problems. –  Hennes Nov 13 '12 at 18:20
1  
What's with the downvote? –  Michael Hampton Nov 13 '12 at 18:21
    
Under linux reboot calls shutdown -r unless you call reboot -f, so this advice doesn't help at all –  Dennis Kaarsemaker Nov 13 '12 at 18:26
    
If the OP is using reboot -f this answer becomes very germane. –  uSlackr Nov 14 '12 at 4:23

The fsck after reboot happens for one of three reasons: when a system shuts down uncleanly (like a crash), when a filesystem hasn't been checked for N mounts, or when a filesystem hasn't been checked in M days. For an ext2/3/4 filesystem you can see the current counters and set the value of N and M with the tune2fs command.

share|improve this answer
    
This answer is correct as far as it goes, but it doesn't address the question. –  Michael Hampton Nov 13 '12 at 18:31
    
Yes it does. Have you read the last line? –  Dennis Kaarsemaker Nov 13 '12 at 18:32

First fsck is your friend! If you have crashed a system, you WANT it to run automagically and this action should never be disabled in this case.

Now, during the course of normal reboots where everything gets sync'd fine, the periodic invokation of fsck can be annoying and not very timely. Generally, what I do in this case is to inhibit this type of periodic fsck invokation, using tune2fs (as the root user):

 tune2fs -i 0 -c 0 /dev/sda1        ;; change /dev/sda1 with whatever your raw disk is

This operation can be performed at any time during the systems operation, even with the disk being mounted.

After you do this you can then reboot the server and avoid the fsck operation (unless the server has crashed).

share|improve this answer

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.