Monday, 12 May 2008

Forcing fsck on reboot in Ubuntu

This works on Hardy and presumably well back
sudo touch /forcefsck
sudo reboot

1 comments:

LPIC1 said...

There are many methods to do this.
Every partition has the superblock containing, among other vital information, details the last time the file system has been checked and when the next check is due.

sudo tune2fs -l "device" --> dumps superblock information

sudo tune2fs -c "count" "device" --> sets the mount count check to "count" . If set to 4 , fsck has to be run after 4 mounts

sudo tune2fs -C "count" "device" --> cheat, set the mount count to "count"

sudo tune2fs -i 4w "device" --> run fsck after 4 weeks.