Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Is there a way to misconfigure USB ports in the kernel?
Date: Wed, 31 Mar 2021 11:21:54
Message-Id: 808599453.0ifERbkFSE@lenovo.localdomain
In Reply to: Re: [gentoo-user] Is there a way to misconfigure USB ports in the kernel? by Dr Rainer Woitok
1 On Tuesday, 30 March 2021 18:11:56 BST Dr Rainer Woitok wrote:
2 > On Saturday, 2020-12-05 19:07:51 +0100, I myself wrote:
3 >
4 > ("> >" refers to Michael <confabulate@××××××××.com>)
5 >
6 > > Michael,
7 > >
8 > > On Friday, 2020-11-27 19:07:17 +0000, you wrote:
9 > > > ...
10 > > > A 4k block size is recommended for ntfs-3g which is the default sector
11 > > > created by fdisk and friends on Linux these days. This will align your
12 > > > partition optimally. In addition, mkfs.ntfs will use 4096 bytes as the
13 > > > default cluster size, so you should be good in that respect.
14 > > >
15 > > > Another setting you may want to try is mounting the USB with
16 > > > 'big_writes' -
17 > > > check the man page. This should help particularly with large files,
18 > > > which
19 > > > will use larger blocks up to 128KB when copying data to the NTFS.
20 > >
21 > > Both, the VeraCrypt command line (--fs-options=big_writes) and the Vera-
22 > > Crypt GUI (under "Settings --> Preferences") allow setting this mount
23 > > option. But
24 > >
25 > > $ mount | grep veracrypt
26 > >
27 > > never shows it, initially causing me to erroneously believe it wasn't
28 > > set and to try finding on the web another way of setting it. By pure
29 > > chance I finally found out that
30 > >
31 > > $ ps -ef | grep veracrypt
32 > >
33 > > lists a "/usr/sbin/mount.ntfs" task which shows the options really in
34 > > effect. However, I haven't yet had the time to test the effect of this
35 > > option when writing plenty of really big files. I will report on that
36 > > later.
37 >
38 > Well, it's been quite a while, due to my being almost permanently con-
39 > fronted with more pressing tasks ... :-(
40 >
41 > To sum up my experience with my new 128 GB Philips USB 3.0 sticks: while
42 > the Philips sticks are significantly faster for reading operations than
43 > my old 64 GB Verbatim ones (probably USB 2.0), writing operations to the
44 > Philips sticks are unbearably slow, regardless of whether I created a
45 > normal unencrypted NTFS filesystem on them or an encrypted NTFS filesys-
46 > tem using VeraCrypt. Writing to the USB stick while at the same time
47 > reading from it in a different terminal window caused commands like "cd"
48 > or "ls" to simply stall. Thus while running
49 >
50 > $ cp --preserve=timestamps -ru $source_dir .
51 >
52 > in one terminal window, I ran
53 >
54 > $ while true
55 >
56 > > do n=$(ps -ef|g 'cp --preserve'|g -v grep)
57 > >
58 > > if [[ "$n" = "${o-}" ]]
59 > > then sleep 10
60 > > else o="$n"
61 > >
62 > > echo "$n"
63 > >
64 > > fi
65 > >
66 > > done
67 >
68 > in another, to get the wall clock times when copying a new file began.
69 > That way I found that copying a 30 MB file took about 40 minutes.
70
71 OK, unless you made a typo and the "minutes" were meant to say seconds, this
72 is ridiculously slow.
73
74 You could run some tests to see what is causing the delay. The veracrypt
75 algos & cipher iterations, the fuse based ntfs-3g, or the USB stick's
76 controller.
77
78 However if, as I understand it, all other variables are the same and the only
79 change was to replace your Verbatim 64G USB 2.0 sticks with Philips 128G USB
80 3.0 sticks, then the slow writes point to the Philips devices being the
81 culprit.
82
83 Some years ago I tested some USB 2.0 sticks of various sizes, from 256M up to
84 32G and recall the smaller the USB stick the faster the write performance, so
85 differences in writing speed are normal. The writing speed you're describing
86 however is a clear indication of something being wrong.
87
88
89 > So what are my options?
90 >
91 > - Stay away from Philips USB 3.0 sticks?
92 >
93 > - Stay away from Philips USB sticks in general?
94
95 Without knowing the internals, a brand may offer only an unwarranted
96 assumption of performance. We saw Western Digital disks being sold as CMR,
97 while having SMR internals. A brand could switch OEM suppliers, or
98 components, making benchmarking unreliable.
99
100
101 > - Stay away from USB 3.0 sticks in general?
102
103 USB 3.0 is faster and USB 3.2 when available will be even faster. So use
104 whatever the USB ports on your PC offer.
105
106
107 > - Stay away from Filesystem in User Space using a non-stable 5.10 or
108 > 5.11 kernel (currently I'm using stable 5.4.97)?
109 >
110 > - Stay away from Gentoo?
111 >
112 > - Stay away from Linux in general and go back to OTOS (aka the Only
113 > True Operating System aka Windoze)?
114 >
115 > - ...?
116
117 In-kernel fs drivers are measurably faster than fuse based fs for well
118 understood reasons. However, if needs must and the fs you require is not
119 available on Linux, then some compromise will be required.
120
121
122 > Any ideas and comments welcome ...
123 >
124 > Sincerely,
125 > Rainer
126
127 You may want to run some tests on the sticks you have, if only to bottom out
128 what their performance is on different PCs and USB ports:
129
130 dd if=/dev/zero of=/run/media/<USER>/<STICK_LABEL>/TESTFILE bs=512
131 count=600000 oflag=direct conv=notrunc,fsync status=progress
132
133 Use a large enough file to make sure the USB controller cache gets saturated.
134
135 You could use a ramdisk/tmpfs as an input file.
136
137 If you write directly to the device as Dale suggested it will wipe data, so
138 keep a backup of anything you need first.
139
140 You can experiment with different filesystems and in the first opportunity
141 with a different make of USB 3.0 stick. You'd soon be able to determine how
142 good the real world performance can get and if the Philips or something else
143 is causing the problem you've experienced.
144
145 A note about UDF: it works and it is versatile - but ensuring
146 interoperability between different OSs can be tricky. Check some suggestions
147 here:
148
149 https://askubuntu.com/questions/27936/can-and-should-udf-be-used-as-a-hard-drive-format
150
151 and here:
152
153 https://superuser.com/questions/39942/using-udf-on-a-usb-flash-drive
154
155 Ultimately such tests are an attempt to eliminate methodically all other
156 factors, until you isolate the cause of the problem you are experiencing.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Is there a way to misconfigure USB ports in the kernel? Dale <rdalek1967@×××××.com>