Mitch Harder wrote:
> To defragment your entire volume, you'll need a command like:
> 
> # for file in $(find <PATH/TO/BTRFS/VOL/> -type f); do btrfs
> filesystem defragment ${file}; done

Suggest:

find /path/to/btrfs/vol -type f -exec btrfs filesystem defragment '{}' ';'


> If you just want to see your fragmentation you can use the 'filefrag'
> program from e2fsprogs:
> 
> # for file in $(find <PATH/TO/BTRFS/VOL/> -type f); do filefrag
> ${file}; done | sort -n -k 2 | less

find /path/to/btrfs/vol -type f -exec filefrag '{}' ';'


If either command can take multiple filenames as parameters, then e.g.:

find /path/to/btrfs/vol -type f -execdir filefrag '+'

(significantly better because not a fork per file)


//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to