Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pages/linux/btrfs-balance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

- Show the status of a running or paused balance operation:

`sudo btrfs balance status {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} status {{path/to/btrfs_filesystem}}`

- Balance all block groups (slow; rewrites all blocks in filesystem):

`sudo btrfs balance start {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} start {{path/to/btrfs_filesystem}}`

- Balance data block groups which are less than 15% utilized, running the operation in the background:

`sudo btrfs balance start {{[--bg|--background]}} -dusage={{15}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} start {{[--bg|--background]}} -dusage={{15}} {{path/to/btrfs_filesystem}}`

- Balance a max of 10 metadata chunks with less than 20% utilization and at least 1 chunk on a given device `devid` (see `btrfs filesystem show`):

`sudo btrfs balance start -musage={{20}},limit={{10}},devid={{devid}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} start -musage={{20}},limit={{10}},devid={{devid}} {{path/to/btrfs_filesystem}}`

- Convert data blocks to the raid6 and metadata to raid1c3 (see mkfs.btrfs(8) for profiles):

`sudo btrfs balance start -dconvert={{raid6}} -mconvert={{raid1c3}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} start -dconvert={{raid6}} -mconvert={{raid1c3}} {{path/to/btrfs_filesystem}}`

- Convert data blocks to raid1, skipping already converted chunks (e.g. after a previous cancelled conversion operation):

`sudo btrfs balance start -dconvert={{raid1}},soft {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} start -dconvert={{raid1}},soft {{path/to/btrfs_filesystem}}`

- Cancel, pause, or resume a running or paused balance operation:

`sudo btrfs balance {{cancel|pause|resume}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[b|balance]}} {{cancel|pause|resume}} {{path/to/btrfs_filesystem}}`
14 changes: 7 additions & 7 deletions pages/linux/btrfs-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

- Check a btrfs filesystem:

`sudo btrfs check {{path/to/partition}}`
`sudo btrfs {{[c|check]}} {{path/to/partition}}`

- Check and repair a btrfs filesystem (dangerous):

`sudo btrfs check --repair {{path/to/partition}}`
`sudo btrfs {{[c|check]}} --repair {{path/to/partition}}`

- Show the progress of the check:

`sudo btrfs check {{[-p|--progress]}} {{path/to/partition}}`
`sudo btrfs {{[c|check]}} {{[-p|--progress]}} {{path/to/partition}}`

- Verify the checksum of each data block (if the filesystem is good):

`sudo btrfs check --check-data-csum {{path/to/partition}}`
`sudo btrfs {{[c|check]}} --check-data-csum {{path/to/partition}}`

- Use the `n`-th superblock (`n` can be 0, 1 or 2):

`sudo btrfs check {{[-s|--super]}} {{n}} {{path/to/partition}}`
`sudo btrfs {{[c|check]}} {{[-s|--super]}} {{n}} {{path/to/partition}}`

- Rebuild the checksum tree:

`sudo btrfs check --repair --init-csum-tree {{path/to/partition}}`
`sudo btrfs {{[c|check]}} --repair --init-csum-tree {{path/to/partition}}`

- Rebuild the extent tree:

`sudo btrfs check --repair --init-extent-tree {{path/to/partition}}`
`sudo btrfs {{[c|check]}} --repair --init-extent-tree {{path/to/partition}}`
10 changes: 5 additions & 5 deletions pages/linux/btrfs-device.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

- Add one or more devices to a btrfs filesystem:

`sudo btrfs device add {{path/to/block_device1 path/to/block_device2 ...}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[d|device]}} {{[a|add]}} {{path/to/block_device1 path/to/block_device2 ...}} {{path/to/btrfs_filesystem}}`

- Remove a device from a btrfs filesystem:

`sudo btrfs device remove {{path/to/device1|device_id1 path/to/device2|device_id2 ...}}`
`sudo btrfs {{[d|device]}} {{[rem|remove]}} {{path/to/device1|device_id1 path/to/device2|device_id2 ...}}`

- Display error statistics:

`sudo btrfs device stats {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[d|device]}} {{[st|stats]}} {{path/to/btrfs_filesystem}}`

- Scan all disks and inform the kernel of all detected btrfs filesystems:

`sudo btrfs device scan {{[-d|--all-devices]}}`
`sudo btrfs {{[d|device]}} {{[sc|scan]}} {{[-d|--all-devices]}}`

- Display detailed per-disk allocation statistics:

`sudo btrfs device usage {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[d|device]}} {{[u|usage]}} {{path/to/btrfs_filesystem}}`
14 changes: 7 additions & 7 deletions pages/linux/btrfs-filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

- Show filesystem usage (optionally run as root to show detailed information):

`btrfs filesystem usage {{path/to/btrfs_mount}}`
`btrfs {{[f|filesystem]}} {{[u|usage]}} {{path/to/btrfs_mount}}`

- Show usage by individual devices:

`sudo btrfs filesystem show {{path/to/btrfs_mount}}`
`sudo btrfs {{[f|filesystem]}} {{[sh|show]}} {{path/to/btrfs_mount}}`

- Defragment a single file on a btrfs filesystem (avoid while a deduplication agent is running):

`sudo btrfs filesystem defragment {{[-v|--verbose]}} {{path/to/file}}`
`sudo btrfs {{[f|filesystem]}} {{[de|defragment]}} {{[-v|--verbose]}} {{path/to/file}}`

- Defragment a directory recursively (does not cross subvolume boundaries):

`sudo btrfs filesystem defragment {{[-v|--verbose]}} -r {{path/to/directory}}`
`sudo btrfs {{[f|filesystem]}} {{[de|defragment]}} {{[-v|--verbose]}} -r {{path/to/directory}}`

- Force syncing unwritten data blocks to disk(s):

`sudo btrfs filesystem sync {{path/to/btrfs_mount}}`
`sudo btrfs {{[f|filesystem]}} {{[sy|sync]}} {{path/to/btrfs_mount}}`

- Summarize disk usage for the files in a directory recursively:

`sudo btrfs filesystem du {{[-s|--summarize]}} {{path/to/directory}}`
`sudo btrfs {{[f|filesystem]}} du {{[-s|--summarize]}} {{path/to/directory}}`

- Create a swap file:

`sudo btrfs filesystem mkswapfile --size {{8g}} --uuid {{clear|random|time|UUID_value}} {{path/to/swapfile}}`
`sudo btrfs {{[f|filesystem]}} {{[m|mkswapfile]}} --size {{8g}} --uuid {{clear|random|time|UUID_value}} {{path/to/swapfile}}`
12 changes: 6 additions & 6 deletions pages/linux/btrfs-inspect-internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

- Print superblock's information:

`sudo btrfs inspect-internal dump-super {{path/to/partition}}`
`sudo btrfs {{[i|inspect-internal]}} {{[dump-s|dump-super]}} {{path/to/partition}}`

- Print superblock's and all of its copies' information:

`sudo btrfs inspect-internal dump-super {{[-a|--all]}} {{path/to/partition}}`
`sudo btrfs {{[i|inspect-internal]}} {{[dump-s|dump-super]}} {{[-a|--all]}} {{path/to/partition}}`

- Print filesystem's metadata information:

`sudo btrfs inspect-internal dump-tree {{path/to/partition}}`
`sudo btrfs {{[i|inspect-internal]}} {{[dump-t|dump-tree]}} {{path/to/partition}}`

- Print list of files in inode `n`-th:

`sudo btrfs inspect-internal inode-resolve {{n}} {{path/to/btrfs_mount}}`
`sudo btrfs {{[i|inspect-internal]}} {{[i|inode-resolve]}} {{n}} {{path/to/btrfs_mount}}`

- Print list of files at a given logical address:

`sudo btrfs inspect-internal logical-resolve {{logical_address}} {{path/to/btrfs_mount}}`
`sudo btrfs {{[i|inspect-internal]}} {{[lo|logical-resolve]}} {{logical_address}} {{path/to/btrfs_mount}}`

- Print stats of root, extent, csum and fs trees:

`sudo btrfs inspect-internal tree-stats {{path/to/partition}}`
`sudo btrfs {{[i|inspect-internal]}} {{[t|tree-stats]}} {{path/to/partition}}`
10 changes: 5 additions & 5 deletions pages/linux/btrfs-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

- List available properties (and descriptions) for the given btrfs object:

`sudo btrfs property list {{path/to/btrfs_object}}`
`sudo btrfs {{[p|property]}} {{[l|list]}} {{path/to/btrfs_object}}`

- Get all properties for the given btrfs object:

`sudo btrfs property get {{path/to/btrfs_object}}`
`sudo btrfs {{[p|property]}} {{[g|get]}} {{path/to/btrfs_object}}`

- Get the `label` property for the given btrfs filesystem or device:

`sudo btrfs property get {{path/to/btrfs_filesystem}} label`
`sudo btrfs {{[p|property]}} {{[g|get]}} {{path/to/btrfs_filesystem}} label`

- Get all object type-specific properties for the given btrfs filesystem or device:

`sudo btrfs property get -t {{subvol|filesystem|inode|device}} {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[p|property]}} {{[g|get]}} -t {{subvol|filesystem|inode|device}} {{path/to/btrfs_filesystem}}`

- Set the `compression` property for a given btrfs inode (either a file or directory):

`sudo btrfs property set {{path/to/btrfs_inode}} compression {{zstd|zlib|lzo|none}}`
`sudo btrfs {{[p|property]}} {{[s|set]}} {{path/to/btrfs_inode}} compression {{zstd|zlib|lzo|none}}`
10 changes: 5 additions & 5 deletions pages/linux/btrfs-rescue.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

- Rebuild the filesystem metadata tree (very slow):

`sudo btrfs rescue chunk-recover {{path/to/partition}}`
`sudo btrfs {{[resc|rescue]}} {{[ch|chunk-recover]}} {{path/to/partition}}`

- Fix device size alignment related problems (e.g. unable to mount the filesystem with super total bytes mismatch):

`sudo btrfs rescue fix-device-size {{path/to/partition}}`
`sudo btrfs {{[resc|rescue]}} {{[fix-de|fix-device-size]}} {{path/to/partition}}`

- Recover a corrupted superblock from correct copies (recover the root of filesystem tree):

`sudo btrfs rescue super-recover {{path/to/partition}}`
`sudo btrfs {{[resc|rescue]}} {{[s|super-recover]}} {{path/to/partition}}`

- Recover from an interrupted transactions (fixes log replay problems):

`sudo btrfs rescue zero-log {{path/to/partition}}`
`sudo btrfs {{[resc|rescue]}} {{[z|zero-log]}} {{path/to/partition}}`

- Create a `/dev/btrfs-control` control device when `mknod` is not installed:

`sudo btrfs rescue create-control-device`
`sudo btrfs {{[resc|rescue]}} {{[c|create-control-device]}}`
10 changes: 5 additions & 5 deletions pages/linux/btrfs-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

- Restore all files from a btrfs filesystem to a given directory:

`sudo btrfs restore {{path/to/btrfs_device}} {{path/to/target_directory}}`
`sudo btrfs {{[rest|restore]}} {{path/to/btrfs_device}} {{path/to/target_directory}}`

- List (don't write) files to be restored from a btrfs filesystem:

`sudo btrfs restore {{[-D|--dry-run]}} {{path/to/btrfs_device}} {{path/to/target_directory}}`
`sudo btrfs {{[rest|restore]}} {{[-D|--dry-run]}} {{path/to/btrfs_device}} {{path/to/target_directory}}`

- Restore files matching a given regex ([c]ase-insensitive) files to be restored from a btrfs filesystem (all parent directories of target file(s) must match as well):

`sudo btrfs restore --path-regex {{regex}} -c {{path/to/btrfs_device}} {{path/to/target_directory}}`
`sudo btrfs {{[rest|restore]}} --path-regex {{regex}} -c {{path/to/btrfs_device}} {{path/to/target_directory}}`

- Restore files from a btrfs filesystem using a specific root [t]ree `bytenr` (see `btrfs-find-root`):

`sudo btrfs restore -t {{bytenr}} {{path/to/btrfs_device}} {{path/to/target_directory}}`
`sudo btrfs {{[rest|restore]}} -t {{bytenr}} {{path/to/btrfs_device}} {{path/to/target_directory}}`

- Restore files from a btrfs filesystem (along with metadata, extended attributes, and Symlinks), overwriting files in the target:

`sudo btrfs restore {{[-m|--metadata]}} {{[-x|--xattr]}} {{[-S|--symlinks]}} {{[-o|--overwrite]}} {{path/to/btrfs_device}} {{path/to/target_directory}}`
`sudo btrfs {{[rest|restore]}} {{[-m|--metadata]}} {{[-x|--xattr]}} {{[-S|--symlinks]}} {{[-o|--overwrite]}} {{path/to/btrfs_device}} {{path/to/target_directory}}`
12 changes: 6 additions & 6 deletions pages/linux/btrfs-scrub.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

- Start a scrub:

`sudo btrfs scrub start {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} start {{path/to/btrfs_mount}}`

- Show the status of an ongoing or last completed scrub:

`sudo btrfs scrub status {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} status {{path/to/btrfs_mount}}`

- Cancel an ongoing scrub:

`sudo btrfs scrub cancel {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} {{[c|cancel]}} {{path/to/btrfs_mount}}`

- Resume a previously cancelled scrub:

`sudo btrfs scrub resume {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} {{[r|resume]}} {{path/to/btrfs_mount}}`

- Start a scrub, but do not put the program in the [B]ackground:

`sudo btrfs scrub start -B {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} start -B {{path/to/btrfs_mount}}`

- Start a scrub in quiet mode (does not print errors or statistics):

`sudo btrfs scrub start {{[-q|--quiet]}} {{path/to/btrfs_mount}}`
`sudo btrfs {{[sc|scrub]}} start {{[-q|--quiet]}} {{path/to/btrfs_mount}}`
12 changes: 6 additions & 6 deletions pages/linux/btrfs-subvolume.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

- Create a new empty subvolume:

`sudo btrfs subvolume create {{path/to/new_subvolume}}`
`sudo btrfs {{[su|subvolume]}} {{[c|create]}} {{path/to/new_subvolume}}`

- List all subvolumes and snapshots in the specified filesystem:

`sudo btrfs subvolume list {{path/to/btrfs_filesystem}}`
`sudo btrfs {{[su|subvolume]}} {{[l|list]}} {{path/to/btrfs_filesystem}}`

- Delete a subvolume:

`sudo btrfs subvolume delete {{path/to/subvolume}}`
`sudo btrfs {{[su|subvolume]}} {{[d|delete]}} {{path/to/subvolume}}`

- Create a [r]ead-only snapshot of an existing subvolume:

`sudo btrfs subvolume snapshot -r {{path/to/source_subvolume}} {{path/to/target}}`
`sudo btrfs {{[su|subvolume]}} {{[sn|snapshot]}} -r {{path/to/source_subvolume}} {{path/to/target}}`

- Create a read-write snapshot of an existing subvolume:

`sudo btrfs subvolume snapshot {{path/to/source_subvolume}} {{path/to/target}}`
`sudo btrfs {{[su|subvolume]}} {{[sn|snapshot]}} {{path/to/source_subvolume}} {{path/to/target}}`

- Show detailed information about a subvolume:

`sudo btrfs subvolume show {{path/to/subvolume}}`
`sudo btrfs {{[su|subvolume]}} {{[sh|show]}} {{path/to/subvolume}}`
4 changes: 2 additions & 2 deletions pages/linux/btrfs-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

- Display help:

`btrfs version --help`
`btrfs {{[v|version]}} --help`

- Display version:

`btrfs version`
`btrfs {{[v|version]}}`
10 changes: 5 additions & 5 deletions pages/linux/btrfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

- Create subvolume:

`sudo btrfs subvolume create {{path/to/subvolume}}`
`sudo btrfs {{[su|subvolume]}} {{[c|create]}} {{path/to/subvolume}}`

- List subvolumes:

`sudo btrfs subvolume list {{path/to/mount_point}}`
`sudo btrfs {{[su|subvolume]}} {{[l|list]}} {{path/to/mount_point}}`

- Show space usage information:

`sudo btrfs filesystem df {{path/to/mount_point}}`
`sudo btrfs {{[f|filesystem]}} df {{path/to/mount_point}}`

- Enable quota:

`sudo btrfs quota enable {{path/to/subvolume}}`
`sudo btrfs {{[qu|quota]}} {{[e|enable]}} {{path/to/subvolume}}`

- Show quota:

`sudo btrfs qgroup show {{path/to/subvolume}}`
`sudo btrfs {{[qg|qgroup]}} {{[s|show]}} {{path/to/subvolume}}`