Hi I have a Corsair Flash Voyager GTX USB3 memory stick which is advertised as supporting TRIM.
I assume there are several other manufacturers with similar devices
My device is working well (ext4) and is very fast but does not appear to respond to the TRIM command even though hdparm suggests it should
I have found the same problem referenced here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1336541 but following the kernel link I am not totally convinced things are happening upstream
Should I bugzilla this against Fedora this or just wait?
John
On fully updated F20 ja@paxos ~ 1$ uname -a Linux paxos 3.15.10-200.fc20.x86_64 #1 SMP Thu Aug 14 15:39:24 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@paxos:~]$ hdparm -I /dev/sdb ATA device, with non-removable media Model Number: Voyager GTX Serial Number: FF1807470C0800110923 Firmware Revision: S9FM01.7 Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0 ... * Data Set Management TRIM supported (limit 8 blocks) ...
root@paxos:~]$ mount -o noatime,discard /dev/sdb1 /media/gtx [root@paxos:~]$ mount |grep sd ... /dev/sdb1 on /media/gtx type ext4 (rw,noatime,seclabel,discard,data=ordered)
However dmesg shows [Aug19 21:21] EXT4-fs (sdb1): mounting with "discard" option, but the device does not support discard [ +0.000004] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: discard [ +0.000005] SELinux: initialized (dev sdb1, type ext4), uses xattr [Aug19 21:24] SELinux: initialized (dev 0:47, type nfs4), uses genfs_contexts
and [root@paxos:~]$ fstrim -v /media/gtx fstrim: /media/gtx: discard operation not supported.
On Aug 22, 2014, at 1:55 AM, John Austin ja@jaa.org.uk wrote:
Hi I have a Corsair Flash Voyager GTX USB3 memory stick which is advertised as supporting TRIM.
I assume there are several other manufacturers with similar devices
My device is working well (ext4) and is very fast but does not appear to respond to the TRIM command even though hdparm suggests it should
I have found the same problem referenced here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1336541 but following the kernel link I am not totally convinced things are happening upstream
Should I bugzilla this against Fedora this or just wait?
You could strace the mount and see if it's checking
/sys/block/sdb/queue/rotational
This is commonly done to see if the device supports trim/discard first. If it's a 1 then it may be a udev thing.
Likewise you can strace mkfs.ext4 which I think defaults to -E discard if the value for ../rotational is 0. I know this is the case for mkfs.btrfs. See thread "zeroing out part of an SDcard" for some things I found relating to SD Cards.
Chris Murphy
On Fri, 2014-08-22 at 14:07 -0600, Chris Murphy wrote:
On Aug 22, 2014, at 1:55 AM, John Austin ja@jaa.org.uk wrote:
Hi I have a Corsair Flash Voyager GTX USB3 memory stick which is advertised as supporting TRIM.
I assume there are several other manufacturers with similar devices
My device is working well (ext4) and is very fast but does not appear to respond to the TRIM command even though hdparm suggests it should
I have found the same problem referenced here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1336541 but following the kernel link I am not totally convinced things are happening upstream
Should I bugzilla this against Fedora this or just wait?
You could strace the mount and see if it's checking
/sys/block/sdb/queue/rotational
This is commonly done to see if the device supports trim/discard first. If it's a 1 then it may be a udev thing.
Likewise you can strace mkfs.ext4 which I think defaults to -E discard if the value for ../rotational is 0. I know this is the case for mkfs.btrfs. See thread "zeroing out part of an SDcard" for some things I found relating to SD Cards.
Chris Murphy
As suggested I have made a few more checks and it would seem that the system knows all about the device but that it is still unhappy about applying the TRIM command
[root@paxos:~]$ strace fstrim /media/gtx ... stat("/media/gtx", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 open("/media/gtx", O_RDONLY) = 3 ioctl(3, FITRIM, 0x7fffee2fb700) = -1 EOPNOTSUPP (Operation not supported) ...
Not sure what this is really telling me
John
Details
root@paxos:~]$ mount |grep sdb /dev/sdb1 on /media/gtx type ext4 (rw,nosuid,nodev,noexec,noatime,seclabel,discard,data=ordered) //----------------------------------------------------------------- dmesg -ew [Aug23 08:45] EXT4-fs (sdb1): mounting with "discard" option, but the device does not support discard [ +0.000002] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: discard [ +0.000004] SELinux: initialized (dev sdb1, type ext4), uses xattr //----------------------------------------------------------------- [root@paxos:~]$ cat /sys/block/sdb/queue/rotational 0 //----------------------------------------------------------------- root@paxos:~]$ hdparm -I /dev/sdb
/dev/sdb:
ATA device, with non-removable media Model Number: Voyager GTX ... Nominal Media Rotation Rate: Solid State Device ... * Data Set Management TRIM supported (limit 8 blocks) ... //----------------------------------------------------------------- [root@paxos:~]$ mount|grep sdb1 /dev/sdb1 on /media/gtx type ext4 (rw,nosuid,nodev,noexec,noatime,seclabel,discard,data=ordered) [root@paxos:~]$ strace fstrim /media/gtx execve("/sbin/fstrim", ["fstrim", "/media/gtx"], [/* 31 vars */]) = 0 brk(0) = 0x143a000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f856786e000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=170173, ...}) = 0 mmap(NULL, 170173, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8567844000 close(3) = 0 open("/lib64/libmount.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\250 ?9\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=279368, ...}) = 0 mmap(0x393f200000, 2371040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x393f200000 mprotect(0x393f240000, 2097152, PROT_NONE) = 0 mmap(0x393f440000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x40000) = 0x393f440000 mmap(0x393f442000, 3552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x393f442000 close(3) = 0 open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\205\240\3572\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=259408, ...}) = 0 mmap(0x32efa00000, 2349960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32efa00000 mprotect(0x32efa3a000, 2093056, PROT_NONE) = 0 mmap(0x32efc39000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x39000) = 0x32efc39000 mmap(0x32efc3d000, 2952, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x32efc3d000 close(3) = 0 open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\25`\3572\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=22624, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8567843000 mmap(0x32ef600000, 2113920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32ef600000 mprotect(0x32ef604000, 2093056, PROT_NONE) = 0 mmap(0x32ef803000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x32ef803000 close(3) = 0 open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240d\240>9\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=144952, ...}) = 0 mmap(0x393ea00000, 2242712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x393ea00000 mprotect(0x393ea21000, 2093056, PROT_NONE) = 0 mmap(0x393ec20000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0x393ec20000 mmap(0x393ec22000, 6296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x393ec22000 close(3) = 0 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\36\202\0026\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=2100672, ...}) = 0 mmap(0x3602800000, 3924576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3602800000 mprotect(0x36029b4000, 2097152, PROT_NONE) = 0 mmap(0x3602bb4000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b4000) = 0x3602bb4000 mmap(0x3602bba000, 16992, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3602bba000 close(3) = 0 open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\27`>9\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=421144, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8567842000 mmap(0x393e600000, 2511368, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x393e600000 mprotect(0x393e665000, 2093056, PROT_NONE) = 0 mmap(0x393e864000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x64000) = 0x393e864000 close(3) = 0 open("/lib64/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3400\240\330<\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=155400, ...}) = 0 mmap(0x3cd8a00000, 2245240, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3cd8a00000 mprotect(0x3cd8a24000, 2093056, PROT_NONE) = 0 mmap(0x3cd8c23000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x3cd8c23000 close(3) = 0 open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\300\0026\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=22440, ...}) = 0 mmap(0x3602c00000, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3602c00000 mprotect(0x3602c03000, 2093056, PROT_NONE) = 0 mmap(0x3602e02000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3602e02000 close(3) = 0 open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340m\0\0036\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=150800, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8567841000 mmap(0x3603000000, 2213104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3603000000 mprotect(0x3603018000, 2093056, PROT_NONE) = 0 mmap(0x3603217000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x3603217000 mmap(0x3603219000, 13552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3603219000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8567840000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f856783e000 arch_prctl(ARCH_SET_FS, 0x7f856783e880) = 0 mprotect(0x606000, 4096, PROT_READ) = 0 mprotect(0x393f440000, 4096, PROT_READ) = 0 mprotect(0x32efc39000, 12288, PROT_READ) = 0 mprotect(0x32ef803000, 4096, PROT_READ) = 0 mprotect(0x393ec20000, 4096, PROT_READ) = 0 mprotect(0x3602bb4000, 16384, PROT_READ) = 0 mprotect(0x360261f000, 4096, PROT_READ) = 0 mprotect(0x393e864000, 4096, PROT_READ) = 0 mprotect(0x3cd8c23000, 4096, PROT_READ) = 0 mprotect(0x3602e02000, 4096, PROT_READ) = 0 mprotect(0x3603217000, 4096, PROT_READ) = 0 munmap(0x7f8567844000, 170173) = 0 set_tid_address(0x7f856783eb50) = 8288 set_robust_list(0x7f856783eb60, 24) = 0 rt_sigaction(SIGRTMIN, {0x36030068c0, [], SA_RESTORER|SA_SIGINFO, 0x360300f750}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x3603006950, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x360300f750}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 statfs("/sys/fs/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 statfs("/sys/fs/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0 stat("/sys/fs/selinux", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 brk(0) = 0x143a000 brk(0x145b000) = 0x145b000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0 mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8561315000 close(3) = 0 stat("/media/gtx", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 open("/media/gtx", O_RDONLY) = 3 ioctl(3, FITRIM, 0x7fffee2fb700) = -1 EOPNOTSUPP (Operation not supported) close(3) = 0 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2492, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f856786d000 read(3, "# Locale name alias data base.\n#"..., 4096) = 2492 read(3, "", 4096) = 0 close(3) = 0 munmap(0x7f856786d000, 4096) = 0 open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_GB/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "fstrim: ", 8fstrim: ) = 8 write(2, "/media/gtx: discard operation no"..., 44/media/gtx: discard operation not supported.) = 44 write(2, "\n", 1 ) = 1 close(1) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++ [root@paxos:~]$
On Aug 23, 2014, at 2:22 AM, John Austin ja@jaa.org.uk wrote:
Not sure what this is really telling me
I suggest a bug at bugzilla.kernel.org against filesystem > other, as this would be a bug against FITRIM ioctl and ioctl fits in the kernel under fs. Both fstrim and the discard mount option leverage this ioctl, so I think this is the better bug to file. Point out both the discard failure dmesg, as well as the strace fstrim failure when the fs is mounted. Include the hdparm info suggested TRIM is supported.
The drawback of filing it at RHBZ is that it's almost certainly not a Fedora specific bug or regression, so it's best off going straight to the source.
Chris Murphy