首先,如果之前有人问过这个问题,我深表歉意,但我找不到任何包含任何关键字组合的链接。
我的问题是 - 在两个设备都是 SSD 的 RAID1 中,SSD 优化如何在 BTRFS 中工作?
此外,fstrim 似乎没有选择 /dev/sdb1。请参阅本文末尾的输出。
我在 RAID1 配置中有 /dev/sda1 和 /dev/sdb1 (SSD 上的两个分区)。但我在以下 dmesg 输出中没有看到 sdb1 的消息。
pi@testpi:~ $ dmesg | grep btrfs
[Thu Apr 20 00:35:06 2023] Btrfs loaded, crc32c=crc32c-generic, zoned=no, fsverity=no
[Thu Apr 20 00:35:06 2023] BTRFS: device label nasdisk_01 devid 1 transid 200 /dev/sdd1 scanned by systemd-udevd (209)
[Thu Apr 20 00:35:06 2023] BTRFS: device fsid 69f422a2-fea7-424c-886b-f291068dae9f devid 4 transid 73286 /dev/sdb1 scanned by systemd-udevd (205)
[Thu Apr 20 00:35:06 2023] BTRFS: device fsid 69f422a2-fea7-424c-886b-f291068dae9f devid 3 transid 73286 /dev/sda1 scanned by systemd-udevd (204)
[Thu Apr 20 00:35:06 2023] BTRFS info (device sdd1): using crc32c (crc32c-generic) checksum algorithm
[Thu Apr 20 00:35:06 2023] BTRFS info (device sdd1): setting nodatacow, compression disabled
[Thu Apr 20 00:35:06 2023] BTRFS info (device sdd1): disk space caching is enabled
[Thu Apr 20 00:35:06 2023] BTRFS info (device sda1): using crc32c (crc32c-generic) checksum algorithm
[Thu Apr 20 00:35:06 2023] BTRFS info (device sda1): disk space caching is enabled
[Thu Apr 20 00:35:07 2023] BTRFS info (device sdd1): enabling ssd optimizations
[Thu Apr 20 00:35:07 2023] BTRFS info (device sda1): enabling ssd optimizations
我的 fstab(部分 - 非 btrfs 条目已在此处删除)是
PARTUUID=9c860f91-01 /mnt/raid1_01 btrfs defaults,noatime,nodiratime 0 2
PARTUUID=9c860f91-01 /mnt/media btrfs defaults,noatime,nodiratime,subvol=@media 0 2
PARTUUID=9c860f91-01 /mnt/docker-containers btrfs defaults,noatime,nodiratime,subvol=@docker-containers 0 2
PARTUUID=9c860f91-01 /mnt/shared-samba btrfs defaults,noatime,nodiratime,subvol=@shared-samba 0 2
PARTUUID=9c860f91-01 /mnt/shared-onedrive btrfs defaults,noatime,nodiratime,subvol=@shared-onedrive 0 2
PARTUUID=9c860f91-01 /mnt/docker-containers-databases btrfs defaults,noatime,nodiratime,subvol=@docker-containers-databases 0 2
PARTUUID=9c860f91-01 /mnt/work btrfs defaults,noatime,nodiratime,subvol=@work 0 2
mount命令的输出如下
pi@testpi:~ $ mount | grep btrfs
/dev/sdd1 on /mnt/nasdisk_01 type btrfs (rw,noatime,nodiratime,nodatasum,nodatacow,ssd,space_cache,subvolid=5,subvol=/)
/dev/sda1 on /mnt/docker-containers-databases type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=394,subvol=/@docker-containers-databases)
/dev/sda1 on /mnt/shared-samba type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=363,subvol=/@shared-samba)
/dev/sda1 on /mnt/shared-onedrive type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=391,subvol=/@shared-onedrive)
/dev/sda1 on /mnt/work type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=397,subvol=/@work)
/dev/sda1 on /mnt/docker-containers type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=362,subvol=/@docker-containers)
/dev/sda1 on /mnt/media type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=398,subvol=/@media)
/dev/sda1 on /mnt/raid1_01 type btrfs (rw,noatime,nodiratime,ssd,space_cache,subvolid=5,subvol=/)
fstrim 的输出显示 /dev/sdb1 被忽略。
pi@testpi:~ $ sudo fstrim -vA
/mnt/nasdisk_01: 2.2 GiB (2363473920 bytes) trimmed on /dev/sdd1
/mnt/raid1_01: 5 GiB (5337776128 bytes) trimmed on /dev/sda1
/: 2.9 GiB (3139751936 bytes) trimmed on /dev/sdc2
/boot: 201.8 MiB (211645952 bytes) trimmed on /dev/sdc1