# Check ext3 filesystem at bootup

## schorsche

I can remember having switched of the e2fsck utility about one year ago since it annoyed me with

"checking filesystem now" at bootup, which took about 10 minutes every time. 

However, now I want to reenable the check since, as I said, I haven't performed a filesystem check

in a year. 

However, I used 

```
tune2fs -c 20 /dev/hda8
```

 to check the filesystem every 20  bootups (and also when  it is unmounted)

I also ran

```
 tune2fs -C 20 /dev/hda8 
```

to set the mount counter so it would check the fs @ next bootup. 

However, none of all this happens . 

```
 tune2fs -l /dev/hda8 
```

 shows everything's fine.

Any suggestions? Do I need to boot from a livecd to get it to work? I can remember, however, that it also worked at

startup when the filesystem hadn't been mounted yet.Last edited by schorsche on Thu Jan 12, 2006 6:57 am; edited 1 time in total

----------

## Dlareh

You probably need to set change the sixth field in /etc/fstab to a non-zero value (man fstab for details).

If you'd like to manually check your root filesystem, the simplest way is to boot a livecd and run fsck /dev/whatever ...

----------

## schorsche

Thanks, 

 fstab shows

```
/dev/hda8      /      ext3      noatime         0 0
```

so there seem to be only 5 fields. 

Well but I'll check out the manpage, it's just that I haven't heard of a sixth field before. 

So for now I'll boot into a livecd and run it on the unmounted root-filesystem.

----------

## Demonarch

The sixth field would be the last zero. Since it's a root file system, change it to 1. 

Like this:

```
/dev/hda8      /      ext3      noatime         0 1
```

----------

## Beekster

For a one off "check everything next boot" run a 

```
touch /forcefsck
```

as root.

This assumes checkfs &/or checkroot are in your boot runlevel.

----------

## meowsqueak

I tried that touch /forcefsck thing and it just checked /dev/hda1 (/boot) and ignored /dev/hda3 (/) - why would it ignore my root filesystem?

----------

## schorsche

Well I did the same and it worked a treat, it checked my root filesystem (not boot though, but this can be done once gentoo it booted up, anyway).  Thanks Beekster for that tip. 

This was a forced check, however, is there a way to make this happen every let's say 20 bootups? I've already set this with tune2fs but it ain't seem to work.

----------

## Beekster

The sixth field will need to be non-zero for the 'touch /forcefsck' to work on a partition.

For a check every 20 boots on ext2 or 3, the sixth field does have to be non-zero. Set it to 1 for / and 2 for /boot and any other on disk filesystems (partitions, but not swap) you may have.  The tune2fs options set should then take effect.

Read the -A option in 'man fsck', as well as the /etc/init.d/checkfs script.

----------

## plasmagunman

instead of "touch /forcefsck" you can also do a 

```
shutdown -F now
```

 with "-r" or "-h", as you like. it does the touching by itself. i like this method better, since once i mispelled "/focefsck" and so it didn't check anything. if you mispell "shutdown" you will get a "command not found" so you know something's gone wrong.

----------

## shazam75

thanks tune2fs -c 100 /dev/hda3 worked for me.

Cheers

Shelton.

----------

