1
0
jcktrue.dk/content/post/btrfs-commands/index.md
Jens True a0148e63c0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Added command help for btrfs
2020-09-03 19:43:54 +02:00

37 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

+++
title = "brtfs - Helpful commands"
date = 2020-09-03T00:00:00
+++
Quick collection of useful commands for maintaining a btrfs filesystem
{{% alert note %}}
Btrfs (pronounced as "butter fuss", "better F S", "butter F S", "b-tree F S", or simply by spelling it out) is a file system based on the copy-on-write (COW) principle, initially designed at Oracle Corporation for use in Linux. The development of Btrfs began in 2007, and since August 2014 the file system's on-disk format has been marked as stable.[13]
{{% /alert %}}
## btrfs scrub
btrfs scrub is used to scrub a btrfs filesystem, which will read all data and metadata blocks from all devices and verify checksums. Automatically repair corrupted blocks if theres a correct copy available.
```shell
sudo btrfs scrub start /path/to/fs/
```
To see the status of an ongoing (or last run) balance use
```shell
sudo btrfs scrub status /path/to/fs/
```
## btrfs balance
The primary purpose of the balance feature is to spread block groups across all devices so they match constraints defined by the respective profiles. See mkfs.btrfs(8) section PROFILES for more details. The scope of the balancing process can be further tuned by use of filters that can select the block groups to process. Balance works only on a mounted filesystem.
```shell
sudo btrfs balance start /path/to/fs/
```
To see the status of an ongoing (or last run) balance use
```shell
sudo btrfs balance status /path/to/fs/
```