1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-29 03:15:36 +02:00
tldr/pages/linux/btrfs-filesystem.md

33 lines
1.1 KiB
Markdown
Raw Normal View History

2021-01-07 11:04:21 +00:00
# btrfs filesystem
> Manage btrfs filesystems.
> More information: <https://btrfs.readthedocs.io/en/latest/btrfs-filesystem.html>.
2021-01-07 11:04:21 +00:00
- Show filesystem usage (optionally run as root to show detailed information):
2025-07-20 01:28:02 +03:00
`btrfs {{[f|filesystem]}} {{[u|usage]}} {{path/to/btrfs_mount}}`
2021-01-07 11:04:21 +00:00
- Show usage by individual devices:
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} {{[sh|show]}} {{path/to/btrfs_mount}}`
2021-01-07 11:04:21 +00:00
- Defragment a single file on a btrfs filesystem (avoid while a deduplication agent is running):
2021-01-07 11:04:21 +00:00
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} {{[de|defragment]}} {{[-v|--verbose]}} {{path/to/file}}`
2021-01-07 11:04:21 +00:00
- Defragment a directory recursively (does not cross subvolume boundaries):
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} {{[de|defragment]}} {{[-v|--verbose]}} -r {{path/to/directory}}`
2021-01-07 11:04:21 +00:00
- Force syncing unwritten data blocks to disk(s):
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} {{[sy|sync]}} {{path/to/btrfs_mount}}`
2021-01-07 11:04:21 +00:00
- Summarize disk usage for the files in a directory recursively:
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} du {{[-s|--summarize]}} {{path/to/directory}}`
- Create a swap file:
2025-07-20 01:28:02 +03:00
`sudo btrfs {{[f|filesystem]}} {{[m|mkswapfile]}} --size {{8g}} --uuid {{clear|random|time|UUID_value}} {{path/to/swapfile}}`