Exporting and Importing a Snapshot

Export a snapshot out of PMEM and onto disk storage, then import it to the same or a different host, using the mvmcli snapshot export commands.

Before you begin

Ensure that the Zstandard (zstd)compression utility is installed on the host from which you are exporting. If Zstandard is unavailable, the exporter uses zip, which can be much slower.

About this task

Export snapshots from a host to:

  • Preserve snapshots while you reinstall Memory Machine.
  • Duplicate application instances on a different host.

Procedure

  1. Take a snapshot.
    # mvmcli snapshot create -p pid -l label
    For example:
    # mvmcli snapshot create -p 12345 -l redis-server
    Snapshot redis-server_11dc085a created in 604.73 ms, application frozen for 146.44ms.
  2. Optional: Create a directory to put the export file in. For example:
    # mkdir /home/mvmm_user/export_dir
  3. Export the snapshot as follows:
    # mvmmcli snapshot export -x export_directory -l|--label snap-label 
    where
    export_directory
    is a directory in a filesystem accessible to the host.
    snap-label
    is a label to use as the filename of the snapshot.
    For example:
    # mvmcli snapshot export -x /home/mvmm_user/export_dir -l redis-server_11dc085a
    Snapshot redis-server_11dc085a has been successfully exported
  4. List the directory to which you exported the file.
    # ls /home/mvmm_user/export_dir/
    total 84
    -rw-r--r--. 1 root root 82512 Nov 10 10:55 redis-server-f3e1d4ea
  5. (If necessary) When you are ready to restore the snapshot, move the export file to a destination host. For example:
    $ scp /home/mvmm_user/export_dir/redis-server-f3e1d4ea mvmm_user@target_host:/home/mvmm_user/
    $
    Another option is to export the snapshot to a shared filesystem, such as an NFS share, that is also accessible to the target host.
  6. Import the snapshot using the mvmcli snapshot import command.
    $ mvmcli snapshot import -x export_file
    where
    export_file
    is the file path of the exported snapshot.
    For example:
    $ mvmcli snapshot import -x /home/mvmm_user/export_dir/redis-server_11dc085a
  7. Restore the snapshot.
    $ mvmcli snapshot restore -l export_file
    where
    export_file
    is the file path of the exported snapshot.
    For example:
    $ mvmcli snapshot restore -l redis-server_11dc085a