Byte Sized Wisdom – Snapshots revisited

Authored by:

Man, those customers should try doing something hard sometime… deploying a Qumulo is comically easy compared to a lot of things I deploy” – Anonymous customer

Welcome back to the world famous Byte Sized Wisdom!  At least I’m pretty sure they’ve heard of us in Antarctica.   We took a month off to give a webinar (you can find it here) talking all about snapshots, locking, and recovery, but we’re back in spades this month to piggy back on that and give some actual tricks we use when dealing with snapshots.

Let’s dive right in shall we?

Support, how do I what’s changed between snapshots?

For this we’d use the ‘‘snapshot_diff’ command.  First we’ll collect our snapshot IDs

				
					root@hooper-1:~# qq snapshot_list_snapshots | jq -r '.entries[] | select(.name |contains ("Gazontapede"))'
{
  "expiration": "2023-11-13T15:46:03.088492418Z",
  "id": 1038592,
  "in_delete": false,
  "name": "1038592_Gazontapede-5min_gazontapede",
  "policy_id": 15,
  "source_file_id": "36010006",
  "timestamp": "2023-11-13T15:26:03.088558899Z"
}
…
…
{
  "expiration": "2023-11-13T16:01:03.074206278Z",
  "id": 1038610,
  "in_delete": false,
  "name": "1038610_Gazontapede-5min_gazontapede",
  "policy_id": 15,
  "source_file_id": "36010006",
  "timestamp": "2023-11-13T15:41:03.074303969Z"
}

				
			

Now we cand use our old ID (1038592) and compare it to the new ID (1038610).

				
					root@hooper-1:~# qq snapshot_diff --newer-snapshot 1038610 --older-snapshot 1038592
{
    "entries": [
        {
            "op": "MODIFY",
            "path": "/gazontapede/how_to_identify_gazontapedes.txt"
        },
        {
            "op": "MODIFY",
            "path": "/gazontapede/"
        }
    ],
    "paging": {
        "next": null
    }
}

				
			

In this case, we can see that the only changes were someone was writing about how to identify gazontapedes.  Obviously in a real world environment, this would undoubtedly have more entries, but you can get a feel for what we’re looking at.

Support, how do I know the size of my snapshots?

The default `qq snapshot_get_capacity_used_per_snapshot` command fails to take into account what we refer to as “covered data” – that is, the data that exists between multiple snapshots.   One of our amazing developers addressed this in the Snapshot article written here.  

While covered data is difficult to account for in an easy manner, this one liner will certainly burn through what is specific to each snapshot and give you a good size to go after.

				
					root@qumulo-1:~# mapfile -t SNAP < <(qq snapshot_list_snapshots | jq -r '.entries[].name' | sort -u); for i in "${SNAP[@]}"; do IDS=$(qq snapshot_list_snapshots | jq --arg VAR "$i" '.entries[]|select(.name==$VAR).id'|paste -sd ','); CAPACITY_USED=`qq snapshot_calculate_used_capacity --ids $IDS | jq '.bytes|tonumber'`; echo "Snapshot Name: $i | Capacity used: $CAPACITY_USED"; done | awk '{print $NF,$0}' | sort -nr | cut -f2- -d' '

Snapshot Name: 15_replication_to_qumulo_bk | Capacity used: 1695744
Snapshot Name: 16_replication_to_qumulo_bk | Capacity used: 536576
Snapshot Name: 22_replication_to_qumulo_bk | Capacity used: 274432
Snapshot Name: 14_Gazontapede_Daily | Capacity used: 98304
Snapshot Name: 21_Gazontapede_Daily | Capacity used: 45056

				
			

What an aspiring soul could then do is couple this with the `snapshot_diff` mentioned prior, and get a good feel for how much space is tied up in that covered data.

Support, I just want to know the top ten snapshot offenders – how can I do that?

Cake, piece of. 

				
					sudo qq snapshot_get_capacity_used_per_snapshot | jq '[.entries[]]|sort_by(.capacity_used_bytes|tonumber)|.[-10:]'
				
			

If you’d like more than the top ten, you can just change that number at the tail end.

 

Support, I have a congress of snapshots that need deleting, how can I do that fast and easy?

A lot of admins aren’t aware that a grouping of snapshots is called a congress.  That aside, this is also an easy one to pull off.

First, generate a list of your snapshot IDs.  For example

				
					root@qumulo-1:~# qq snapshot_list_snapshots | grep -B 3 "\"*Gazontapede-5min" | grep id |awk '{print $2}' |sed 's/,$//' > /history/snap_delete
				
			

This will save all the IDs associated with my Gazantapede-5min snapshot policy to a file called /history/snap_delete.

Now I’ll simply issue

				
					root@qumulo-1:~# cat /history/snap_delete | xargs -I % sh -c 'qq snapshot_delete_snapshot -i %'
				
			

And we’re off to the races.

Support, how many birds can fit in a tree?

While, not directly Qumulo related, I believe the answer is tou-can.

Hopefully, you’ve found the aforementioned tips to be handy.  You’ll note we can (and do) switch back and forth from jq to regular unix – either one works, so whichever you’re more comfortable with, go that route.   

In parting, as we come up on the holiday season, I’d ask that you be careful if you’re planning to leave the data center and visit the wilds.  Tigers can be hard to spot because they are…. striped.

Until next month!

0 0 votes
Article Rating
Subscribe
Notify me about
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Related Posts

0
Would love your thoughts, please comment.x
()
x
Scroll to Top