btrfs on an external SDD

3 Apr 2022

First, let's install the btrfs programs that I will need:

$ su -
# apt install btrfs-progs

Let's plug in one of my external USB SSDs, then find it (using lsblk), then unmount it:

# lsblk
# umount /dev/sdb1

OK, I've done a bit of reading, and I think I want to use DUP for both metadata and regular data --- basically everything is written to disk twice. (I later read the btrfs man page more closely and it says SSD hardware may dedup efforts at duplication, so do not bother.)

I also want to use blake2b as my checksum to be sure things I read from the filesystem are OK.

Is BLAKE2b available?

# cat /sys/fs/btrfs/features/supported_checksums
crc32c xxhash64 sha256 blake2b

Looks like it is!

I would also like to use dup, like so, but the manpage for mkfs.btrfs says that on SSDs (unlike HDDs) dup will probably get du-dupped by the hardware.

NO NO NO NO NO NO NO NO
# mkfs.btrfs \
    --checksum blake2 \
    --data dup \
    --metadata dup \
    --force \
    --label btrfs_bk_1 \
    /dev/sdb
NO NO NO NO NO NO NO NO

But, at least we can get blake2 as a checksum, which is better than crc32!

# mkfs.btrfs \
    --checksum blake2 \
    --force \
    --label btrfs_bk_1 \
    /dev/sdb

Then I unplug my external hd and plug it back and and it automounts to /media/mwood/btrfs_bk_1. Nice!

May as well make a dir on the SSD that is owned by my regular user so that I don't have to use it as root:

# mkdir /media/mwood/btrfs_bk_1/mwood
# chown mwood:mwood /media/mwood/btrfs_bk_1/mwood