You are not logged in.

#1 2024-04-01 14:41:08

vecino
Member
Registered: 2022-12-10
Posts: 124

[SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

Hi, I've been interested in BTRFS for quite a long time and love using it. I admit that I don't follow the latest trends much, but I want to ask if the same recommendations apply in 2024 or if something has changed?

I repeatedly follow Arch WiKi - Btrfs and found an interesting test recently where someone tested different situations and drives. I'm exclusively using NVMe drives at the moment so I'm wondering if I should change something like compression or maybe other parameters for the mount.

If I understand the results of this test correctly: https://gist.github.com/braindevices/fd … 77562aafec , I should exclusively use lzo with NVMe? Yes?

zstd:1 still has huge penalty on I/O speed on modern PC system. The compression is way slower than decompression.
The tests on relatively slow SATA SSD show no obvious performance drop because the bottle neck is still disk I/O.
On NVME SSD the penalty become far serious. Thus we should only use lzo to reduce the size on NVME-SSD.

Could you please give me some recommendations? What could I do better? My current setup:

# mount -t btrfs
/dev/sda2 on / type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,commit=120,subvol=/@)
/dev/sda2 on /.snapshots type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,commit=120,subvol=/@snapshots)
# cat /etc/mkinitcpio.conf
MODULES=(btrfs)
BINARIES=(/usr/bin/btrfs)
FILES=()
HOOKS=(systemd autodetect keyboard modconf block filesystems grub-btrfs-overlayfs)

I am mainly interested in your real observations and experiences from real use.

Thanks

Last edited by vecino (2024-04-05 20:09:32)

Offline

#2 2024-04-02 08:15:26

impossibleveins23
Member
Registered: 2022-06-18
Posts: 83

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

I'm using BTRFS with zstd on M2 NVME as my daily drivers for years on "not so recent" laptops.
Not really a test, but I didn't notice any access excess resource utilization due to filesystem.
If write performance are critical for you then go for lzo or fully disable compression.

If you plan to use snapshots, I can recommend you to create additional subvolumes (/home, /var/log, /../pkg, /.../docker...).

BTW You can replace or disable the compression (will be applied to future file writes).

Offline

#3 2024-04-03 15:57:45

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

@impossibleveins23: Thanks for the response.

I know that the standard recommendation for subvolumes is this:

/				/@
/.snapshots			/@.snapshots
/home				/@home
/var/cache/pacman/pkg		/@pkg
/var/log			/@log

Do you think it's a good idea to make a subvolume for the whole /var or is it not a good idea?

I also read somewhere that it is recommended to set compress-force for small files. For example: compress-force=zstd:3 - is this a good idea?

Last edited by vecino (2024-04-03 15:59:36)

Offline

#4 2024-04-03 20:31:46

impossibleveins23
Member
Registered: 2022-06-18
Posts: 83

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

* In my case I wanted to subvolume within /var for use cases like Docker. If don't need this granularity, start with @var and you can always mount the root volume, create a snapshot and mount in within /var afterwards.
* Regarding compression, can't say much I also use zstd with default 3. I guess if you have weak hardware or specific IO requirements, you can investigate more. Perhaps start here.

Offline

#5 2024-04-04 06:07:41

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

Yes I read btrfs.readthedocs.io/en/latest - I'm trying to find the information myself, but I didn't find the answers to my questions there. I guess I understand that it depends on a lot of circumstances and usage.

Offline

#6 2024-04-04 07:57:15

impossibleveins23
Member
Registered: 2022-06-18
Posts: 83

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

It depends on your use case.
If you have many duplicate files (e.g. File Server), maybe using dedup is the way.

Bear in mind that you can always switch compression (will affect future files).

Offline

#7 2024-04-04 13:30:31

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

Thank you

Offline

#8 2024-04-05 12:21:18

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

The system automatically creates the following subvolumes for me within Btrfs:

ID 258 gen 383799 top level 256 path var/lib/portables
ID 259 gen 383799 top level 256 path var/lib/machines

I've learned that this is normal and systemd creates them. Can I remove them by default? Or set them not to be created at all (within a subvolume)?

Offline

#9 2024-04-05 15:21:10

impossibleveins23
Member
Registered: 2022-06-18
Posts: 83

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

No idea. I don't have them. And didn't know systemd create subvolumes.
Probably no need unless you want a separate subvolume for VMs.

Offline

#10 2024-04-05 18:26:06

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

I found an explanation here. The subvolumes can simply be deleted.

https://bbs.archlinux.org/viewtopic.php?id=274289
https://bbs.archlinux.org/viewtopic.php?id=260291

Offline

#11 2024-04-05 18:32:39

impossibleveins23
Member
Registered: 2022-06-18
Posts: 83

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

I guess I don't have these subvolumes because I have the dirs according to this.

Offline

#12 2024-04-05 20:02:32

vecino
Member
Registered: 2022-12-10
Posts: 124

Re: [SOLVED] Btrfs best practice - M.2 NVMe SSD (2024)

Yes! That's exactly what I'm looking for. Just manually create the folders when installing and then systemd will not create a subfolder for var/lib/portables and var/lib/machines.

Maybe it will help someone too.

mkdir -p /mnt/{efi,var/log,var/cache/pacman/pkg,root,.snapshots,var/lib/portables,var/lib/machines}

@impossibleveins23 Thanks! smile

Last edited by vecino (2024-04-05 20:03:58)

Offline

Board footer

Powered by FluxBB