This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:btrfs [2024/11/12 22:39] manu [BTRFS corruption] |
linux:btrfs [2024/11/12 22:52] (current) manu |
||
---|---|---|---|
Line 177: | Line 177: | ||
On peut monter avec l’option compress=zlib ou compress=lzo pour activer une compression à la volée des fichiers. Si le volume avant n’avait pas l’option compress on pourra tout recompresser avec btrfs filesystem defragment -czlib ou -clzo. | On peut monter avec l’option compress=zlib ou compress=lzo pour activer une compression à la volée des fichiers. Si le volume avant n’avait pas l’option compress on pourra tout recompresser avec btrfs filesystem defragment -czlib ou -clzo. | ||
Maintenance | Maintenance | ||
- | |||
- | ===== BTRFS corruption ===== | ||
- | |||
- | Check data integrity on block and metadata level with repair if needed: | ||
- | <cli prompt='#'> | ||
- | # btrfs scrub start /backup/ | ||
- | # btrfs scrub status /backup/ | ||
- | </cli> | ||
- | |||
- | **btrfs check** seems to verify and optionally attempt repair of the structure of the filesystem. **btrfs scrub** verifies (and possibly repairs) the checksums of every data and metadata block | ||
- | |||
- | Advanced check on a partition: | ||
- | <cli prompt='#'> | ||
- | # btrfs check -p /dev/sda9 | ||
- | </cli> | ||
- | |||
- | Check if the filesystem is in error, and indicate a progress bar: | ||
- | <cli prompt='#'> | ||
- | # btrfs dev stats /backup | ||
- | </cli> | ||
- | |||
==== Quota for Subvolumes ==== | ==== Quota for Subvolumes ==== | ||
Line 260: | Line 239: | ||
# btrfs device replace | # btrfs device replace | ||
</cli> | </cli> | ||
- | |||
- | |||
- | |||
Create a subvolume with compression | Create a subvolume with compression | ||
Line 320: | Line 296: | ||
manu-opensuse:~ # snapper set-config SPACE_LIMIT=0.2 NUMBER_LIMIT=2-6 NUMBER_LIMIT_IMPORTANT=4 | manu-opensuse:~ # snapper set-config SPACE_LIMIT=0.2 NUMBER_LIMIT=2-6 NUMBER_LIMIT_IMPORTANT=4 | ||
</cli> | </cli> | ||
+ | |||
+ | ===== BTRFS corruption ===== | ||
+ | |||
+ | Check data integrity on block and metadata level with repair if needed (using -B in background if needed) | ||
+ | <cli prompt='#'> | ||
+ | # btrfs scrub start /backup | ||
+ | </cli> | ||
+ | |||
+ | <cli prompt='#'> | ||
+ | # btrfs scrub status /backup | ||
+ | UUID: 76fac721-2294-4f89-a1af-620cde7a1980 | ||
+ | Scrub started: Wed Apr 10 12:34:56 2023 | ||
+ | Status: running | ||
+ | Duration: 0:00:05 | ||
+ | Time left: 0:00:05 | ||
+ | ETA: Wed Apr 10 12:35:01 2023 | ||
+ | Total to scrub: 28.32GiB | ||
+ | Bytes scrubbed: 13.76GiB (48.59%) | ||
+ | Rate: 2.75GiB/s | ||
+ | Error summary: no errors found | ||
+ | </cli> | ||
+ | |||
+ | With some errors found: | ||
+ | <code> | ||
+ | Error summary: csum=72 | ||
+ | Corrected: 2 | ||
+ | Uncorrectable: 72 | ||
+ | Unverified: 0 | ||
+ | </code> | ||
+ | |||
+ | **btrfs check** seems to verify and optionally attempt repair of the structure of the filesystem. **btrfs scrub** verifies (and possibly repairs) the checksums of every data and metadata block | ||
+ | |||
+ | Advanced check on a partition: | ||
+ | <cli prompt='#'> | ||
+ | # btrfs check -p /dev/sda9 | ||
+ | </cli> | ||
+ | |||
+ | Check if the filesystem is in error, and indicate a progress bar: | ||
+ | <cli prompt='#'> | ||
+ | # btrfs device stats /dev/sda3 | ||
+ | [/dev/sda3].write_io_errs 0 | ||
+ | [/dev/sda3].read_io_errs 0 | ||
+ | [/dev/sda3].flush_io_errs 0 | ||
+ | [/dev/sda3].corruption_errs 0 | ||
+ | [/dev/sda3].generation_errs 0 | ||
+ | </cli> | ||
+ | |||
+ | ===== script btrfs_size.sh ===== | ||
<cli prompt='#'> | <cli prompt='#'> |