Perform a disk check on a Synology NAS (DSM6+)
It should be so simple right? For whatever reason, your NAS drive shut down improperly. In my case, I even have a UPS, but DSM had crashed (for the first time in years!) and after waiting for hours for it to shutdown safely, I eventually had to pull the power.
Its an EXT4 partition. All I want to do is run a disk check and fix any errors if there are any. Unbelievably, there has never been a way to do this. Each DSM update brings new challenges.
I want to share what I learnt this time round using DSM6.
First up – the super useful guides which all have slight issues:
1) This great guide from naschenweng.info almost works, and we base our solution closely on this
2) Cool tricks, and really useful guidance, this guide is how I finally located what as going wrong
3) A guide to setup ipkg (which you won’t need if my solution works for you)
Don’t care how you got to the solution, show me what I need to do!
1) Login to SSH as an admin user (you can’t use root on DSM6 anymore!)
sudo syno_poweroff_task -d
2) If you run
mount now, you will see the volume is still mounted, this is because your SSH login is holding it open
sudo umount --lazy /mnt/volume1
/mnt/volume1 <- This changes according to device/setup etc. Have a look in the
/mnt/ folder, or check the output of mount to see what yours is.
3) Close your SSH session – this will allow the lazy unmount to take place
4) Login to SSH as an admin user again – it will complain it can’t mount your user home folder – which is fine, we don’t need it
5) Do the check (this is the command for EXT4 partitions)
fsck.ext4 -fv /dev/mapper/vol1-origin
/dev/mapper/vol1-origin <- This also changes according to device/setup etc. The previous output of
mount will give you the location, or it should be pretty obvious anyway
6) Wait ages.