Easy backup of nextcloud on BtrFS with 'standard' install

Hi,
With my nextcloud install, I want to start with the basic setup.
Nextcloud docs says, there are 4 important things to consider when backing up nextcloud:

  1. The config folder
  2. The data folder
  3. The theme folder
  4. The database

No headache about the folders, but the database is usually handled with some dumping/backing up action. This isn’t in the BtrFS CoW intend, I think. I want cheap snapshots of the whole nextcloud installation so I’m implementing a layout like:

subvolume nextcloud
	subvolume 'The config folder'
	subvolume 'The data folder'
	subvolume 'The theme folder'
	subvolume 'The database'

and should be good to go with just snapshotting subvolume nextcloud.
I’m going to test this and would also appreciate very much to hear if anybody has already made some experiences with nextcloud backups in that manner.

As far as I remember, snapshots are not recursive, so you need to manually snapshot the children as well.

If my memory is correct, then it might make more sense to get everything into a single subvolume, which contains all of the nextcloud data and nothing else (if this is possible at all with nextcloud) and then snapshot that. This way the snapshot is atomic.

This is a good point. It should be more like:

toplevel				               	(volume root directory, not mounted)
  \-- root						(subvolume root directory, to be mounted at /)
      +-- non nc directories		                (subvolume root directory)
      \-- nextcloud					(subvolume root directory)
          +-- The config folder	        	        (directory)
          +-- The data folder	                	(directory)
	  +-- The theme folder    			(directory)
	  +-- The database				(directory)
  \-- nc snapshots					(directory, not mounted)
      +-- nc_snapshot_2015-01-02	                (subvolume)
      +-- nc_snapshot_2015-01-01                	(subvolume)
      +-- ...						(subvolume)
      +-- ...						(subvolume)

Regarding

System state (php settings, apache/nginx,…) should be reproducible through the .nix file. I should be able to get a nix-shell with a working nextcloud out of a snapshot that contains this .nix file, or get the whole system back to there.