/dev/sda1 on /mnt/usb1 type btrfs (rw,relatime,seclabel,space_cache=v2,subvolid=5,subvol=/,x-gvfs-show)
/dev/mmcblk1p3 on /home type btrfs (rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/home)
/dev/mmcblk1p3 is an SD card with system install, /dev/sda1 is a USB stick.
Why the USB doesn’t get ssd,discard=async? And where do the extra options not in fstab come from? man btrfs says ssd is auto detected on “status of a device with respect to rotational or non-rotational type”. Pretty sure USB stick is non-rotational… discard default is “async when devices support it”, does this mean the USB stick doesn’t it? Is there a way to check?
You can use for i in /sys/block/sd?/queue/rotational; do echo "$i: $(<$i)"; done to check if the block devices in the scsi subsystem are being detected as rotational (1) or not (0).
As for discard support not being auto detected, I think that can be an artifact of the USB device being “behind” a USB bridge. You can use the smartctl command to see if discard/trim support is being detected.
# smartctl -x /dev/sda | grep -i trim
TRIM Command: Available, deterministic, zeroed
# smartctl -x /dev/sdc
...
/dev/sdc: Unknown USB bridge [0x13fe:0x6500 (0x110)]
Please specify device type with the -d option.
...
I don’t know a good way to determine if a device actually supports the discard command. I’ve seen the blkdiscard command directly report that a device does not support discard commands when used against a block device that lacks such support. But that is a very dangerous command that will instantly erase your entire block device if it works (though maybe if you have a spare that is the same model, you could test it against the spare).
It is indeed detected as rotational (1)… Is that normal?
Doesn’t seem like it supports TRIM, but mounting with discard=async gives no error unlike here.
$ sudo fstrim -v /mnt/usb1
fstrim: /mnt/usb1: the discard operation is not supported
$ sudo mount /mnt/usb1 -o discard=async,ssd
dev/sda1 on /mnt/usb1 type btrfs (rw,relatime,seclabel,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/,x-gvfs-show)
EDIT: Seems yes to rotational, though it might be better to change it.