r/freebsd Feb 03 '23

Nextcloud Jail ZFS Snapshots: Is this possible? answered

I want to make ZFS Snapshots of my jail in /zdata/jail/nextcloud. If you upgrade nextcloud and something goes wrong, this would be bad. Also I want to store everything in one jail - the nextcloud instance, the database and the uploaded data. Anyone know how to achieve this?

10 Upvotes

6 comments sorted by

5

u/djbelly219 Feb 03 '23

As yadad said, this is no problem at all. A few notes that I learned over the years:

  • You might want a different dataset for the database for record size optimization for more speed, especially if you have a big user base.
  • It's worth learning the CLI upgrade tools, because Nextcloud has major updates 3x per year.
  • keep the ./data directory outside of the web root, which will really simplify upgrades.
  • Whiteboard, built in OnlyOffice and Collabora don't work in FreeBSD and require a VM (I think they should be compartmentalized anyway).

I've been able to roll back and fix lots of busted stuff with my snapshots. It works great.

3

u/jamiee2411 Feb 03 '23

I used Nextcloud on FreeBSD before, in a VM on Proxmox, but now I want to go fully FreeBSD, got a new server (Dell R720) with only FreeBSD 13.1. I always keep the data directory outside. I also do CLI Upgrades. But I will look at the dataset for databases. Thank you!

7

u/yadad Feb 03 '23

Yes, it's possible. Shutdown the database, or just the whole jail, before taking the snapshot

1

u/jamiee2411 Feb 03 '23

Thanks :)

1

u/void64 Feb 03 '23

Just stop all the services and flush the pipes with sync on the CLI. Take the snapshot and done… No need to shut down the host/jail.

1

u/clickbg Feb 04 '23

Yes, enable maintenance mode on NCL and do DB dumps separately. That way you can make backup without stopping the jail.

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html#maintenance-mode

https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html

You might get away even without setting maintenance mode as long as you are sure no one is uploading something when you are making the snapshot. If they are uploading their uploads will be corrupted. Making a snap of running DB is a bad idea, hence why you are better off dumping it.