FSCK (File-System Check)

I just reviewed some of my Seafile documentation and found this

Seafile FSCK:
source: https://manual.seafile.com/maintain/seafile_fsck.html

Usage-Modes:

  1. checking integrity of libraries.
  2. repairing corrupted libraries.
  3. exporting libraries.

Integrity Checks:

Running seaf-fsck.sh without any arguments will run a read-only integrity check for all libraries.
cd seafile-server-latest
./seaf-fsck.sh

Running the following command will run a read-only integrity check for specific libraries

cd seafile-server-latest
./seaf-fsck.sh [library-id1] [library-id2] …

Repair corrupted Libraries:

Running the following command repairs all the libraries:
cd seafile-server-latest
./seaf-fsck.sh --repair

Running the following command repairs specific libraries

cd seafile-server-latest
./seaf-fsck.sh --repair [library-id1] [library-id2] …

Exporting Libraries:

Running the following** command exports all the libraries to the “top_export_path”
cd seafile-server-latest
./seaf-fsck.sh --export top_export_path

Running the following command exports the specified libraries to the “top_export_path”

cd seafile-server-latest
./seaf-fsck.sh --export top_export_path [library-id1] [library-id2] …

So far I have a cron job running every 2 Weeks to delete old data.
I was wondering ist I need to do the FSCK in a similar maner.
I have never done FSCK over the last 2 years.

  • How often do you guys run FSCK?
  • Did you ever have any issues after running it /w repair mode? because that is the mode I would run it…

Thanks for your feedback

You only have to run it in case a library was corrupted which (only) happens when your disk or storage is faulty.

Such a corruption requires manual actions in most cases. Repair will use the latest working commit (afaik) also meaning that there can be dataloss. Due to that the library won’t be synced anymore unless the sync is being reconfigured.

as I would like to identify a corruption as soon as at appear, I would still like to run a regulary schedulded seaf-fsck read-only integrity check. As I want to embed this task in a bash script, does anybody know the exit code logic for seaf-fsck? I could not find any documentation on that anywhere on the web.

the idea is to run something like
seaf-fsck.sh >seaf-fsck.log || echo "[$(date +"%H:%M:%S")] Seafile FSCK FAILED"

Bringing up this topic again - I want to run a monthly seaf-fsck and get notified of any issues. @daniel.pan is there any exit code logic based on the result of the fsck implemented? There is nothing in the documentation (at least I did not find anything).

If you do echo $? after you run fs check you will find out if there is an exit code in bash or not.

If you want to run a monthly filesystem check then you should do it and make logs and grep logs for word ‘fail’ as the docs mention , then build yourself a send only Postfix to email you if there are errors.