Score:1

Why running a full distro linux from usb stick is so slow?

cr flag

I installed ubuntu 22.10 on my USB stick and then boot it, but it seems to be very slow. I use USB 3.0 and the read/write speed is more than 100MB/s, however, the system boot very slow and when running apt install or apt remove, it seems to be very slow too.

Then I tried to create a VMWare machine with the VMDK file on the USB stick and reinstall ubuntu on VMware, it runs much faster than installing the full system on USB, it is so strange. Is that the Linux USB 3.0 driver slower than windows?

I also find this: What actually slows down Ubuntu running from USB stick

C.S.Cameron avatar
cn flag
How much RAM do you have? With lots of RAM Ubuntu will run in RAM, which is much faster than SSD. Opening a program for the first time in a session and saving will of course take a little longer. (ie reading and writing to disk). https://askubuntu.com/questions/1238927/benchmark-ubuntu-persistent-usb-vs-installed-system
guiverc avatar
cn flag
Did you actually install it? or just write the ISO / *squashfs* system to the thumb-drive (*which many people do refer to as installing it, but no installer is used; it's just written to the media in a usable form for purposes of installation*), as it makes a ***huge*** difference. One reads data that can be acted/executed instantly; the other requires processing before it can acted-on/executed...
untitled avatar
cr flag
@guiverc I'm sure I installed it, boot the iso then run install program, choose usb disk to install, then boot with usb.
C.S.Cameron avatar
cn flag
@guiverc: I have done a bit of benchmarking. With a lot of RAM I have not found much difference in operating speed between a Persistent install on USB2 flash drive and a Full install on SSD drive. Definitely not a **huge** difference except perhaps when saving to disk. This is easy to confirm.
Rishon JR avatar
pl flag
It's not a driver issue or some kind of USB issue. It's something to do with the RAM or the BIOS. It can also be that your Hard drive could be slow(Vmware uses virtualised hard disk which is compressed, hence its faster to write)
Score:1
cr flag

I am now fixed this problem after changing a lot of parms in this post: https://unix.stackexchange.com/questions/30286/can-i-configure-my-linux-system-for-more-aggressive-file-system-caching

Now running apt install/remove is super fast. I am not sure which parm work. I will try later. I now find it, I use zfs filesystem, when I set sync to disabled, it seens to be fast:

zfs set sync=disabled rpool
reboot

However, I don't know how to deal with ext4. On ext4 can mount with nobarrier options, and it will be fast.

iBug avatar
tr flag
Using ZFS on a USB stick is a really strange setup to me.
untitled avatar
cr flag
because ZFS can compress. My usb read/write speed is a little slow, I want to use more cpu to exchange IO speed. @iBug
iBug avatar
tr flag
Well, ZFS does a *lot* more than just compressing. Under normal operation, ZFS requires more seeking than a "traditional" FS like ext4 and XFS, but seeking is not a task an average USB stick is good at. Behind the scenes ZFS employs a sophisticated caching scheme, so it's more suitable on a server or something you run 24/7 and rarely reboot. Btrfs *might* do better for you but I've never used it.
C.S.Cameron avatar
cn flag
Have you tried just booting the USB install `toram`? With 20.04 and a normal Live boot the file check took over 2 minutes on my computer, booted `toram` file check took less than 6 seconds.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.