Skip to main content

View btrfs snapshot trees

Project description

BTRVIEW

Overview:

Call btrview with a label to get an overview of the subvolume and snapshot tree layout for that specified btrfs filesystem. Call it with multiple labels and it will list each filesystem specified. Call it with no labels, and it will give an overview of every btrfs filesystem it can find.

> sudo btrview --labels HDDs --fold 5

btrview output

Subvolumes that are mounted (in fstab or somehow else) are in bold, those that are grey are subvolumes that aren't currently reachable on the filesystem, and subvolumes in red (not shown here) are not currently on the filesytem. This could be because they're deleted, or maybe its child subvolume was btrfs received from another filesystem.

Wondering what the difference between the subvolume and snapshot tree is? Check out the FAQ!

Installation:

Btrview relies on the following dependencies:

The easiest way to download btrview is to use pipx to download it from the python package index. Use the command pipx install --system-site-packages btrview. Using pipx to install btrview will also install treelib and rich and add the btrview command to your path allowing you to run the command from anywhere on the system.

If you don't feel like installing via pipx you can download it via git clone https://github.com/CopOnTheRun/btrview then cd btrview. From within the btrview directory you can run the script with python -m btrview. Note that if you clone the repository you'll need to make sure you have all the dependencies installed already.

Installation Troubleshooting

Q: How come when I use the sudo command with btrview I get sudo: btrview: command not found, but when I run it without sudo the command is recognized?

A: You are likely using a linux distribution which hard codes the paths sudo can use to find executables. There are two options here, you can either comment out the line that contains "secure_path" in /etc/sudoers or you can add the path you're using to that variable. The former option will change it so that any executable in the user's path can be executed, the latter option will merely add the user's path to list of allowed paths.

Some Qs and As:

Q: What is btrfs?

In short, it's a copy on write (COW) filesystem. If you're not already using btrfs, then check out the documentation to see if it's something you'd be interested in.

Q: What does btrview do?

It produces a view of the btrfs filesystems, mounts, as well as the subvolume tree or snapshot tree on your system.

Q: What's the difference between the subvolume tree and the snapshot tree?

The subvolume tree is a tree of which subvolumes are within other subvolumes, parents being denoted by "Parent ID". The subvolume tree can be manipulated by moving subvolumes in or out of other subvolumes. The snapshot tree shows the relations between snapshots, ie snapshots taken of snapshots, etc.

If that's a little obscure here's a visual example of the difference.

If you run these commands:

btrfs subvolume create subvol
btrfs subvolume create subvol/nested_subvol
btrfs subvolume snapshot subvol subvol/subvol-snap
btrfs subvolume snapshot subvol subvol/subvol-snap2
btrfs subvolume snapshot subvol/nested_subvol subvol/nested_subvol-snap

The subvolume tree would look like:

subvol
├── nested_subvol
├── subvol-snap
├── subvol-snap2
└── nested_subvol-snap

The snapshot tree would look like:

subvol
├── subvol-snap
└── subvol-snap2
nested_subvol
└── nested_subvol-snap

Q: What's the point of this program?

The main thing btrview accomplishes is providing an organized overview of a (or multiple) btrfs filesystem(s). Due to the fact btrfs relies only on loose conventions to determine where snapshots are stored, and how subvolumes are organized, it can be difficult to gain an understanding of how things are laid out. With btrview it's easy to know which subvolumes have snapshots, how many, and where they're stored. Even if your snapshots and subvolumes are scattered around a messy filesystem they'll all still show up as a nice little tree.

Q: What's not the point of this program?

This is in no way shape or form a backup solution. Use something like btrbk for that.

This is also not a snapshot diff viewer. If that sounds like something you're interested in check out httm.

To put it plainly, btrview merely shows the state of things as they are, it doesn't actually "do" anything.

Q: How is the "btr" part of btrview pronounced?

The same as the "btr" part of btrfs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btrview-0.8.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

btrview-0.8.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file btrview-0.8.1.tar.gz.

File metadata

  • Download URL: btrview-0.8.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for btrview-0.8.1.tar.gz
Algorithm Hash digest
SHA256 24cc65a3b5f854b9941d97bfd08f3ffbd5b296dc67ecf782d6a4d3d1676c61e1
MD5 7380ae542c626408c59731606d9c10c7
BLAKE2b-256 3ae224d5f5cd69dc813739c098bd3c814de7d194e1608ea4d16a0683a2008d17

See more details on using hashes here.

File details

Details for the file btrview-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: btrview-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for btrview-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bd02bf2e1621de7d31d183ea3fbf0b5e332297ca6178b07889f86a5c5d82d8c
MD5 27e3d7acc179750b7579ee19ed419b39
BLAKE2b-256 e10f67f4c3c39cf06856849961718fdbca7a6b079f1faadfaac7e3e96b804b2b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page