All Projects → CyberShadow → Btdu

CyberShadow / Btdu

Licence: gpl-2.0
sampling disk usage profiler for btrfs

Programming Languages

d
599 projects

Labels

Projects that are alternatives of or similar to Btdu

btrfs-backup
A simple, flexible script for versioned backups using btrfs and rsync
Stars: ✭ 59 (+18%)
Mutual labels:  btrfs
dduper
Fast block-level out-of-band BTRFS deduplication tool.
Stars: ✭ 108 (+116%)
Mutual labels:  btrfs
Systemd Swap
Script for creating hybrid swap space from zram swaps, swap files and swap partitions.
Stars: ✭ 473 (+846%)
Mutual labels:  btrfs
buttervolume
BTRFS Volume plugin for Docker
Stars: ✭ 53 (+6%)
Mutual labels:  btrfs
btrfs-sync
Smart and easy sync of BTRFS snapshots, locally or through SSH
Stars: ✭ 64 (+28%)
Mutual labels:  btrfs
Btrfs Progs
Development of userspace BTRFS tools
Stars: ✭ 260 (+420%)
Mutual labels:  btrfs
BaNG
Backup Next Generation for Linux & Mac using rsync (support hardlinks and btrfs snapshots), Web-Frontend, Statistics, History-Merger)
Stars: ✭ 28 (-44%)
Mutual labels:  btrfs
Jdupes
A powerful duplicate file finder and an enhanced fork of 'fdupes'.
Stars: ✭ 790 (+1480%)
Mutual labels:  btrfs
rusnapshot
Simple and handy btrfs snapshoting tool. Supports unattended snapshots, tracking, restoring, automatic cleanup and more. Backed with SQLite.
Stars: ✭ 27 (-46%)
Mutual labels:  btrfs
Embiggen Disk
embiggden-disk live-resizes a filesystem after first live-resizing any necessary layers below it: an optional LVM LV and PV, and an MBR or GPT partition table
Stars: ✭ 440 (+780%)
Mutual labels:  btrfs
btrfs-borg
btrfs-borg makes snapshots and backs up a btrfs snapshotted subvolumes and LXC containers using Borg
Stars: ✭ 22 (-56%)
Mutual labels:  btrfs
awesome-immutable
A list of resources for people who want to investigate image-based Linux desktops
Stars: ✭ 184 (+268%)
Mutual labels:  btrfs
Btrfsmaintenance
Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
Stars: ✭ 362 (+624%)
Mutual labels:  btrfs
snapbtrex
snapbtrex is a small utility that keeps snapshots of btrfs filesystems and optionally send them to a remote system or syncs them locally.
Stars: ✭ 29 (-42%)
Mutual labels:  btrfs
Mkosi
Build Legacy-Free OS Images
Stars: ✭ 589 (+1078%)
Mutual labels:  btrfs
btrfscue
Recover files from damaged BTRFS filesystems
Stars: ✭ 28 (-44%)
Mutual labels:  btrfs
btrfs
Btrfs library in a pure Go
Stars: ✭ 24 (-52%)
Mutual labels:  btrfs
Btrfs Swapon
Btrfs doesn't allow to swap on a file. This script allows you do swap on a file anyway.
Stars: ✭ 42 (-16%)
Mutual labels:  btrfs
Btrbk
Tool for creating snapshots and remote backups of btrfs subvolumes
Stars: ✭ 605 (+1110%)
Mutual labels:  btrfs
Dotfiles
Configuration for Arch Linux, sway, kitty, kakoune, zsh and more + scripted installation guide
Stars: ✭ 385 (+670%)
Mutual labels:  btrfs

btdu - sampling disk usage profiler for btrfs

Some btrfs features may make it difficult to estimate what disk space is being used for:

  • Subvolumes allow cheap copy-on-write snapshots of entire filesystem trees, with data that hasn't been modified being shared among snapshots
  • File and extent cloning allow creating cheap copies of files or parts thereof, with extents being stored only once
  • Compression transparently allows further reducing disk usage

For these reasons, classic disk usage analyzers such as ncdu cannot provide an accurate depiction of actual disk usage. (btrfs compression in particular is challenging to classic analyzers, and special tools must be used to query compressed usage.)

btdu is a sampling disk usage profiler for btrfs. It works according to the following algorithm:

  1. Pick a random point on the disk in use
  2. Find what is located at that point
  3. Add the path to the results
  4. Repeat the above steps indefinitely

Though it works by taking random samples, it is "eventually" accurate.

It differs from classic analyzers through the following properties:

  • btdu starts showing results instantly. Though wildly inaccurate at first, they become progressively more accurate the longer btdu is allowed to run.
  • btdu analyzes entire filesystems only. There is no way to analyze only a particular subdirectory or subvolume.
  • btdu counts extents used by multiple files only once. (The shortest path is used when placing the sample in the tree for visualization.)
  • By nature of its algorithm, btdu works correctly with compression and other btrfs filesystem features.
  • Because it queries raw filesystem metadata, btdu requires root privileges to run.

Use cases

  • Quickly summarize space usage

    btdu needs to collect only 100 samples to achieve a ~1% resolution, which means it can identify space hogs very quickly. This is useful if the disk is full and some space must be freed ASAP to get things back up and running.

  • Estimate snapshot size

    When an extent is in use by multiple files or snapshots, to decide where to place it in the browsable tree, btdu picks the path with the shortest length, or the lexicographically smaller path if the length is the same. An emergent effect of this property is that it can be used to estimate snapshot size, if your snapshots use a fixed-length lexicographically-ordered naming scheme (such as e.g. YYYY-MM-DD-HH-MM-SS): the size of snapshots displayed in btdu will thus indicate data that occurs in that snapshot or any later one, i.e. the amount of "new" data in that snapshot.

  • Estimate compressed data size

    If you use btrfs data compression (whether to save space / improve performance / conserve flash writes), btdu can be used to estimate how much real disk space compressed data uses.

  • Estimate unreachable extent size

    A feature unique to btdu is the ability to estimate the amount of space used by unreachable parts of extents, i.e. data in extents containing older versions of file content which has since been overwritten. This btrfs "dark matter" can be an easy to overlook space hog, which could be eliminated by rewriting or defragmentating affected files.

Installation

btdu can be installed in one of the following ways:

Building

  • Install a D compiler
  • Install Dub, if it wasn't included with your D compiler
  • Run dub build -b release

Usage

# btdu /path/to/filesystem/root

Note that the indicated path must be to the root subvolume (otherwise btdu will be unable to open other subvolumes for inode resolution). If in doubt, mount the filesystem to a new mountpoint with -o subvol=/,subvolid=5.

Run btdu --help for more usage information.

License

btdu is available under the GNU GPL v2. (The license is inherited from btrfs-progs.)

See Also

  • btsdu, the Btrfs Snapshot Disk Usage Analyzer
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].