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)
TL;DR
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
NOTE: /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)
sudo fsck.ext4 -fv /dev/mapper/vol1-origin
NOTE: /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.
7) Reboot
sudo reboot
Done!
Worked great, except I had to sudo to execute fsck.ext4, otherwise you get an error “You must have r/w access to the filesystem or be root”
Also, you may be able to do a simple “cd /” before performing umount instead of closing and re-opening the session.
Thanks for simplifying this, as I was scouring everywhere to find a solution (currently on DSM 6.2).
Only other issue I’ve noticed, is that sometimes the terminal you’re using may time-out, so make sure (in my case: PuTTY) to enable keepalives within whatever terminal program you’re using.
Thanks again!
Thanks for this, I finally was able to get the check to run. I was making the mistake of sudo -i which would kick me out anytime I tried to run the shutdown command… Extremely annoying. There needs to be a better way to do this (that’s on Synology) Seriously, thanks for putting this together!
Mike, thank you very much for your effective help! A small clarification for the DS412+: the first point was not needed. And for the 5th point: added sudo ( sudo fsck.ext4 -fv /dev/mapper/vg1-volume_1 )
err.
2-nd point was not needed
The procedure no longer works in DSM7, please remove the + in DSM6 +!