Sshfs and backup

I host discourse for a small community. We have a very small, old VPS. The disk space cannot accommodate backups anymore, so I did a quick trick and mounted remote file system (using sshfs) as /var/discourse/shared/standalone/backups/default . Everything seems to work, I can create / delete a file or directory in /var/www/discourse/public/backups/default/ , but when I try to run a backup it fails. Is there anything I can do to make it work? Permissions are set to 777.

Alternatively - maybe in next version of software option to disable compression for backups will finally exist? That would give us few years of storage :slight_smile:

Thank you!

[2023-02-25 04:41:33] pg_dump: executing SEQUENCE SET category_featured_topics_id_seq
[2023-02-25 04:41:33] pg_dump: executing SEQUENCE SET category_groups_id_seq
[2023-02-25 04:41:33] pg_dump: executing SEQUENCE SET category_required_tag_groups_id_seq
[2023-02-25 04:41:33] pg_dump: executing SEQUENCE SET category_tag_groups_id_seq
[2023-02-25 04:41:33] pg_dump: executing SEQUENCE SET category_tag_stats_id_seq
[2023-02-25 04:41:33] Finalizing backup...
[2023-02-25 04:41:33] Creating archive: p-e-2023-02-25-043914-v20230201192925.tar.gz
[2023-02-25 04:41:33] Making sure archive does not already exist...
[2023-02-25 04:41:34] EXCEPTION: /var/www/discourse/lib/discourse.rb:137:in `exec': rm: cannot remove '/var/www/discourse/public/backups/default/p-e-2023-02-25-043914-v20230201192925.tar': Permission denied

[2023-02-25 04:41:34] /var/www/discourse/lib/discourse.rb:171:in `execute_command'
/var/www/discourse/lib/discourse.rb:137:in `exec'
/var/www/discourse/lib/discourse.rb:33:in `execute_command'
/var/www/discourse/lib/backup_restore/backuper.rb:216:in `create_archive'
/var/www/discourse/lib/backup_restore/backuper.rb:40:in `run'
/var/www/discourse/script/spawn_backup_restore.rb:9:in `backup'
/var/www/discourse/script/spawn_backup_restore.rb:31:in `block in <main>'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
[2023-02-25 04:41:34] Deleting old backups...
[2023-02-25 04:41:34] Cleaning stuff up...
[2023-02-25 04:41:34] Removing '.tar' leftovers...
[2023-02-25 04:41:34] Marking backup as finished...
[2023-02-25 04:41:34] Refreshing disk stats...
[2023-02-25 04:41:34] Notifying 'siteadmin' of the end of the backup...
[2023-02-25 04:41:42] Finished!

Nobody? Any idea how to fix it (apart from some sort of I don’ t know, nfs over ssh tunnel)? :frowning_face:

Disk is cheap and Discourse migrations are some of the most simple. It’s probably worth considering migrating VPS. if you can’t currently accommodate backups then things like a postgres upgrade will be a total showstopper.

It’s not worth putting time into this for most because time is worth more than the couple of extra GB.


This likely happens because the Discourse backup process runs with effective user ID 0, thus you will likely need to pass this option to sshfs:

sshfs -o allow_root SERVER:PATH MOUNT_POINT

Or if you’re using unprivileged containers, allow_other instead.

Would you be willing to donate some of that cheap disk? :wink:

Thank you, I will try it. It does make sense. :+1: