How To Backup AEM
To understand how to back up AEM you first need to know how AEM stores data.
The out of the box storage option is AEMs TarMK implementation, this means document and segment stores are stored on the file system, you can find your data repository in the following folder.
For more details check out https://jackrabbit.apache.org/oak/docs/nodestore/overview.html
If you are using other storage options to scale your document store e.g Mongo, S3 Azure etc, then document backups would have to be done per their guidelines.
This is by far the quickest option and the one I use a lot for development. To do offline backup you must first ensure AEM is turned off.
Then take a copy of the folder containing crx-quickstart, rename it something sensible, perhaps the date of the backup. That's all there is to it, if you need to use your backup you can start the AEM instance using the normal procedures.
This takes a longer than the offline backup so I don't use this on my local instance however online backup is more useful on a live instance as you don't need to turn the site off. You would preferably run this during periods of least usage and you should never run this when garbage collection is running.
To start an online backup go to the backup manager screen via the operations dashboard.
To create a new backup use the 'Create' button.
You should set the target path to the location of your backup. By default if no target path is added then a zip file will be created. However this is not encouraged by Adobe as the backup is first added to a temporary folder location.
It is then compressed into a zip file by the repository which will slow it down, this mechanism also takes up more disc space so if you have a large repository you will want to create a zip file separately.
You can automate backups by using a curl command to triggered backups from a script.
curl -u admin:admin -X POST http://localhost:4502/system/console/jmx/com.adobe.granite:type=Repository/op/startBackup/java.lang.String?target=/Backups/200422.zip"
File System Snap Shots
Rather than backing up AEM you can backup your entire file system, then when you need to restore you restore the file system rather than AEM.