# fsck at boot

## mno

Hey all,

I am running the 3ware 8506 raid card and recently ran into a very rare issue on my server, where the server stopped waiting for fsck to run after a reboot. It was a standard maintenance run, and no issues were found with the partitions. Since it's a server and I don't have access directly, these unexpected maintenance runs cost. As such, a question: how can I properly disable fsck at boot? And, any side-effects?

Thanks, 

Max

----------

## mbreith

My computer runs these checks at boot time according to a certain number of mounts that it has done without being checked. I don't remember the exact line that it gave me, but it said that it is configurable somewhere. I think it is something specific to the filesystem if I remember correctly. I am using ext2, so I don't know how it would change things using raid.

The other question - which costs more: the 1-2 min check time on every 30th reboot, or the time needed to find out why the data on the drive is not consistent?

----------

## mno

Well, here's thing. The server gets rebooted once in over 300 days. And then, only if I do a kernel rebuild and even then, only if it's a major one. So, the reason it hung last time was because I had no reboot for 368 days. And then it hung on stupid fsck. If I could automate it, sure. 

I already went through fstab and set the check flag to 0 for all partitions, but just noticed that there's checkfs and checkboot that runs at boot-time. Do I also need to disable those, or do those use the fstab file?

----------

## i92guboj

 *mno wrote:*   

> Hey all,
> 
> I am running the 3ware 8506 raid card and recently ran into a very rare issue on my server, where the server stopped waiting for fsck to run after a reboot. It was a standard maintenance run, and no issues were found with the partitions. Since it's a server and I don't have access directly, these unexpected maintenance runs cost. As such, a question: how can I properly disable fsck at boot? And, any side-effects?
> 
> 

 

man fstab, look for fs_passno. It is the last field in the fstab lines. A value of 0 means "don't check", the rest of positive values will show the order in which the partitions will be checked.

Side-effects?

Well, you know what fsck is. You know what happens if a defective filesystem is not repaired. You know that severe corruption of the whole filesystem is highly probable if you operate in your server and the filesystem is not consistent. Usually it will be fine, overall if you run an stable fs like ext3, and you use an independent power supply to avoid electrical blackouts. But even then, if you value your data, you should fsck your filesystem once in a while.

If you know all of that, you know how important is to check your filesystem. If you don't care about your data, then fsck is not important at all.

If you put a '0' at the end of the relevant partitions in your fstab you are telling init this: "I am the responsible to fsck and maintain my partitions, if something screws, I will be the only responsible".

Besides that, there is nothing wrong with disabling startup checks.

Not relevant to the topic, but I will say anyway, since it happens a lot: never use fsck on mounted partitions.

 *mbreith wrote:*   

> My computer runs these checks at boot time according to a certain number of mounts that it has done without being checked. I don't remember the exact line that it gave me, but it said that it is configurable somewhere. I think it is something specific to the filesystem if I remember correctly. I am using ext2, so I don't know how it would change things using raid.

 

It shouldn't change a thing. You can use tune2fs to set those values on your filesystem. For example, "tune2fs -c 10 -i 30d /dev/hda" will configure hda to be checked after 10 boots or after 30 days, whatever comes to happen first. Both values can also be set to 0 to disable those checks, regardless of the values on fstab. More info on man tune2fs.

Just use your raid device instead hda.

 *mno wrote:*   

> I already went through fstab and set the check flag to 0 for all partitions, but just noticed that there's checkfs and checkboot that runs at boot-time. Do I also need to disable those, or do those use the fstab file?

 

They read the fstab file, and act accordingly. You can disable them -I think, never did it- if you are not interested on that feature. In that case, I bet that the values on fstab would be irrelevant. Of course, if something breaks, you are alone. Note that those are active by default when you unpack the gentoo stage.

----------

## gejo

what ever told in previos scrap is exactly correct and as a linux user you need a thorough knowldge of fsck and fstab

By default

```
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1

LABEL=/boot             /boot                   ext3    defaults        1 2
```

If you are sure that u don't want file system checking you can disable the last values , means sixth parameter in line 1 and line 2 to 0.

1 means file system checking for / (root directory) and 2 means other directories like /home /boot e.t.c and fifth parameter is used for core dumping also.

if you want to strictly disable fsck , do like this 

```
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 0

LABEL=/boot             /boot                   ext3    defaults        1 0
```

similarly u can disable core dump by change the fifth  parameter to 0

----------

## mno

Thanks for the responses. I do realize the consequences. I do use ext3. 

OK, the issue really was that the fsck hung on a question. It needed manual input to run the diskcheck. Since the server is located remotely, everytime it runs, I need to get someone to drive in and hit OK. Is there any way to automate it?

----------

## gejo

please go through the /etc/rc.d/rc.sysinit file and create  file  #/fastboot

Go through in depth on this file before touching /fastboot file.

 *Quote:*   

> If the file "/fastboot" exists the system filechecking is skipped. The system file checking uses the programs fsck and initlog (lines 77-112). Type "man fsck", "man initlog" for more information. Depending on the error returned by fsck (file system check), if file system errors exist and were not corrected the system will attempt a super user login to allow the administrator to try to fix problems and then unmounts all file systems and performs a reboot. See "man sulogin", "man umount", and "man reboot".

 

----------

## i92guboj

 *gejo wrote:*   

> please go through the /etc/rc.d/rc.sysinit file and create  file  #/fastboot
> 
> Go through in depth on this file before touching /fastboot file.
> 
>  *Quote:*   If the file "/fastboot" exists the system filechecking is skipped. The system file checking uses the programs fsck and initlog (lines 77-112). Type "man fsck", "man initlog" for more information. Depending on the error returned by fsck (file system check), if file system errors exist and were not corrected the system will attempt a super user login to allow the administrator to try to fix problems and then unmounts all file systems and performs a reboot. See "man sulogin", "man umount", and "man reboot". 

 

That is not Gentoo's way to do it. It has been explained above how to bypass the test. Either by using fstab or tune2fs at filesystem level.

----------

## mno

OK, I am now convinced that I don't want to turn off fsck completely. However, then, I would need to find a way to use it but not at boot. Here's the specific issue as described by the tech who came in to check up on the server when it hung on fsck last time:

```
The box was sitting at the "ctrl+d or root login" prompt, and waiting for fsck on /dev/sda3.
```

From my fstab:

```
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1               /boot           ext2            noauto,noatime  1 1

/dev/sda3               /               ext3            noatime         0 2

/dev/sda2               none            swap            sw              0 0

/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro       0 0

/dev/sda5               /home           ext3            noatime,noexec  0 0

/dev/sda6               /mnt/backup     ext3            noatime,data=journal    0 0

#/dev/fd0               /mnt/floppy     auto            noauto          0 0
```

As such, it seems the root login prompt was caused by the fact that it was the / partition. Correct?

Further. I don't want to again face the issue that the server hangs upon reboot just because of fsck. What would be your suggestsions for going around that? My idea is to keep the pass set to '1' for the /boot partition, and then set it to '0' for the rest. Then, once the system is up, I can manually stop down the services, umount the / and other partitions, manually fsck them and then re-mount. Does this sound feasible?

Regardless, as a server, it is usually rebooted once in a year. I've never had a power loss, it has dual power supplies. Even during the blackout of 2003 (east coast North America), the server worked on fine even without an Internet uplink  :Very Happy:    This pretty much means that every reboot fsck would be run, which is probably too rare in any case to be effective. 

In any case, how do server admins usually handle the fsck issue remotely? Since there doesn't seem to be a way to automate it completely (at least not for the / partition), they must do it manually. Right?

Thanks for all your suggestions,

Max

----------

## i92guboj

 *mno wrote:*   

> OK, I am now convinced that I don't want to turn off fsck completely. However, then, I would need to find a way to use it but not at boot. Here's the specific issue as described by the tech who came in to check up on the server when it hung on fsck last time:
> 
> ```
> The box was sitting at the "ctrl+d or root login" prompt, and waiting for fsck on /dev/sda3.
> ```
> ...

 

No,It was because that partition was not bootable anymore due to the errors. One more reason not to turn fsck off, if you ask me.

 *Quote:*   

> 
> 
> Further. I don't want to again face the issue that the server hangs upon reboot just because of fsck. What would be your suggestsions for going around that? My idea is to keep the pass set to '1' for the /boot partition, and then set it to '0' for the rest. Then, once the system is up, I can manually stop down the services, umount the / and other partitions, manually fsck them and then re-mount. Does this sound feasible?
> 
> 

 

Besides I would not turn to 0 any partition, the rest is ok to me. However, there is an easier way: just type "init 1" to run into single user mode, most services will be turned off if you do so. Then you can unmount and fsck all the partition that are not strictly needed to operate.

You, definitely, cannot unmount /. You will then have no fsck command to run anyway, because it is into /sbin/fsck

Regardless, as a server, it is usually rebooted once in a year. I've never had a power loss, it has dual power supplies. Even during the blackout of 2003 (east coast North America), the server worked on fine even without an Internet uplink  :Very Happy:    This pretty much means that every reboot fsck would be run, which is probably too rare in any case to be effective. 

 *Quote:*   

> In any case, how do server admins usually handle the fsck issue remotely? Since there doesn't seem to be a way to automate it completely (at least not for the / partition), they must do it manually. Right?
> 
> Thanks for all your suggestions,
> 
> Max

 

I alway did it manually, but there must be an automated way. I don't know it, though.

----------

## mbreith

Trying to automate a fsck scan on / would be a bit difficult. What program would run it. Anything that tried would be unmounted along with fsck itself when the / partition was unmounted. At that point it would not be usable. Perhaps if there was a ram drive that was able to keep the core system operating. Even so, the server would stop serving anything from the hard drives and you might as well just reboot it for as useful as it is at that point.

Since you can't unmount / without losing the system, and you cant fsck the thing while it is mounted, your best bet is to hook up a keyboard and monitor while rebooting it. It is only once a year after all.

----------

## mno

Yes, it seems that this is the only really feasable way. A (bi?-)yearly technical request to reboot and fsck seems like the best bet.  :Smile: 

----------

