How to clone a TarMK instance in AEM


This article explains how to properly clone an AEM instance that uses TarMK (or TarMK + FileDataStore) for the storage.


The steps below demonstrate how to copy an AEM + TarMK + FileDataStore instance using rsync on Linux with AEM installed under /mnt/aem/author.

  1. Copy the full AEM instance to another server while it is running using a command like rsync.  Make sure to preserve timestamps during the copy process and exclude the logs folder and datastore.  For example: rsync -av --exclude 'crx-quickstart/logs' --exclude 'crx-quickstart/repository/repository/datastore' /mnt/aem/author user@dest-host:/mnt/aem/
  2. Stop AEM
  3. Initiate another copy of the TarMK segmentstore folder to get any newer changes since the first copy was done: rsync -av /mnt/aem/author/crx-quickstart/repository/segmentstore/* user@dest-host:/mnt/aem/author/crx-quickstart/repository/segmentstore/
  4. Start AEM.
  5. Copy the datastore while AEM is running. For example: rsync -av /mnt/aem/author user@dest-host:/mnt/aem/crx-quickstart/repository/repository/datastore /mnt/aem/crx-quickstart/repository/repository/
  6. On the destination server, re-create the logs folder, delete the crx-quickstart/repository/index folder, and delete the from the crx-quickstart/launchpad/felix folder.

mkdir /mnt/aem/crx-quickstart/logs

rm -rf /mnt/aem/crx-quickstart/repository/index

find /mnt/aem/crx-quickstart/launchpad/felix -type f -name "" -exec rm -f {} \; -print
7. On the destination server, start AEM and test your instance.

Important Note:

You must ensure that the datastore is copied after the segmentstore folder and that all timestamps are preserved during the copy.  Rsync allows timestamps to be preserved with the -a option.

On this page