For me, defragment wouldn't run on the <ROOT_FS>, i.e., "/mnt".
Defragment should never be run against snapshots. Like scrub, defrag does NOT repair any problems, it improves performance by reducing extents. The Btrfs check command can fix errors, but it is run on the unmounted system from a LiveUSB stick.
sudo -i
btrfs filesystem defragment -v -r -f /
-v = verbose, list files as they are checked
-r = recursive. check files in each directory recursively, one after the other.
-f = flush after each file check, "This will limit the amount of dirty data to current file, otherwise the amount accumulates from several files and will increase system load. This can also lead to ENOSPC if there’s too much dirty data to write and it’s not possible to make the reservations for the new data (ie. how the COW design works)."
"The data affected by the defragmentation process will be newly written and will consume new space, the links to the original extents will not be kept. "
On / defragment reported 82 errors, i.e., extents it could not clean up for some reason. Run the command again and the number may change.
On /home defragment reported 0 errors.
Checking my device stats I find that:
So my Btrfs system is not giving me any problems.
Defragment should never be run against snapshots. Like scrub, defrag does NOT repair any problems, it improves performance by reducing extents. The Btrfs check command can fix errors, but it is run on the unmounted system from a LiveUSB stick.
sudo -i
btrfs filesystem defragment -v -r -f /
-v = verbose, list files as they are checked
-r = recursive. check files in each directory recursively, one after the other.
-f = flush after each file check, "This will limit the amount of dirty data to current file, otherwise the amount accumulates from several files and will increase system load. This can also lead to ENOSPC if there’s too much dirty data to write and it’s not possible to make the reservations for the new data (ie. how the COW design works)."
"The data affected by the defragmentation process will be newly written and will consume new space, the links to the original extents will not be kept. "
On / defragment reported 82 errors, i.e., extents it could not clean up for some reason. Run the command again and the number may change.
On /home defragment reported 0 errors.
Checking my device stats I find that:
Code:
:~$ [B][FONT=courier new]sudo btrfs dev stats /[/FONT] [/B] [/dev/sda1].write_io_errs 0 [/dev/sda1].read_io_errs 0 [/dev/sda1].flush_io_errs 0 [/dev/sda1].corruption_errs 0 [/dev/sda1].generation_errs 0
Comment