Skip to main content

Overview

The cloudstic forget command removes snapshots from the repository. It supports two modes:
  1. Single snapshot mode: Remove a specific snapshot by ID
  2. Policy mode: Apply retention rules to automatically keep/remove snapshots based on age and frequency
Removing snapshots with forget only deletes the snapshot objects themselves. The actual data chunks remain in the repository until you run prune to reclaim storage.

Usage

Remove a specific snapshot

Apply a retention policy

How It Works

Single Snapshot Mode

  1. Deletes the specified snapshot object (snapshot/<id>)
  2. Updates the snapshot catalog to remove the entry
  3. If the deleted snapshot was the latest, re-elects a new latest from remaining snapshots
  4. Optionally runs prune if -prune flag is set

Policy Mode

  1. Load snapshots: Reads all snapshots from the repository
  2. Filter: Applies filters (-tag, -source, -account) to select candidates
  3. Group: Groups snapshots by fields (-group-by) like source, account, or path
  4. Evaluate policy: For each group, applies retention rules to determine keep/remove sets
  5. Remove: Deletes snapshots not matched by any keep rule
  6. Prune: Optionally runs garbage collection if -prune flag is set
OR logic: A snapshot is kept if it matches ANY keep rule. For example, if a snapshot is both a “last” snapshot and a “daily” snapshot, it will be kept.

Options

Flags

flag
Automatically run prune after forgetting to reclaim storage space. Without this flag, storage is not freed until you manually run cloudstic prune.Default: false
flag
Show what would be removed without actually deleting anything. Displays keep/remove decisions for each group.Default: false
flag
Log detailed information about each snapshot being processed.Default: false

Retention Policy Options

int
Keep the N most recent snapshots (by creation timestamp).Default: 0 (disabled)
int
Keep one snapshot per hour for the last N hours that have snapshots. Keeps the newest snapshot in each hourly bucket.Default: 0 (disabled)
int
Keep one snapshot per day for the last N days that have snapshots. Keeps the newest snapshot in each daily bucket.Default: 0 (disabled)
int
Keep one snapshot per ISO week for the last N weeks that have snapshots. Keeps the newest snapshot in each weekly bucket.Default: 0 (disabled)
int
Keep one snapshot per month for the last N months that have snapshots. Keeps the newest snapshot in each monthly bucket.Default: 0 (disabled)
int
Keep one snapshot per year for the last N years that have snapshots. Keeps the newest snapshot in each yearly bucket.Default: 0 (disabled)

Filtering Options

string
Only consider snapshots that have this tag. Can be specified multiple times. Snapshots must have ALL specified tags.Default: (none)
string
Only consider snapshots from this source URI. Uses the same URI format as the backup command: local:<path>, sftp://[user@]host[:port]/<path>, gdrive, gdrive-changes, onedrive, onedrive-changes.Default: (none)
string
Only consider snapshots from this account (e.g., user@example.com for cloud sources).Default: (none)

Grouping Options

string
Comma-separated list of fields to group snapshots by before applying the policy. Valid fields: source, account, path, tags. Empty string disables grouping (applies policy globally).Default: "source,account,path" (group by source identity)

Global Options

  • -store: Storage backend URI
  • -password, -encryption-key: Repository credentials
  • -quiet: Suppress progress bars
  • -json: Write the command result as JSON to stdout

Examples

Remove a specific snapshot

Removes the snapshot with ID abc123def456. Storage is not reclaimed until prune runs.

Remove a snapshot and prune immediately

Deletes the snapshot and immediately reclaims storage space.

Keep last 10 snapshots

Keeps the 10 most recent snapshots and removes all older ones.

Keep daily snapshots for 30 days

Keeps one snapshot per day for the last 30 days. Older snapshots and duplicates within the same day are removed.

Comprehensive retention policy

Keeps:
  • 5 most recent snapshots
  • 1 snapshot per day for last 7 days
  • 1 snapshot per week for last 4 weeks
  • 1 snapshot per month for last 12 months
  • 1 snapshot per year for last 2 years
Then immediately prunes unreachable data.

Preview retention policy

Shows which snapshots would be kept/removed without deleting anything:

Keep snapshots with specific tag

Applies the retention policy only to snapshots tagged with production. Other snapshots are unaffected.

Separate policies per source

Applies policy only to Google Drive snapshots from user@example.com. Due to default grouping, snapshots from other sources are unaffected.

Global policy (no grouping)

Disables grouping and applies the policy globally across all snapshots regardless of source, account, or path.

Output

Single Snapshot Mode

Policy Mode

Policy Mode with Prune

Understanding Retention Policies

Time Buckets

Time-based rules (hourly, daily, weekly, monthly, yearly) work by grouping snapshots into buckets:
  • Hourly: 2026-03-03 10 (year-month-day hour)
  • Daily: 2026-03-03 (year-month-day)
  • Weekly: 2026-W09 (ISO year-week)
  • Monthly: 2026-03 (year-month)
  • Yearly: 2026 (year)
For each bucket, the newest snapshot in that bucket is kept.

OR Logic

A snapshot is kept if it matches any keep rule. For example:
  • The 5 most recent snapshots are kept due to --keep-last
  • Additionally, one snapshot per day for the last 7 days is kept due to --keep-daily
  • If a snapshot qualifies under both rules, it’s kept (and shown with multiple reasons)
  • Snapshots that match neither rule are removed

Grouping

By default, policies are applied per (source, account, path) group. This means:
  • Local backups from /home/user/docs and /home/user/photos are treated as separate groups
  • Google Drive backups from different accounts are treated as separate groups
  • Each group has the policy applied independently
Use -group-by to customize:

Difference Between Forget and Prune

Key concept: forget removes the pointers to data (snapshots), making data unreachable. prune removes the data itself that is no longer reachable. Always run prune after forget to actually free storage, or use forget -prune to do both in one command.

Best Practices

Use dry run first

Always preview the impact before removing snapshots:

Prune regularly

Either use -prune flag or schedule regular prune runs:

Automate with cron

Schedule retention policy enforcement:

Test with verbose output

Use -verbose to see exactly what’s happening:

Advanced Usage

Multiple tags

Only affects snapshots that have BOTH production AND important tags.

Filter by source and account

Applies policy only to Google Drive snapshots from the specified account.

Custom grouping

Error Handling

Snapshot not found

Solution: Use cloudstic list to see available snapshot IDs.

Empty policy

Solution: Provide either a snapshot ID or at least one --keep-* option.

No snapshots match filter

The filter excluded all snapshots. Check your filter criteria.
  • prune: Reclaim storage after forgetting snapshots
  • list: List all snapshots to see what’s available
  • backup: Create new snapshots

See Also