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