Ubuntu LiveUSB becomes slow after adding persistant memory

V

vakken

Guest
I have recently made a ubuntu liveusb without persistency. it was fast, i liked it more than windows, so i wanted some persistency, although when i created a second liveusb this one with persistent memory it was very slow, everything was as slow as it was a windows installation used and uncleaned for 5 years. it was very slow.
Preceeding questions. I cannot install it to my hard drive. it must be on that very pendrive.

Why is it slow?
How to make it fast again?
Maybe i should use other distro, if yes, then wich one?
 


The problem here is to do with USB read/write speeds. The read/write speeds on USB devices vary wildly from device to device. But in all cases, their write speeds are much slower than their read speeds. Especially with USB1 and USB2 devices. I think the write speeds are a bit better with USB3 devices, but only when plugged into USB3 ports.

Without persistence, data is only ever read from the USB drive, so it is blazingly fast.

As soon as you add persistence and the OS starts writing to USB, that's when things slow down. If you encrypt the persistent volume, it will slow it down even more (thanks to the performance hit you'll take from the on-the-fly encryption/decryption of data.)

If you want to use a persistent USB install, this is something you have to live with. When the system is undergoing heavy disk usage and there are a lot of simultaneous reads and writes going on, things will inevitably slow down. Shockingly so at times. You just have to live with it. Basically, under heavy disk use, programs start hanging while they wait for their data to be written to disk. Or while they are waiting to read from the disk. When this happens, it all seems like it's the CPU that's being thrashed, or that you are running out of memory, but in fact it's just programs waiting to read from/write to disk.

The only real form of mitigation would be to try to find a USB device with faster read/write speeds to install Linux onto - assuming that your USB ports are able to use the device at those speeds too!

Ultimately, the speed of the USB device and the supported speeds that your USB ports can use are the biggest factors.

You could also try using a distro with a less resource hungry wm/desktop environment, that might help. In the past, I've found that Crunchbang worked really well on USB. I used to use that via a 'live with persistence' style install and also with a more traditional 'HD style' install on my USB thumbdrives back when the HD on my old laptop died.

But sadly Crunchbang is no more. Since Phil/Corenomial announced the end of the Crunchbang project, some of the Crunchbang community have started working on forks/alternatives. But I just haven't had time to check any of them out yet. So I can't really comment on them. I'm sure the others here will be able to point you towards some slightly lighter distros that work well on USB thumbdrives.

I did also have Arch installed on another USB drive with dwm as the wm. That worked really well too. But Arch is more of an advanced distro. You might want to take a look at Arch when you have a bit more experience using Linux. Installing Arch is an education in itself and will teach you a lot about Linux.

In all cases, regardless of the distro: When using a USB install - If it writes to disk, whether it be 'Live with persistence' or a traditional HD style install - it will be slower than a pure Live installation with no persistence. It's just a limitation of using USB!
 
Interesting, as I'm experimenting with Ubuntu on one USB and Mint on another. With a persistence volume, Ubuntu boots very slowly then is so slow to respond it's unusable, Mint on the other hand is fast to boot and works fine. Mint is on a 4 year-old 8G usb, Ubuntu is on a brand new one.
 
Hmm, that’s a shame. Playing with a live boot of Kali 2020.2. It’s a bit laggy now and then with persistence enabled but generally pretty good. With encryption enable though I can only do one thing at a time and still have to be very patient. Almost unusable.
 
I got Live OS Mint Cinnamon 64 bit with 1gig persistence on a usb and found i almost as fast as OS on H.D i used Ventoy
 
I’ll have to look up a bit more on Ventoy, haven’t heard of it before (quite new to the scene).
 
I've seen the same issue, and I suspect on another computer where I though X was hung with persistence mode it probably was just very slow, to the point I gave up waiting.

It' not just much slower, it's *nonsence slower*, and it's not even about the fact there is more write to it, my USB3 flash becomes about 1000 times slower even for direct reads from the device! Booting up the OS takes longer than it took writing the whole image to the usb flash!

I don' have time to troubleshoot but I suspect something very wrong is happening within the unionfs driver...
 

Some USB 3.0 devices support "Super Speed" (some don't). But even this is only 480 MB per sec.
And that's only "burst mode" for short writes.
But in real life, the sustained speeds are closer to 85MB per sec.


NVME drives on the other hand, support 2GB per sec. (sustained)

85MB per sec vs 2000MB a sec. More than 20x faster.
 
@dos2unix
morning.. don't know if you spotted the poster has commented on an dead thread from last year

Bwiz
 
Heck, scroll up. It's a "more than 6 years old" thread.
 
Unfortunately this thread is still quite current. I understand there are better usb pendrives than others, but even in my case it wasn't the cheapest, just a cheap Kingston one.

To rule out unionfs I did a normal install on USB, even with the whole system preloaded with libeatmydata (all sync calls disabled... except syncfs() which was reported and fixed already) it was barely usable.

Switching to F2FS instead of Ext4 led to much better results, and I think it would be of utmost importance that F2FS be added to the stock livecd's initramdisk so that it could be used for persistence (it wasn't there on Debian's livecd at least).

The main difference is that F2FS optimize writes so that they are better aligned to the strength of slow flash devices - doing large sequential writes rather than small random ones. Unlike many other flash filesystems it is designed to work on an existing translation layer; it's not meant for direct MTD access.
 
Unless you can explain why it would run better that others - of course there are simpler flavors, and likewise I can built my system from a minimalist distro, or even boot without GUI, but even that was slow. In the end once the usb is booted up and running I'll face the same issues with whatever tool I need to use if my usb is too slow and the FS isn't optimized for it.

Does it at least support F2FS as root drive or persistence partition ? TBH I'm not even sure Debian officially does, but you can always stick the module to the initramdisk and recreate the FS in F2FS... I basically converted the swap partition to /boot on ext2 (because grub2 doesn't support f2fs), dumped the root using dump2fs, loop-mounted the image and rsync'ed all files back onto a freshly formatted F2FS root... then updated grub and initramfs.

libeatmydata help a lot too, but of course I can end up with GB's on unwritten data (depending on sysctl tunings) that I'll loose if power fails or I pull the usb.. I'm just hoping the fs won't crash miserably because of it, and even if it does those are not used for anything important anyway.
 

Members online


Top