nodetool listsnapshots
Displays a list of all snapshots on the node with their sizes.
Synopsis
Section titled “Synopsis”nodetool [connection_options] listsnapshots [options]See connection options for connection options.
Description
Section titled “Description”nodetool listsnapshots shows all snapshots on the local node, including:
- Snapshot tag name
- Keyspace and table names
- True data size
- Disk space consumed
Essential for monitoring backup state and managing disk space.
Options
Section titled “Options”| Option | Description |
|---|---|
-e, --ephemeral | Include ephemeral snapshots |
-k, --keyspace <keyspace> | Filter by keyspace name |
-n, --snapshot <name> | Filter by snapshot name |
-nt, --no-ttl | Exclude snapshots with TTL |
-t, --table <table> | Filter by table name |
Output Example
Section titled “Output Example”Snapshot Details:Snapshot name Keyspace name Column family name True size Size on disk Creation timebackup_20240115 my_keyspace users 1.5 GB 1.5 GB 2024-01-15T10:30:00Zbackup_20240115 my_keyspace orders 2.3 GB 2.3 GB 2024-01-15T10:30:00Zbackup_20240108 my_keyspace users 1.2 GB 0 bytes 2024-01-08T10:30:00Zbackup_20240108 my_keyspace orders 2.1 GB 0 bytes 2024-01-08T10:30:00Zpre_upgrade system_schema tables 45 MB 45 MB 2024-01-14T22:00:00Z
Total TrueDiskSpaceUsed: 7.15 GBOutput Fields
Section titled “Output Fields”| Field | Description |
|---|---|
| Snapshot name | Tag used when creating the snapshot |
| Keyspace name | Keyspace containing the table |
| Column family name | Table name |
| True size | Actual data size in the snapshot |
| Size on disk | Current disk space consumed |
| Creation time | When the snapshot was created |
Understanding Size Fields
Section titled “Understanding Size Fields”| True size | Size on disk | Meaning |
|---|---|---|
| 1.5 GB | 1.5 GB | Original SSTables still exist (hard links) |
| 1.5 GB | 0 bytes | Original SSTables compacted away (space freed) |
| 1.5 GB | 500 MB | Partially compacted |
Size on Disk
"Size on disk" shows actual disk blocks consumed. When original SSTables are compacted, the hard links become the only reference, and size on disk increases.
Examples
Section titled “Examples”List All Snapshots
Section titled “List All Snapshots”nodetool listsnapshotsInclude Ephemeral Snapshots
Section titled “Include Ephemeral Snapshots”nodetool listsnapshots -eExclude TTL Snapshots
Section titled “Exclude TTL Snapshots”nodetool listsnapshots -nFilter by Snapshot Name
Section titled “Filter by Snapshot Name”nodetool listsnapshots | grep backup_20240115Total Snapshot Size
Section titled “Total Snapshot Size”nodetool listsnapshots | tail -1Count Snapshots
Section titled “Count Snapshots”nodetool listsnapshots | grep -c "^[a-zA-Z]"When to Use
Section titled “When to Use”Before Creating New Snapshots
Section titled “Before Creating New Snapshots”Check existing snapshots to avoid duplicates:
nodetool listsnapshots | grep my_new_tagDisk Space Investigation
Section titled “Disk Space Investigation”When disk usage is high:
nodetool listsnapshots# Check Total TrueDiskSpaceUsed at the bottomBackup Verification
Section titled “Backup Verification”Verify snapshot was created:
nodetool snapshot -t my_backup my_keyspacenodetool listsnapshots | grep my_backupCleanup Planning
Section titled “Cleanup Planning”Identify snapshots to remove:
nodetool listsnapshots# Find old snapshots by creation timeInterpreting Results
Section titled “Interpreting Results”Recently Created Snapshot
Section titled “Recently Created Snapshot”backup_20240115 my_keyspace users 1.5 GB 1.5 GB 2024-01-15T10:30:00Z- True size = Size on disk = Original SSTables still exist
- Hard links share disk blocks with active SSTables
- Minimal additional space used
Aged Snapshot
Section titled “Aged Snapshot”backup_20240101 my_keyspace users 1.5 GB 1.5 GB 2024-01-01T10:30:00ZAfter compaction runs:
- Original SSTables removed
- Snapshot files become sole reference
- Now consuming full 1.5 GB
No Snapshots
Section titled “No Snapshots”Snapshot Details:
Total TrueDiskSpaceUsed: 0 bytesNo snapshots exist on this node.
Monitoring Snapshot Growth
Section titled “Monitoring Snapshot Growth”Check All Nodes
Section titled “Check All Nodes”for node in node1 node2 node3; do echo "=== $node ===" ssh "$node" "nodetool listsnapshots | tail -3"doneTrack Over Time
Section titled “Track Over Time”# Log snapshot sizes dailyecho "$(date),$(nodetool listsnapshots | tail -1 | awk '{print $2}')" >> /var/log/snapshot_sizes.csvAlert on Large Snapshots
Section titled “Alert on Large Snapshots”total=$(nodetool listsnapshots | tail -1 | awk '{print $2}' | sed 's/GB//')if (( $(echo "$total > 100" | bc -l) )); then echo "WARNING: Snapshot usage exceeds 100GB"fiSnapshot Location on Disk
Section titled “Snapshot Location on Disk”Snapshots are stored in:
/var/lib/cassandra/data/<keyspace>/<table>-<uuid>/snapshots/<tag>/To manually check sizes:
# All snapshotsdu -sh /var/lib/cassandra/data/*/*/snapshots/*
# Specific snapshotdu -sh /var/lib/cassandra/data/*/*/snapshots/backup_20240115/Common Issues
Section titled “Common Issues”Empty Output
Section titled “Empty Output”If no snapshots are shown but you expect them:
- Check if snapshots were taken on this node
- Verify snapshot directory exists:
Terminal window ls /var/lib/cassandra/data/*/*/snapshots/
Incorrect Size Reported
Section titled “Incorrect Size Reported”Size reporting depends on filesystem support for hard links:
- Some filesystems may not accurately report shared blocks
- Use
dufor precise measurements if needed
Very Large Total Size
Section titled “Very Large Total Size”Old snapshots consuming significant space:
# Identify largest snapshotsnodetool listsnapshots | sort -k4 -h
# Clear old snapshotsnodetool clearsnapshot -t old_snapshot_tagBest Practices
Section titled “Best Practices”Snapshot Monitoring Guidelines
- Regular checks - Include in daily monitoring
- Set retention alerts - Alert when snapshots age
- Track total size - Monitor growth trends
- Clean up promptly - Remove snapshots after backup verification
- Use TTL snapshots - Auto-delete when possible (4.0+)
- Document naming - Use consistent, dated snapshot names
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| snapshot | Create snapshots |
| clearsnapshot | Remove snapshots |
| tablestats | Table-level statistics |