NAME
snap, snapfs – create and mount process snapshots

SYNOPSIS
snap [ –o file ] pid...

snapfs [ –a ] [ –m mtpt ] file...

DESCRIPTION
Snap and snapfs allow one to save and restore (static) process images, usually for debugging on a different machine or at a different time.

Snap writes a snapshot (see snap(6)) of the named processes to file (default standard output). Both memory and text images are saved.

Snapfs is a file server that recreates the /proc directories for the processes in the snapshot. By default, it mounts the new directories into /proc before the current entries. The –m option can be used to specify an alternate mountpoint, while –a will cause it to mount the new directories after the current entries.

EXAMPLE
Suppose page has hung viewing Postscript on your terminal, but the author is gone for the rest of the month and you want to make sure the process is still around for debugging on his return. You can save the errant processes with
snap –o page.snap `{psu | awk '$NF ~ /page|gs/ {print $2}'}

When the author returns, he can add the process images to his name space by running
snapfs page.snap

and then use a conventional debugger to debug them.

SOURCE
/sys/src/cmd/snap

SEE ALSO
acid(1), db(1), proc(3), snap(6)

BUGS
The snapshots take up about as much disk space as the processes they contain did memory. Compressing them when not in use is recommended, as is storing them on a rewritable disk.

Pid as a non–numeric string is unimplemented; it has to be a number.