Trim support for HC1 and HK USB-SATA adapter

Post Reply
User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Sun Sep 10, 2017 3:10 pm

I've recently tried to run fstrim on two ssds, one connected to the HC1 and the other to HardKernel's USB-SATA bridge attached to a XU4 and in both cases I got:

Code: Select all

# fstrim /media/ssd/ssd250/
fstrim: /media/ssd/ssd250/: the discard operation is not supported
On the XU4 I'm running 4.9.33, on the HC1 I'm running the latest 4.9 kernel.

I am able to fstrim the emmc.

Is this a hardware limitation of going through usb-sata, or am I doing something wrong?

DarkBahamut
Posts: 322
Joined: Tue Jan 19, 2016 10:19 am
languages_spoken: english
ODROIDs: XU4, N1
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by DarkBahamut » Mon Sep 11, 2017 1:52 am

A quick google suggests fstrim can't be used on USB disks, even when it should work (IE. the bridge chip correctly does SCSI/ATA translation) - https://bugs.launchpad.net/ubuntu/+sour ... ug/1336541

As an alternative I heard mention that this might work instead - https://github.com/Distrotech/hdparm/tree/master/wiper

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Mon Sep 11, 2017 1:56 am

Oh, I didn't know about that. What about if the disk is seen as uas? I'll look into wiper, thanks

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Mon Sep 11, 2017 3:53 pm

I've tried wiper.sh, but I'm not sure if it really works or not:

Code: Select all

root@odroid:~/development/hdparm/wiper# ./wiper.sh --verbose --commit /dev/sda1

wiper.sh: Linux SATA SSD TRIM utility, version 3.5, by Mark Lord.
rootdev=/dev/mmcblk1p2
/dev/sda1: fstype=ext3
Preparing for offline TRIM of free space on /dev/sda1 (ext3 non-mounted).

This operation could silently destroy your data.  Are you sure (y/N)? y
Syncing disks.. 
Beginning TRIM operations..
get_trimlist=/sbin/dumpe2fs /dev/sda1

/dev/sda:
trimming 750578 sectors from 83 ranges
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
succeeded
Done.

At every run it reports the same number of sectors to be trimmed. I was thinking it would only report non-trimmed data. There is nothing in dmesg though.
Also, it can't trim with the filesystem mounted:

Code: Select all

/dev/sda4: cannot TRIM ext3 filesystem when mounted read-write, aborting.

DarkBahamut
Posts: 322
Joined: Tue Jan 19, 2016 10:19 am
languages_spoken: english
ODROIDs: XU4, N1
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by DarkBahamut » Mon Sep 11, 2017 9:24 pm

mad_ady wrote:Oh, I didn't know about that. What about if the disk is seen as uas? I'll look into wiper, thanks
Yeah, UAS doesn't guarantee any trim support unfortunately. If I test my UAS enclosure (ASM1053) on windows, trim commands are refused.

Code: Select all

PS C:\WINDOWS\system32> Optimize-Volume -DriveLetter L -ReTrim -Verbose
VERBOSE: Invoking retrim on New Volume (L:)...
VERBOSE: Retrim:  100% complete.
Optimize-Volume : The volume optimization operation requested is not supported by the hardware backing the volume.
The JMS578 used on the HC1 has reports online that trim does work however, but support seems to vary depending on the application and firmware backing the bridge. Fingers crossed it should work on the HC1!

As for testing wiper, there's an article here that talks about using hdparm to do before and after sector reads to ensure they get cleared. Hopefully that comes back with good news :)

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Mon Sep 11, 2017 9:42 pm

@DarkBahamut: I wonder if a poor man's trim could be

Code: Select all

dd if=/dev/zero of=/path/to/mountpoint/zero bs=1M
rm /path/to/mountpoint/zero
It would fill all the free space on the partition with zeros, and then you delete the zero file. Most of the data would be written as zero on the ssd, except some control structures for inodes, which would not be zero. Is writing zero on the ssd the same as trimming it?

LiquidAcid
Posts: 1085
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by LiquidAcid » Mon Sep 11, 2017 9:53 pm

mad_ady wrote:Is writing zero on the ssd the same as trimming it?
No.

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Mon Sep 11, 2017 10:06 pm

Ok, thanks for clearing that misconception :)

dchang0
Posts: 122
Joined: Tue Dec 22, 2015 1:29 pm
languages_spoken: english
ODROIDs: C1+, XU4Q
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by dchang0 » Fri Sep 22, 2017 6:48 pm

Are there any plans to add the JMS578's passthrough TRIM support to the HardKernel USB3.0 to SATA Bridge Board Plus?

If so, would it be user-upgradeable firmware allowing existing owners of the board to gain the feature, or would we have to buy a new revision of the board?

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Sat Sep 23, 2017 6:43 am

@dchang0
We have no such information about any possible passthrough TRIM support from JMicron.

dchang0
Posts: 122
Joined: Tue Dec 22, 2015 1:29 pm
languages_spoken: english
ODROIDs: C1+, XU4Q
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by dchang0 » Sat Sep 23, 2017 7:09 am

Hmm. According to this review of the Inateck bridge using the same JMS578 chipset, passthrough TRIM is supported on their product (see the table at the bottom of the page, left-hand column):

https://www.anandtech.com/show/10779/in ... ges-review

I do not see mention of TRIM support on JMicron's spec sheet for the JMS578.

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Sat Sep 23, 2017 8:30 am

Thank you for the link.
We will check it with JMicron.

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Fri Oct 13, 2017 11:12 am

I have a USB3.0 to SATA Bridge Board Plus that has JMS578 chip inside https://www.hardkernel.com/shop/usb3-0- ... oard-plus/
and tried this link under Windows 10 http://salutepc.altervista.org/ssd-on-u ... linux.html
It is work. and HC1 has the same version of f/w with it. so I can say it supports trim.

But, I have no luck with HC1 and also x86 desktop which is running under Ubuntu 64bit.
I think that uas kernel driver doesn't translate command ata from scsi.

When I try the command, I can see the log by kernel.

Code: Select all

root@odroid:~# uname -a
Linux odroid 4.9.50+ #21 SMP PREEMPT Fri Oct 13 09:22:57 KST 2017 armv7l armv7l armv7l GNU/Linux

# mount -t ext4 /dev/sda1 /media/hdd -o discard

"EXT4-fs (sda1): mounting with "discard" option, but the device does not support discard
"EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: discard

# fstrim -v /media/hdd

lt-fstrim: /media/hdd: the discard operation is not supported
and kernel source code has returned '-EOPNOTSUPP' at KERNEL_SRC_ROOT/fs/ext4/ioctl.c line 747
because QUEUE_FLAG_DISCARD is not defined at KERNEL_SRC_ROOT/include/linux/blkdev.h line 495

Code: Select all

if (!blk_queue_discard(q)) {
    return -EOPNOTSUPP;
}

Code: Select all

#define QUEUE_FLAG_DISCARD    14      /* support DISCARD */
I'm not familiar with that kernel. but I want to know where is lack of this to support it.

LiquidAcid
Posts: 1085
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by LiquidAcid » Fri Oct 13, 2017 8:46 pm

You're not reading the code correctly. QUEUE_FLAG_DISCARD is always defined. The SCSI subsystem just doesn't set the bit (or explicitly clear it), see sd_config_discard() and surrounding code.

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Tue Dec 05, 2017 3:22 pm

Hi all,

I've tested fstrim command after update new jms578 f/w under HC1 today.
https://wiki.odroid.com/odroid-xu4/soft ... _fw_update
It works.
my kernel version is

Code: Select all

root@odroid:~# uname -a
Linux odroid 4.14.0+ #8 SMP PREEMPT Wed Nov 29 18:39:48 KST 2017 armv7l armv7l armv7l GNU/Linux
root@odroid:~# 

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Tue Dec 05, 2017 4:01 pm

I see that the same controller is available in the SATA board as well (http://www.hardkernel.com/main/products ... 0462654346).
Previous version:

Code: Select all

# ./JMS578FwUpdate  -d /dev/sdb -v
Bridge Firmware Version: v204.74.231.239


Have you tried it on the SATA adapter as well? I have only one, which is in production and I'm reluctant to brick it :)

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Tue Dec 05, 2017 4:37 pm

mad_ady wrote: Have you tried it on the SATA adapter as well? I have only one, which is in production and I'm reluctant to brick it :)
Yes. I have tried it. and It is still the SATA adapter updated. ;)
If you want to back to the previous version of f/w, you need to use '-b' option to make backup

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Tue Dec 05, 2017 5:19 pm

Thanks for checking.
Two more things I want to ask you:
1. What's the difference between updating with and without NVRAM? What is stored in that NVRAM?
2. After a frimware upgrade - do I need to unplug/replug the disk or unmount and remount it? Do I need to reboot the Odroid? Does it cause a reset of the controller and the disk gets reattached?

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Tue Dec 05, 2017 5:42 pm

mad_ady wrote: 1. What's the difference between updating with and without NVRAM? What is stored in that NVRAM?
There are some information USB PID, VID, S/N and spin-down time or so stored.
mad_ady wrote: 2. After a frimware upgrade - do I need to unplug/replug the disk or unmount and remount it? Do I need to reboot the Odroid? Does it cause a reset of the controller and the disk gets reattached?
Yes, you just need to system reboot. but No need unplug/replug the disk.
It will reset the controller and disk get reattached.

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Thu Dec 07, 2017 5:23 pm

I tried to do the flashing in the USB-SATA controller, but failed:

Code: Select all

root@aldebaran:~/JMS578FwUpdater# ./JMS578FwUpdate  -d /dev/sdb -f ./JMS578_Hardkernel_v173.01.00.01.bin -b ./backup.bin
Update Firmware file name: ./JMS578_Hardkernel_v173.01.00.01.bin
Backup Firmware file name: ./backup.bin
Read Back to Backup Error!!
root@aldebaran:~/JMS578FwUpdater# ./JMS578FwUpdate  -d /dev/sdb -f ./JMS578_Hardkernel_v173.01.00.01.bin -b ./backup.bin -nNV
Update Firmware file name: ./JMS578_Hardkernel_v173.01.00.01.bin
Backup Firmware file name: ./backup.bin
CAUTION: Update firmware without NVRAM.
Read Back to Backup Error!!
I'm running kernel 4.9.58. Maybe it's not compatible with the USB-SATA controller?

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Thu Dec 07, 2017 5:43 pm

You should check device "-d /dev/sdb(/dev/sda)" option with "-v" if it shows us current version correctly.

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Thu Dec 07, 2017 5:52 pm

It does report the version:

Code: Select all

root@aldebaran:~/JMS578FwUpdater# ./JMS578FwUpdate  -d /dev/sdb -v
Bridge Firmware Version: v204.74.231.239

You have new mail in /var/mail/root
But... if I try it on other disks without the same chipset, it reports the same thing :(

Code: Select all

root@aldebaran:~/JMS578FwUpdater# ./JMS578FwUpdate  -d /dev/sda -v
Bridge Firmware Version: v204.74.231.239

root@aldebaran:~/JMS578FwUpdater# ./JMS578FwUpdate  -d /dev/sdc -v
Bridge Firmware Version: v204.74.231.239

/dev/sdb is the correct disk connected to the HK USB-Sata adapter.

neal
Posts: 160
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by neal » Thu Dec 07, 2017 6:01 pm

Yes. In my case the same situation. so I tried to pull out all HDD except one plug on JMS578 and then do it again.

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Thu Dec 07, 2017 6:44 pm

Ok, I'll try again tomorrow with only this adapter plugged in.

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Fri Dec 08, 2017 4:44 pm

Ok, I moved the adapter and disk to a development XU4 and I still can't update the firmware:

Code: Select all

odroid@odroid:~/JMS578FwUpdater> sudo ./JMS578FwUpdate -v
[sudo] password for odroid: 
JMicron Firmware Update Tool v0.0.0.1
Copyright (C) 2017 JMicron Corp.

odroid@odroid:~/JMS578FwUpdater> sudo ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v12.149.213.239

odroid@odroid:~/JMS578FwUpdater> sudo ./JMS578FwUpdate -d /dev/sda -f JMS578_Hardkernel_v173.01.00.01.bin  -b backup.bin -nNV
Update Firmware file name: JMS578_Hardkernel_v173.01.00.01.bin
Backup Firmware file name: backup.bin
CAUTION: Update firmware without NVRAM.
Read Back to Backup Error!!
odroid@odroid:~/JMS578FwUpdater> ls -l
total 612
-rwxr-xr-x 1 odroid odroid  50688 Nov  1 05:34 JMS578-v0.1.0.5.bin
-rwxr-xr-x 1 odroid odroid 519032 Nov  1 05:34 JMS578FwUpdate
-rw-r--r-- 1 odroid odroid  50688 Dec  5 01:36 JMS578_Hardkernel_v173.01.00.01.bin

The strange thing is that on a previous boot I got a completely different bridge firmware version:

Code: Select all

odroid@odroid:~/JMS578FwUpdater> sudo ./JMS578FwUpdate -v -d /dev/sda
Bridge Firmware Version: v232.127.180.239

which differs from the version reported on my original Odroid...

Maybe I'm running an older revision of the HK USB-SATA adapter?

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Fri Dec 08, 2017 4:57 pm

I think so.
The old adapter had GL3321G2 chipset instead of JMS578. :(
http://www.hardkernel.com/main/products ... 5197048960

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Fri Dec 08, 2017 5:12 pm

You're right! Now I understand. I have the regular one (the old one). I never realized you released a "plus" version.
Oh well - mystery solved. At least it didn't brick it, which is a nice thing!
Thanks and sorry for the mixup.

msette
Posts: 4
Joined: Wed Apr 25, 2018 5:50 pm
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by msette » Wed Apr 25, 2018 9:20 pm

Hi all.
On my (HC1 + Kinsgston SSD + Armbian_5.43.180420_Odroidxu4_Debian_stretch_next_4.14.35) fstrim appears unsupported:

Code: Select all

root@odroidhc1:~/JMS578FwUpdater # fstrim /mnt/ssd
fstrim: /mnt/ssd: the discard operation is not supported
root@odroidhc1:~/JMS578FwUpdater # hdparm -I /dev/sda | grep TRIM
           *    Data Set Management TRIM supported (limit 1 block)
root@odroidhc1:~/JMS578FwUpdater # lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=exynos-ohci/3p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=exynos-ehci/3p, 480M
root@odroidhc1:~/JMS578FwUpdater # uname -a
Linux odroidhc1 4.14.35-odroidxu4 #13 SMP PREEMPT Mon Apr 23 22:08:26 CEST 2018 armv7l GNU/Linux
root@odroidhc1:~/JMS578FwUpdater # ./JMS578FwUpdate -v
JMicron Firmware Update Tool v0.0.0.2
Copyright (C) 2018 JMicron Corp.

root@odroidhc1:~/JMS578FwUpdater # ./JMS578FwUpdate -v /dev/sda
Bridge Firmware Version: v173.1.0.1

root@odroidhc1:~/JMS578FwUpdater #
What is my mistake?

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Wed Apr 25, 2018 9:26 pm

I've tested it with Ubuntu only. But I believe Armbian should work too.
You already have the latest firmware.

What is fstrim /mnt/ssd -v output?

User avatar
mad_ady
Posts: 5089
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by mad_ady » Wed Apr 25, 2018 9:44 pm

The filesystem must also support trim. What filesystem are you using?

msette
Posts: 4
Joined: Wed Apr 25, 2018 5:50 pm
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by msette » Wed Apr 25, 2018 10:54 pm

Here they are:

Code: Select all

root@odroidhc1:~ # fstrim /mnt/ssd -v
fstrim: /mnt/ssd: the discard operation is not supported
root@odroidhc1:~ # mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=953068k,nr_inodes=187255,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=204388k,mode=755)
/dev/sda1 on / type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=600,stripe=8191,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
configfs on /sys/kernel/config type configfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,relatime)
/dev/mmcblk1p1 on /media/mmcboot type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=600)
/dev/mmcblk1p1 on /boot type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=600)
/dev/sda1 on /var/log.hdd type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=600,stripe=8191,data=ordered)
log2ram on /var/log type tmpfs (rw,nosuid,nodev,noexec,relatime,size=51200k,mode=755)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=204384k,mode=700)
/dev/sda2 on /mnt/ssd type ext4 (rw,relatime,stripe=8191,data=ordered)
root@odroidhc1:~ #
Thanks for answer

msette
Posts: 4
Joined: Wed Apr 25, 2018 5:50 pm
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by msette » Thu Apr 26, 2018 2:18 pm

msette wrote:Here they are:

Code: Select all

...
Thanks for answer
Update. The disk was a Kingston SsdNow v300 120gb.
Tested with a Kingston v300 60gb: it doesn't work.

Tested with a Transcend 32gb: IT WORKS ?!?!

Maybe it is an incompatibility of the Sandforce controller of the Kingston disks with the Jmicron bridge.

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Thu Apr 26, 2018 2:54 pm

Can you test the TRIM fucntionality with the 120GB/60GB on a normal Linux PC SATA port?

msette
Posts: 4
Joined: Wed Apr 25, 2018 5:50 pm
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by msette » Fri Apr 27, 2018 3:48 am

Elsewere the Kingston disks are correctly trimmed.
Here is some printout (I create and delete some data):

Code: Select all

[    7.424055] ata1.00: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    7.424064] ata1.01: SATA link down (SStatus 0 SControl 300)
[    7.445478] ata1.00: ATA-8: KINGSTON SV300S37A120G, 60AABBF0, max UDMA/133
[    7.445481] ata1.00: 234441648 sectors, multi 1: LBA48 NCQ (depth 0/32)
[    7.465446] ata1.00: configured for UDMA/133
[    7.465589] scsi 0:0:0:0: Direct-Access     ATA      KINGSTON SV300S3 BBF0 PQ: 0 ANSI: 5
[    7.465765] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    7.465789] sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/112 GiB)
[    7.465802] sd 0:0:0:0: [sda] Write Protect is off
[    7.465803] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    7.465831] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.466292]  sda: sda1 sda2
[    7.466612] sd 0:0:0:0: [sda] Attached SCSI disk


root@ubuntu:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=2003576k,nr_inodes=500894,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=404272k,mode=755)
/dev/sr0 on /cdrom type iso9660 (ro,noatime,nojoliet,check=s,map=n,blocksize=2048)
/dev/loop0 on /rofs type squashfs (ro,noatime)
/cow on / type overlay (rw,relatime,lowerdir=//filesystem.squashfs,upperdir=/cow/upper,workdir=/cow/work)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12889)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /run/user/999 type tmpfs (rw,nosuid,nodev,relatime,size=404268k,mode=700,uid=999,gid=999)
gvfsd-fuse on /run/user/999/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=999,group_id=999)
/dev/sda1 on /mnt/ssd type ext4 (rw,relatime,stripe=8191,data=ordered)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=404268k,mode=700)
root@ubuntu:~#


root@ubuntu:~# fstrim -v /mnt/ssd
/mnt/ssd: 124 MiB (130007040 bytes) trimmed
root@ubuntu:~#


root@ubuntu:~# uname -a
Linux ubuntu 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:~#
It seems some kernel issue.

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Fri Apr 27, 2018 9:04 am

I see.
We will report the issue to JMicron. But I'm not sure whether the problem can be fixed or not since they can't buy all the different storages.

We tested a few different SSDs and they worked well with TRIM.
- Samsung 850 EVO 250GB
- Samsung 850 EVO 120GB
- Samsung 850 Pro 256GB
- Wester Digital Green 120GB

clown522
Posts: 5
Joined: Sun Jun 10, 2018 8:58 pm
languages_spoken: english
ODROIDs: hc2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by clown522 » Sun Jun 10, 2018 9:05 pm

Hi,
i have the Odroid HC2 but i guess the sata chipset is the same.
I want to mention that i used version v.173 and upgraded to the beta version v.255 of JMS578.

The fstrim command does not work unfortunately with the new EVO 860 series from Samsung. (i used 500 GB)
The EVO 850 works indeed as mentioned above.

Maybe JMicron can fix it in another firmware release.

P.S. kernel at armbian does not make a difference. (i tested kernel v. 4.9 and v. 4.14)

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Mon Jun 11, 2018 9:07 am

We've never heard about the beta version firmware.
https://wiki.odroid.com/odroid-xu4/soft ... _fw_update
Where did you get the v.255?

clown522
Posts: 5
Joined: Sun Jun 10, 2018 8:58 pm
languages_spoken: english
ODROIDs: hc2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by clown522 » Mon Jun 11, 2018 6:45 pm

I have it from this source: http://kaiser-edv.de/tmp/mUCIx3/JMS578_ ... 1_beta.zip
But it was discussed here: viewtopic.php?f=97&t=29069

Code: Select all

root@odroid:~/JMS578FwUpdater# ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v255.1.0.1

User avatar
odroid
Site Admin
Posts: 29325
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by odroid » Tue Jun 12, 2018 1:49 pm

We will report the issue to Jmicron.
But I'm not sure whether they will release a newer firmware in near future or not.

User avatar
rooted
Posts: 6061
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by rooted » Tue Jun 12, 2018 1:52 pm

clown522 wrote:I have it from this source: http://kaiser-edv.de/tmp/mUCIx3/JMS578_ ... 1_beta.zip
But it was discussed here: viewtopic.php?f=97&t=29069

Code: Select all

root@odroid:~/JMS578FwUpdater# ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v255.1.0.1
Did you try any other firmware? Or did you upgrade with hopes of it resolving the issue?

clown522
Posts: 5
Joined: Sun Jun 10, 2018 8:58 pm
languages_spoken: english
ODROIDs: hc2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by clown522 » Tue Jun 12, 2018 6:28 pm

rooted wrote:
clown522 wrote:I have it from this source: http://kaiser-edv.de/tmp/mUCIx3/JMS578_ ... 1_beta.zip
But it was discussed here: viewtopic.php?f=97&t=29069

Code: Select all

root@odroid:~/JMS578FwUpdater# ./JMS578FwUpdate -d /dev/sda -v
Bridge Firmware Version: v255.1.0.1
Did you try any other firmware? Or did you upgrade with hopes of it resolving the issue?
Which other software can I use also? v173 is the minimum for sata commands. v255 was the newest version, wasn’t it?

User avatar
rooted
Posts: 6061
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by rooted » Tue Jun 12, 2018 9:44 pm

I was asking did you try with old and new firmware?

clown522
Posts: 5
Joined: Sun Jun 10, 2018 8:58 pm
languages_spoken: english
ODROIDs: hc2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by clown522 » Tue Jun 12, 2018 9:50 pm

rooted wrote:I was asking did you try with old and new firmware?
Sorry, now I got it!
I tried of course both versions and 4.9 /4.14 kernel. Does not make any difference, unfortunately.

User avatar
rooted
Posts: 6061
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by rooted » Tue Jun 12, 2018 10:05 pm

Yes I wasn't sure if you updated the firmware to deal with the issue or if the issue happened after the update.

Samsung SSD are very popular and certainly JMicron will want to support them properly, I think they will update the firmware once notified about lack of trim support. Will take time I'm sure (if at all).

clown522
Posts: 5
Joined: Sun Jun 10, 2018 8:58 pm
languages_spoken: english
ODROIDs: hc2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by clown522 » Tue Jun 12, 2018 10:24 pm

rooted wrote:Yes I wasn't sure if you updated the firmware to deal with the issue or if the issue happened after the update.

Samsung SSD are very popular and certainly JMicron will want to support them properly, I think they will update the firmware once notified about lack of trim support. Will take time I'm sure (if at all).
Hopefully, but nevertheless i swaped my 860 into the pc and the 850 into the hc2.

gigel
Posts: 3
Joined: Sat Dec 24, 2016 6:10 am
languages_spoken: english
ODROIDs: C2
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by gigel » Sun Jul 29, 2018 8:23 am

I am successfully able to issue TRIM under windows 10 but not using linux.
I have this jms578 chip in a sata to usb-c cable.
the ssd is 860 evo

I believe the issue is the windows hardware team knows more than linux hardware team about this chip, maybe they collaborate better with jmicron.
I have opened a fedora bug to see what they say about it https://bugzilla.redhat.com/show_bug.cgi?id=1609519

@clown522 I have also tried with 255 beta but it does not have TRIM even on windows, so I reverted back to working 00.02.00.04 that I backed up before playing with various firmwares from usbdev.ru

alex_dom
Posts: 39
Joined: Sat Jan 07, 2017 10:12 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by alex_dom » Tue Sep 25, 2018 11:53 am

Had the same issues with JMicron stock firmware. TRIM didn't work on my ADATA S800 (with it's own Micron chip) connected to XU4. Then re-flashed the firmware the method from here https://wiki.odroid.com/odroid-xu4/soft ... _fw_update, mentioned above. The firmware I used was v173.01.00.01. After that TRIM and UASP works fine.

P.S. I recommend to power off XU4, then wait a min(enough for sure) then turn it back on. In my case I use a stack of them and several industrial PSUs.

Cheers! And thank odroid team for separate firmware worked out with JMicron.

S_R
Posts: 1
Joined: Tue Jan 15, 2019 6:30 am
languages_spoken: english
Contact:

Re: Trim support for HC1 and HK USB-SATA adapter

Unread post by S_R » Tue Jan 15, 2019 6:42 am

Hey, any updates on this? I have a rock64 (4.4.167), JMS578 (v173.01.00.01) encasement with a 860 evo and just can't get trim working.
Following this and this my 860 evo doesn't even support unmap.

Code: Select all

root@rock64:/sys/class/scsi_disk/0:0:0:0# sg_vpd --page=0xb2 /dev/sda
Logical block provisioning VPD page (SBC):
  Unmap command supported (LBPU): 0
  Write same (16) with unmap bit supported (LBWS): 0
  Write same (10) with unmap bit supported (LBWS10): 0
  Logical block provisioning read zeros (LBPRZ): 0
  Anchored LBAs supported (ANC_SUP): 0
  Threshold exponent: 1
  Descriptor present (DP): 0
  Minimum percentage: 0
  Provisioning type: 0
  Threshold percentage: 0
root@rock64:/sys/class/scsi_disk/0:0:0:0# sg_vpd --page=0xb0 /dev/sda
Block limits VPD page (SBC):
  Write same non-zero (WSNZ): 0
  Maximum compare and write length: 0 blocks
  Optimal transfer length granularity: 8 blocks
  Maximum transfer length: 65535 blocks
  Optimal transfer length: 65535 blocks
  Maximum prefetch length: 65535 blocks
  Maximum unmap LBA count: 0
  Maximum unmap block descriptor count: 0
  Optimal unmap granularity: 0
  Unmap granularity alignment valid: 0
  Unmap granularity alignment: 0
  Maximum write same length: 0x0 blocks
  Maximum atomic transfer length: 0
  Atomic alignment: 0
  Atomic transfer length granularity: 0
  Maximum atomic transfer length with atomic boundary: 0
  Maximum atomic boundary size: 0
Did anybody get this to work with a 860 evo and any encasement? Getting another encasement would be an option, a new drive not so much.
I'm kinda worried about the health of my drive now without the ability to trim, is this a legitimate concern?
Thanks in advance!

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 2 guests