0

I have a Voyage Linux (a Debian derived system) computer (which is headless, ie no display). The root filesystem is marked as corrupted and there are actually some errors.

I would like to fix these errors, but I can't. I tried several things (shutdown -rF now, touch /forcefsck, set FSCKFIX=yes in /etc/default/rcS, tune2fs -c 1 -C 1 /myfilesystem): no check is done.

After some searches I discovered that the /etc/init.d/checkroot.sh was set to check the /dev/root filesystem:

   fstabroot=/dev/root
   #...
   rootcheck=yes

while df told me this:

Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                     3541948   1156324   2205660  35% /
/dev/disk/by-label/ROOT_FS 3541948   1156324   2205660  35% /

tune2fs indicates this:

# tune2fs -l /dev/disk/by-label/ROOT_FS
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   ROOT_FS
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         not clean with errors
Errors behavior:          Continue
Filesystem OS type:       Linux
Filesystem created:       Tue Mar 13 09:49:14 2012
Last mount time:          Sat Jan  1 02:36:20 2000
Last write time:          Tue Apr 14 08:38:22 2026
Mount count:              3
Maximum mount count:      1
Last checked:             Fri Jun 15 20:55:44 2012
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)

My fstab looks like:

#/dev/hda1      /       ext2    defaults,noatime,rw     0       0
proc            /proc   proc    defaults                0       0
tmpfs       /tmp    tmpfs   nosuid,nodev        0   0
#tmpfs           /rw    tmpfs   defaults,size=32M       0       0

The only way I found to force fsck to run was to modify the /etc/init.d/checkroot.sh setting the following values:

   fstabroot=/dev/disk/by-label/ROOT_FS
   #...
   rootcheck=yes

and then perform 'touch /forcefsck' and reboot

I believe this is a quick and dirty fix to make my FS be repaired.

What can I do to repair this volume using a better practice ?

Chris S
  • 77,337
  • 11
  • 120
  • 212
lauhub
  • 109
  • 1
  • 6

2 Answers2

0

I think that e2fsck cannot correct certain errors on the volume it is run from. This is why I always have a small additional Linux installation.

How do you make changes ("set FSCKFIX=yes in /etc/default/rcS") on a corropted filesystem?

Hauke Laging
  • 5,157
  • 2
  • 23
  • 40
  • The whole FS is not corrupted, so I just can edit many files. However, there are some errors on the FS that I cannot repair. – lauhub Feb 21 '13 at 16:24
  • FSCKFIX=yes was already set and it was not that which prevented fsck to run at boot. – lauhub Feb 27 '13 at 12:03
0

If you want a partition to be checked during boot, you have to turn on the sixth field - fsckorder bit ON in /etc/fstab. If you set that field to zero then fsck won't check the filesystem. For instance for the root(/) partition you can do this -

/dev/hda1      /       ext2    defaults,noatime,rw     0       1
Daniel t.
  • 9,061
  • 1
  • 32
  • 36
  • My root partition is not mounted with fstab but by grub. I don't know if it is a good thing to mount it also in fstab. Is it ? – lauhub Feb 21 '13 at 19:46
  • I am not sure if it is a good idea, have never worked with Voyage. You can add it to fstab once though and remove it once done. Or boot your machine in `single user mode`, remount root partition in rw mode, and do fsck. Then reboot it. – Daniel t. Feb 21 '13 at 20:39
  • Voyage-Linux is a Debian derived distro. AFAIK, it works like a Debian. So could it be safe to add the following line to fstab ? `/dev/disk/by-label/ROOT_FS / ext2 defaults,noatime,rw 0 1` I am about to try but I don't know if it would cause a conflict with already mounted rootfs. – lauhub Feb 23 '13 at 16:47
  • I made some tests and finally, this is the right solution. Thanks – lauhub Feb 27 '13 at 12:04