1

I wanted to get portable working Ubuntu on the go, so I got a USB stick (DT50/64) about 100MB read speed by the spec and installed (persistent installation, not a live USB) Ubuntu 18.04 on it. Even during installation I noticed that the process took a lot longer than I expected it would take. After installation I realized how slow it is. Long boot time and it constantly hangs when it is working. I noted that USB stick heats a lot while it works. After some googling I have disabled swap file, switched logs to RAM, but still the system works really slowly in this setup.

So I wonder what is bottleneck in this case? Is it the USB drive as it is, is it slow USB drive speed, USB port limitations, would I gain much more speed if I used an external USB SSD?

btw, I'm plugging into a USB 3.0 port.

Update: as a conclusion of all answers here, the bottleneck is in USB Stick technology itself, but not in USB port, and a cheap external SSD should give me acceptable speed of work (something like an internal HDD or even better). I will update this thread as soon as I get SSD and test system on it. (external SSD)

Update: Thanks to @thomasrutter. I did find an old HDD with USB pocket for it and that is what I've got after some tests:

  1. gdisk benchmark shows R/W: 105/80 MB/s for my USB stick and 44/40 for HDD connected to USB. Despite visible overcome in average speed USB stick graphics had a sawtooth pattern (jumps to top speed and to bottom through all the timeline) and the HDD had a stable "line".
  2. Installing Ubuntu on a USB stick takes more than 30 min. and less than 10 min. on an HDD (connected to a USB port)
  3. Booted from a USB stick Ubuntu after tweaks like: noswap, disabled logs... works like a slowpoke - constantly hangs for a while. HDD works pretty good, can without distractions clone git repositories and install node modules, apps work pretty fast and they start quite fast too.

Conclusion: I'll choose some mid SSD with a pocket and will use it.

karel
  • 114,770
  • My understanding is that Ubuntu mainly runs in RAM, if you have enough, Opening a program the first time takes a few seconds but second time should be fast and working in it should also be fast. – C.S.Cameron Aug 20 '18 at 22:51
  • But it simply didn't, I have 16 gb ram 1900 freq, but feel myself like I'm using tetris. – Dmitry S. Aug 20 '18 at 22:55
  • Search this site for "optimize usb" and apply those you think applicable. – ubfan1 Aug 20 '18 at 23:15
  • As I wrote - I already did that. It become a little faster but far away from what I've expected from it. – Dmitry S. Aug 20 '18 at 23:31
  • The 100MB read are sequential for larger files. For good primary drive performance, you need good random read/write and good IOPS. You don't get those on most thumb drives and they are terrible when used as Ubuntu primary drive. – Bernard Wei Aug 20 '18 at 23:41
  • Have you tried booting toram? when booting press shift and then F6, type toram. – C.S.Cameron Aug 20 '18 at 23:49
  • For the second part of your question, an external SDD with USB 3.0 will feel like a very fast internal HDD. It won't be native SDD speed but plenty fast. – Bernard Wei Aug 20 '18 at 23:58
  • You can benchmark your flash with GNOME Disks utility to get results for your flash. Run it from other Ubuntu system and connect flash as data storage (not on-the-go boot drive). – N0rbert Aug 21 '18 at 07:45
  • You can get faster loading performance from a USB stick using a read-only filesystem like squashfs merged with tmpfs (ie, no changes are permanent), this is basically what live CDs / live USBs are. Write speed won't be an issue and read speed is accelerated by the compression. But as I said in my answer, an external SSD or a USB stick that acts like one (eg Sandisk Extreme USB 3.0 64GB) will overcome all this. – thomasrutter Aug 21 '18 at 23:56
  • I must say most USB sticks are slower than molasses in January but I used a San Disk USB 3.0 Extreme or Ultra last go around and it was faster than an internal HDD. Not as fast as my NVMe SSD M.2 Gen 3.0 x 4 Samsung Pro 960 but still plenty fast enough IMHO. – WinEunuuchs2Unix Aug 23 '18 at 02:22
  • I have the same problem as you, maybe it can help you : https://askubuntu.com/questions/1445054/why-running-a-full-distro-linux-from-usb-stick-is-so-slow/ – untitled Dec 11 '22 at 08:28

2 Answers2

2

The bottleneck is specifically the random write speed of the drive.

For read-only workloads, USB sticks are fast. For continuous writing, USB sticks are fast (enough). But for random writing, they are very, very slow.

Here's a typical speed test of a USB stick:

Note how in the right column, the write speed of 512KB blocks is poor (less than 2MB/s) but the write speed of 4KB blocks is very poor (less than 0.03MB/s)! Your system drive needs to be able to do frequent small writes for temporary files, logging, and caching (eg by web browsers) and these activities choke up a USB stick.

This particular drive also has fairly slow random 4K read speed too, but at 0.76 MB/s that is still an order of magnitude faster than 4K writes.

By comparison here's the result from a typical SSD:

An SSD uses wear-levelling and write remapping, sophisticated techniques which both prolong drive life and drastically speed up writes.

For comparison, traditional HDDs are about 1.0 - 1.5MB/s at 4K writes. SSDs became practical as system drives once they reached that performance level (which they've now surpassed many times over).

There are some rare USB sticks (such as recent models in the Sandisk Extreme range) which use SSD-like techniques to achieve respectable speeds, but these cost a premium and 99.9% of USB sticks in use do not do this. When comparing drive performance it can be useful to Google for CrystalDiskMark benchmarks of the drive.

thomasrutter
  • 36,774
-1

I Agree with @user535733 - I/O speed. The flash tech used in these little thumb drives as pretty cheap stuff - you get what you pay for unfortunately and the manufacturer probably isn't focused on the users trying to boot from them - even with high-end desktops / PCI - USB3 isn't all that great compared to SATA. You cloud try an "NVMe PCIe" drive and USB3 NVMe PCIe enclosure (just have to check the details and make sure the enclosure is high end)

I'm sure most of them will be very fast though.

https://www.amazon.com/Samsung-970-EVO-250GB-MZ-V7E250BW/dp/B07BN5FJZQ/ref=sr_1_1?s=electronics&ie=UTF8&qid=1534807995&sr=1-1&keywords=samsung+nvme+pcie

https://www.amazon.com/KINGSHARE-USB3-0-External-Enclosure-SATAIII/dp/B076DYH5NC/ref=sr_1_fkmr1_1?s=electronics&ie=UTF8&qid=1534808107&sr=1-1-fkmr1&keywords=nvme+pcie+m.2+usb3+enclosure

Jaso
  • 13