I want to run periodically the fsck
Terminal command, so it will run, let's say, every Friday at 10 am. Also, I'd like it to run in background and save the output in file, let's say, ~/Documents/errors.log.
I'm using Ubuntu 18.04.3 LTS that runs as Live Ubuntu with Persistent Storage from USB stick.
Can I do it? How?
The Myth - "NO it can't be done"
All these most popular google search hits ignore the question or say NO it can't be done. That isn't true though.
fsck
is scheduled to run during boot before the filesystem is mounted asrw
(read/write). As such most answers says it can't be run after system is fully booted:Why it needs to be done
This is a good question for some types of users.
fsck
regularly.fsck
to run. As such I have it disabled during boot.What the manual says about how it can be done
You can run
fsck -n
but it won't accurately report errors for ReiserFS (whatever that filesystem is). There is another obscure file system called it refuses to check altogether.What it looks like checking mounted partitions
I have three partitions; Old (broken) Ubuntu 16.04, Ubuntu 19.04 (called
Ubuntu 18.04
) and New Ubuntu 16.04. When runningfchk
they look like this:As you can see
fsck
is telling us Old Ubuntu 16.04 requires a realfsck
be run with system mounted inro
(read only mode) so fixes can be applied if necessary. However I already know it is broken.Later I'll update this answer with a cron weekly job that runs
fsck
on three mounted Ubuntu partitions in check only mode.