Fixing file system corruption on Synology NAS

I recently recycled my hard-drives on my Synology DS1010+ as one of the drives started to fail. Migration of the drives was easy, but I did notice that I had file-system corruption when looking at dmesg:

htree_dirblock_to_tree: bad entry in directory
Multiply-claimed block(s) in in ode

The Synology does not have a facility to check the file-system during boot up, and the following instructions will allow you to run a file-system repair:

  1. Disable optware: If you have Optware installed, comment out the lines in /etc/rc.local and reboot your NAS. Otherwise just kill all Optware processes.
  2. You need to stop almost all Synology services:
  3. ./S20pgsql.sh stop
    ./S21mysql.sh stop
    ./S04crond.sh stop
    ./S55cupsd.sh stop
    ./S81atalk.sh stop
    ./S23ntpdate.sh stop
    ./S97apache-webdav.sh stop
    ./S97apache-user.sh stop
    ./S97apache-sys.sh stop
    ./S66fileindexd.sh stop
    ./S80samba.sh stop
    ./S77synomkthumbd.sh stop
    ./S66synoindexd.sh stop
    ./S99avahi.sh stop
    ./S12upsmon.sh stop
    ./S83nfsd.sh stop
  4. Try to “umount /volume1″ – if you can’t then there are probably other Synology services running which you need to stop. Only proceed to the next step if you can unmount /volume1.
  5. Depending on your file-system (in my case it is EXT4), you run fsck.ext4 /dev/vg1/lv
  6. The “fsck” command will warn you if the file-system is still mounted, and you should not continue unless you managed to unmount it (you also have backups yes?)
  7. In my case (6TB of storage), the fsck took about 1 hour to run and I had quite a few errors. In all my cases, blocks where assigned to the same file or directories and I just chose to delete those files as part of the file-system check.
  8. Once fsck has completed, issue a “reboot now” on the command line and the Synology will reboot. Once the NAS has booted up, you can re-enable Optware.
An easier approach might also be:
syno_poweroff_task
umount /volume1
fsck.ext4 -pvf /dev/vg1/lv
reboot the system after the scan is completed

You may also like...

5 Responses

  1. I would like to approach for an easier service better with synology.

  2. mike says:

    I’m currently in the process of writing a command to do this for me. Unfortunately I’m seeing a lot of conflicting posts. when i run syno_poweroff_task, /volume1 and it’s mount point are no longer available. any suggestions?
    DS1512+

  3. itsluy says:

    They recently added this feature in DSM 4.3 beta :)

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>