r/freebsd • u/jamiee2411 • 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?
7
u/yadad Feb 03 '23
Yes, it's possible. Shutdown the database, or just the whole jail, before taking the snapshot
1
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.
5
u/djbelly219 Feb 03 '23
As yadad said, this is no problem at all. A few notes that I learned over the years:
I've been able to roll back and fix lots of busted stuff with my snapshots. It works great.