This is another one of those items that is really just for myself, because it will certainly come up again…
I have a Synology NAS I use for backups, and once in awhile you end up with a filesystem error that it can’t fix, so the recommended solution is to copy everything off the backup volume, reformat the drives/volume and copy everything back (which I’ve done a couple times over the years). Most recently, one of the hard drives failed in the RAID (no biggie, popped in a new one and it rebuilt itself as expected), but also ended up with some filesystem errors for whatever reason. I decided this time I was going to figure out how to fix it without copying everything off and back on to it.
It’s currently running DSM 7.1.1, so what I did may or may not work for other versions (and I should also point out that this post is intended as a reminder to myself, I don’t recommend anyone doing it to their own system).
Step 1: Enable Telnet on the NAS (you can’t do this over SSH because of how some processes work, not going to go into the details here).
Step 2: Telnet in and shut down PostgreSQL via (the PostgreSQL service will automatically restart, preventing the volume from being unmounted): sudo systemctl stop pgsql
Step 3: Unmount the volume: sudo umount -f -k /volume1
Step 4: Repair the volume: sudo e2fsck -yvf -C 0 /dev/vg1000/lv
Step 5: Mount the volume: sudo mount /dev/vg1000/lv /volume1
Step 6: Start PostgreSQL: sudo systemctl start pgsql
Step 7: Disable Telnet on the NAS because outside of this, there is no good reason to have it enabled.
You’ll want to let the NAS do it’s normal filesystem check now and run a data scrub.
It also probably makes sense to restart the NAS, but it doesn’t seem like it’s absolutely necessary.