By default, AEM uses Tar files to store the nodes and binaries of the application. One characteristic of using Tar files for storage is that the changes are never overwritten even if we are only updating data, which continually increases disk space usage.
AEM uses a mechanism called Revision Cleanup to remove unused data from the repository and reclaim disk space.
Performing an Offline Revision Cleanup
Adobe provides a tool called Oak-run that performs an offline cleanup revision. The Offline term means that the AEM instance should be stopped for the cleanup process to work.
Downloading the correct Oak-run version:
- Shut down the AEM instance
- Go to /system/console/bundles (e.g. http://localhost:4502/system/console/bundles) and look for “Oak Core” to check the Oak version.
- Go to http://mvnrepository.com/artifact/org.apache.jackrabbit/oak-run/ and look for the Oak-run version that matches the "Oak Core" version (e.g. https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/1.2.2/ if the Oak Core version is 1.2.2)
Deleting unreferenced checkpoints (optional):
Optionally, before running the cleanup process, you can use the tool for deleting unreferenced checkpoints. To do that:
java -jar oak-run.jar checkpoints install-folder/crx-quickstart/repository/segmentstoreto find the checkpoints
- Then, to delete them run
java -jar oak-run.jar checkpoints install-folder/crx-quickstart/repository/segmentstore rm-unreferenced
Running the cleanup process:
Enter the folder where you downloaded the jar file and run the command as follows: java -jar oak-run.jar compact /route/to/aem/crx-quickstart/repository/segmentstore. Notice that oak-run.jar should be replaced with the jar version you downloaded, e.g., oak-run-1.2.2.jar, and /route/to/aem/ should be replaced by the path to the crx-quickstart folder.
After the process finishes , you will notice that the size of your AEM instance has been significantly reduced.