LinuxCommandLibrary

rusnapshot

Create and manage Btrfs snapshots

TLDR

Create a snapshot using a configuration file

$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] --cr
copy

List created snapshots
$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] [[-l|--list]]
copy

Delete a snapshot by ID or the name of the snapshot
$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] --del --id [snapshot_id]
copy

Delete all hourly snapshots
$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] [[-l|--list]] [[-k|--keep]] [0] --clean --kind [hourly]
copy

Create a read-write snapshot
$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] --cr [[-r|--rw]]
copy

Restore a snapshot
$ sudo rusnapshot [[-c|--config]] [path/to/config.toml] --id [snapshot_id] [[-r|--restore]]
copy

SYNOPSIS

rusnapshot action [options]
rusnapshot create [--description text]
rusnapshot list
rusnapshot delete snapshot_id
rusnapshot rollback snapshot_id

PARAMETERS

create
    Creates a new Btrfs snapshot of the current root filesystem state. This snapshot can later be used for rollback.

--description text
    Used with create, this option adds a human-readable description to the new snapshot, making it easier to identify later.

list
    Displays a list of all existing Btrfs snapshots managed by rusnapshot, typically including their IDs, creation times, and descriptions.

delete snapshot_id
    Removes a specified snapshot. The snapshot_id is obtained from the list command. Use with caution as this action is irreversible.

rollback snapshot_id
    Reverts the root filesystem to the state of the specified snapshot. This typically involves making the chosen snapshot the active root subvolume and moving the current root to an 'old_root' subvolume. Requires careful use and understanding of Btrfs subvolumes.

--help
    Displays a brief help message and usage information for the command.

DESCRIPTION

The rusnapshot command is a utility designed to simplify the management of Btrfs filesystem snapshots, particularly for the root filesystem. It allows users to easily create, list, delete, and rollback to previous system states. It acts as a high-level wrapper around low-level btrfs commands, abstracting away much of the complexity involved in manually managing Btrfs subvolumes and snapshots. This tool is often used as a direct method for system recovery or for creating restore points before significant system changes (e.g., updates, driver installations). It's a key component in enabling robust rollback capabilities on Btrfs-based Linux installations, frequently found in distributions like openSUSE.

CAVEATS

rusnapshot is designed specifically for Btrfs filesystems, particularly for managing the root subvolume. It will not work on other filesystem types.
Performing a rollback or delete operation can lead to data loss or an unbootable system if not used correctly. Always ensure you understand the implications and have backups.
While it provides a simplified interface, a basic understanding of Btrfs subvolumes is beneficial for advanced usage and troubleshooting. It often interacts with the default Btrfs subvolume structure (e.g., `@` for root, `@snapshots`).

USE CASES

System Updates: Create a snapshot before a major system update to easily revert if something goes wrong.
Testing Software: Snapshot your system before installing experimental software or making significant configuration changes.
Disaster Recovery: If your system becomes unbootable or unstable, a quick rollback to a previous working snapshot can save time and effort.

INTEGRATION WITH SNAPPER

While rusnapshot can be used manually, it often works in conjunction with snapper, another Btrfs snapshot management tool. Snapper can automatically create snapshots (e.g., before/after `zypper` or `YaST` operations), and rusnapshot provides a direct way to manage or rollback to these or manually created snapshots.

HISTORY

The rusnapshot utility is often part of the 'rollback' package, predominantly found in openSUSE and SUSE Linux Enterprise distributions. Its development is closely tied to SUSE's early and strong adoption of Btrfs as the default root filesystem, aiming to provide robust system recovery capabilities out-of-the-box, complementing tools like snapper.

SEE ALSO

btrfs(8), snapper(8), mount(8)

Copied to clipboard