Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB3 flasdrive too slow with Gentoo [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
apiaio
Apprentice
Apprentice


Joined: 04 Dec 2008
Posts: 208

PostPosted: Fri Feb 07, 2014 6:28 pm    Post subject: USB3 flasdrive too slow with Gentoo [Solved] Reply with quote

Hi there.

After plugin the USB3 Kingston key, I can see
Quote:
localhost / # lsusb
Bus 002 Device 004: ID 1462:8801 Micro Star International
Bus 002 Device 003: ID 0c45:6340 Microdia
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 0951:1697 Kingston Technology
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
localhost / # dmesg | grep -i xhc
[ 0.612158] xhci_hcd 0000:07:00.0: xHCI Host Controller
[ 0.612202] xhci_hcd 0000:07:00.0: new USB bus registered, assigned bus number 3
[ 0.619151] xhci_hcd 0000:07:00.0: supports USB remote wakeup
[ 0.619169] xhci_hcd 0000:07:00.0: irq 41 for MSI/MSI-X
[ 0.619173] xhci_hcd 0000:07:00.0: irq 42 for MSI/MSI-X
[ 0.619176] xhci_hcd 0000:07:00.0: irq 43 for MSI/MSI-X
[ 0.619179] xhci_hcd 0000:07:00.0: irq 44 for MSI/MSI-X
[ 0.619182] xhci_hcd 0000:07:00.0: irq 45 for MSI/MSI-X
[ 0.619267] usb usb3: Product: xHCI Host Controller
[ 0.619269] usb usb3: Manufacturer: Linux 3.10.25-gentoo xhci_hcd
[ 0.619328] xHCI xhci_add_endpoint called for root hub
[ 0.619329] xHCI xhci_check_bandwidth called for root hub
[ 0.619409] xhci_hcd 0000:07:00.0: xHCI Host Controller
[ 0.619448] xhci_hcd 0000:07:00.0: new USB bus registered, assigned bus number 4
[ 0.619454] xhci_hcd 0000:07:00.0: supports USB remote wakeup
[ 0.624387] usb usb4: Product: xHCI Host Controller
[ 0.624389] usb usb4: Manufacturer: Linux 3.10.25-gentoo xhci_hcd
[ 0.624445] xHCI xhci_add_endpoint called for root hub
[ 0.624446] xHCI xhci_check_bandwidth called for root hub
[ 315.000919] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
So I think that everything is OK. But transfer speed is only cca 400 kB/sec. I have Sabayon installation on the same machine and there is speed cca 60 MB/sec. Probably I have something neglected in kernel configuration, but I do not what.

Last edited by apiaio on Fri Feb 07, 2014 8:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7116
Location: almost Mile High in the USA

PostPosted: Fri Feb 07, 2014 7:12 pm    Post subject: Reply with quote

Same kernel version on both? Same mount options (sure you're not mounting sync?)

I have yet to try my usb3 flash drive...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
apiaio
Apprentice
Apprentice


Joined: 04 Dec 2008
Posts: 208

PostPosted: Fri Feb 07, 2014 8:00 pm    Post subject: Reply with quote

Quote:
localhost / # uname -r
3.10.25-gentoo
and
Quote:
linux-3.9.0-sabayon
mount points:Gentoo
Quote:
/dev/sdd1 /media vfat defaults,noauto,sync,group,gid=15,umask=0002 0 0
Sabayon
Quote:
none /proc/bus/usb usbfs devgid=85,devmode=0666 0 0
Even if Sabayon is Gentoo based binary system there is many differences in config files and Sabayon's mount point doesn't work in Gentoo for me.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3868
Location: Dallas area

PostPosted: Fri Feb 07, 2014 8:16 pm    Post subject: Reply with quote

I've plugged in usb3 hard disks and a sandisk usb3 flash drive and had no problems with speed not being usb3, ie greater than usb2


Edit to add:
Quote:
/dev/sdd1 /media vfat defaults,noauto,sync,group,gid=15,umask=0002 0 0


From the man page for mount:
sync All I/O to the filesystem should be done synchronously. In case of media with limited number of write cycles (e.g. some flash drives) "sync" may cause life-cycle shortening.

From me: Sync should make writes much slower.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
apiaio
Apprentice
Apprentice


Joined: 04 Dec 2008
Posts: 208

PostPosted: Fri Feb 07, 2014 8:22 pm    Post subject: Reply with quote

eccerr0r wrote:
Same kernel version on both? Same mount options (sure you're not mounting sync?)

I have yet to try my usb3 flash drive...
Now I noticed sync mount option - that was the problem.
Thanks
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3868
Location: Dallas area

PostPosted: Fri Feb 07, 2014 8:29 pm    Post subject: Reply with quote

What I do is when writing to a flash drive, is do the writes, then do a sync when done with all writes,
then do a proper eject so that the data stay consistent.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7116
Location: almost Mile High in the USA

PostPosted: Fri Feb 07, 2014 11:00 pm    Post subject: Reply with quote

yep takes some discipline not to randomly yank the USB drives. It's best to shut off auto sync, manually sync and unmount before you disconnect. Overall it might be a bit more hassle but your data and disk will appreciate it.

I forget but there was a mount option to only sync if there's no write activity for a short period... This way it minimizes risk of accidentally yanking the drive before unmounting.

Can't remember what it is though...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
apiaio
Apprentice
Apprentice


Joined: 04 Dec 2008
Posts: 208

PostPosted: Sat Feb 08, 2014 8:18 pm    Post subject: Reply with quote

Could anyone of you explain why and how to do a sync after the writes?
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3868
Location: Dallas area

PostPosted: Sat Feb 08, 2014 8:32 pm    Post subject: Reply with quote

type in "sync" it will sync all mounted filesystems/drives

I use a script called suspend-usb-device that I ran across on the net, that acts like the MS windows hardware eject option.
Just to make sure on my usb3 drives, it will even work on flash drives, though the sdparm commands are useless for it.

Quote:
suspend-usb-device Copyright (C) 2009 Yan Li <elliot.li.tech@gmail.com>

This script is designed to properly put an USB device into suspend
mode that can then be unplugged safely. It sends a SYNCHRONIZE CACHE
command followed by a START-STOP command (if the device supports it),
unbinds the device from the driver and then suspends the USB
port. After that you can disconnect your USB device safely.


I modified it for my purposes, it works well enough.
I've not had any data corruption since doing sync and then the eject.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
gotyaoi
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2013
Posts: 137

PostPosted: Sun Feb 09, 2014 4:32 am    Post subject: Reply with quote

There's also the 'flush' mount option as opposed to 'sync' or 'async'. It's a bit of a compromise between the buffer nothing of 'sync' and the hold on to buffers as long as possible of 'async'. You might try it and see if it works for you.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3868
Location: Dallas area

PostPosted: Sun Feb 09, 2014 10:38 am    Post subject: Reply with quote

gotyaoi wrote:
There's also the 'flush' mount option as opposed to 'sync' or 'async'. It's a bit of a compromise between the buffer nothing of 'sync' and the hold on to buffers as long as possible of 'async'. You might try it and see if it works for you.


It would not help his problem with buffers flushing, it would just change when it was done, earlier vs later.

Quote:
flush If set, the filesystem will try to flush to disk more early than normal. Not set by default.


In his case turning off sync will give him decent speed.

With a big enough data transfer the buffers will flush when they get full, regardless of sync (mount) or not.

I like to do a sync after all data is sent to a disk, but it's really unnecessary as an umount will sync all data to the filesystem before unmounting.

But that's only to the filesystem, it doesn't cause the disk to flush it's own buffers, which is why I use the eject script.
One could always just run the sdparm command to flush the disk also. I just find a single script easier to run than remembering
what to tell sdparm.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum