Backup and Restore the Apstra ZTP Server
Starting in Juniper Apstra Data Center Director 6.1. you can backup and restore the
Apstra ZTP server.
Backup the Apstra ZTP Server
Issue the
sudo ztp_backupcommand to create a snapshot of the Apstra ZTP server.admin@apstra-ztp:~$ sudo ztp_backup Including secret keys from the backup ==================================================================== Backup operation completed successfully. ==================================================================== New ZTP snapshot: 2026-01-20_05-50-40 Cleaning up temporary files... admin@apstra-ztp:~$
As you can see, a snapshot of the Apstra ZTP server was created.
Issue the
sudo ls -lah /var/lib/apstra_ztp/snapshotcommand to create a backup directory.admin@apstra-ztp:~$ sudo ls -lah /var/lib/apstra_ztp/snapshot total 16K drwxr-xr-x 4 root root 4.0K Jan 20 06:05 . drwxr-xr-x 3 root root 4.0K Jan 20 05:50 .. drwxr-xr-x 3 root root 4.0K Jan 20 05:50 2026-01-20_05-50-40 drwxr-xr-x 3 root root 4.0K Jan 20 06:05 2026-01-20_06-05-30 admin@apstra-ztp:~$
As you can see, the backup directory contains snapshots of the Apstra ZTP server.
Restore the Apstra ZTP Server
- Issue the
sudo ls -lah /var/lib/apstra_ztp/snapshot/2026-01-20_05-50-40/command to restore the files you backed up.admin@apstra-ztp:~$ sudo ls -lah /var/lib/apstra_ztp/snapshot/2026-01-20_05-50-40/ total 14M drwxr-xr-x 3 root root 4.0K Jan 20 05:50 . drwxr-xr-x 4 root root 4.0K Jan 20 06:05 .. -rw-r--r-- 1 root root 1 Jan 20 05:50 comment.txt drwxr-xr-x 2 root root 4.0K Jan 20 05:50 metadata -rw-r--r-- 1 root root 14M Jan 20 05:50 ztp.data.tar.gz -rwxr-xr-x 1 root root 7.6K Jan 20 05:50 ztp_restore
Issue the
sudo /var/lib/apstra_ztp/snapshot/2026-01-20_05-50-40/ztp_restorecommand to unpack theapstra_ztpinstaller, restore the database, restart ZTP service, and perform other tasks.admin@apstra-ztp:~$ sudo /var/lib/apstra_ztp/snapshot/2026-01-20_05-50-40/ztp_restore Including secret keys from the backup ==================================================================== Backup operation completed successfully. ==================================================================== New ZTP snapshot: 2026-01-20_06-18-43 Cleaning up temporary files... Stopping ZTP service Starting database container WARN[0000] /etc/apstra_ztp/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion Waiting for database to be ready. Database is not ready yet. Retrying in 5 seconds. mysqld is alive Database is ready Clearing existing files Extracting backup data... (Reading database ... 82575 files and directories currently installed.) Preparing to unpack .../apstra-ztp_6.1.0-5_all.deb ... Unpacking apstra-ztp (6.1.0-5) over (6.1.0-5) ... Setting up apstra-ztp (6.1.0-5) ... Restoring database... Stopping database container WARN[0000] /etc/apstra_ztp/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion [+] stop 1/1 ✔ Container db Stopped 0.3s Updating DHCP configuration with TFTP IP if TFTP is changed Updating DHCP configuration with IP address: 10.28.216.6 Updating ZTP script checksums Starting ZTP service ==================================================================== ZTP Restore operation completed successfully. ==================================================================== Cleaning up temporary files... admin@apstra-ztp:~$
ZTP has been restored.