LinuxCommandLibrary

casper-snapshot

Create live system snapshots

SYNOPSIS

casper-snapshot [-h|-v|-d] snapshot.squashfs

PARAMETERS

-h, --help
    Display usage information and exit

-v, --version
    Output version information and exit

-d, --debug
    Enable debug output for troubleshooting

snapshot.squashfs
    Output filename for the generated SquashFS image (required)

DESCRIPTION

The casper-snapshot command is a utility from the Ubuntu casper package, designed for live CD/USB/DVD environments. It captures the current state of the writable overlay filesystem (typically using aufs or overlayfs) and compresses it into a SquashFS image. This enables persistence of user changes across sessions or creation of custom live images.

In a live Ubuntu session with persistence enabled, casper-snapshot is automatically invoked during shutdown to save modifications from the /cow or upper overlay layer. Manually, it can remaster the system by generating a new filesystem snapshot named by the user, excluding volatile directories like /tmp and /var/cache.

It relies on mksquashfs for compression, supporting options for debugging and customization. Ideal for developers building persistent live media or backing up session states, but requires sufficient disk space and root privileges.

CAVEATS

Requires root privileges and a live environment with union/overlay filesystem mounted as rofs and rwfs. Needs ample free space (often GBs for full snapshots). Excludes /proc, /sys, /dev, /tmp. Not for non-live systems; may fail without mksquashfs and kernel support.

LIVE SESSION INTEGRATION

Automatically called by /scripts/casper in initramfs during shutdown if persistence is configured via casper-rw or persistence.conf.

CUSTOMIZATION

Edit /etc/casper.conf or use --filesystem=overlay (undocumented in basic usage) for advanced layering.

HISTORY

Introduced in Ubuntu 6.10 (Edgy Eft, 2006) as part of the casper framework for live CDs. Evolved with upstart to systemd integration and support for overlayfs in kernel 3.18+. Maintained in Debian/Ubuntu live-build tools.

SEE ALSO

mksquashfs(1), aufs(5), overlayfs(5), casper(7)

Copied to clipboard