# FreeBSD running from USB Memstick



## Phishfry (Dec 6, 2019)

I have my ZFS storage system up and running and now I am going to put it to use for backing up my machines.
My plan is to use FreeBSD 12.1 installed onto a USB stick and copy over NFS to my storage machine.
I bought several USB sticks as I have some machines UEFI and some Legacy installs and planned on using 2 sticks.
One UEFI and one for Legacy machines. I don't want to mess around with the BIOS.

What I have found was surprising.
I started with my UEFI machines so I made a UEFI FreeBSD install onto the USB stick using GPT.
The install took a real long time and loading my preferred packages onto it took almost 20 hours.
It seems to lag quite a bit so I did a quick speed check with `diskinfo -t /dev/da0` and it showed 25Mb/sec.
That seemed appropriate as these are 16GB USB2 disks and that speed is normal.

So then I made a Legacy BIOS installation onto the same exact type USB stick with GPT and it too was slow.
Packages took around the same time and the speedtest showed similar numbers.

So frustrated, I decided to re-do my Legacy stick with a MBR install and it only took 8 hours to load all my packages.
Speedtest shows 25Mb/sec but the system also feel less laggy.

Can anyone shed some light on this? Maybe I need to align the sectors on a GPT install or something.


----------



## aragats (Dec 6, 2019)

I always align partitions to 1MiB boundaries. Although, AFAIK, the actual storage blocks may be of 4MiB ― you can try that number.
Are you using ZFS on your USB sticks? It's noticeably slower than UFS.


----------



## Phishfry (Dec 6, 2019)

aragats said:


> Are you using ZFS on your USB sticks? It's noticeably slower than UFS.


No just stock UFS2.

I might end up ditching the GPT for my FreeBSD on USB sticks altogether and just alter the BIOS to Legacy BIOS when backing up..
It really makes it unusable. I was just configuring my Xfce4 desktops and just deleting toolbar items the GPT stick seems to delay any actions by a few seconds. While the MBR stick acts right and deletes the icons immediately.
Everything about the GPT USB install feels laggy but the MBR sticks acts like an actual FreeBSD disk installation. Just a tad slower.


----------



## Phishfry (Dec 6, 2019)

While installing packages on the GPT stick I noticed that the fetching phase seemed fine, it was the installation phase (Not extraction) that was really slower.


----------



## k.jacker (Dec 6, 2019)

From my experience, modern triple/quad level USB sticks seem to struggle with writing lots of small files. It starts with extreme slow writing until they finally die. I managed to kill brand new USB sticks by just installing FreeBSD and then fetching a ports tree or the sources.
On the other hand I have som older and much smaller USB sticks on which I have been running FreeBSD for years without any slow down or fails.
I‘d rather grab a USB to mSATA converter, buy cheap mSATA drives and avoid all those crappy USB sticks.

I have never seen any difference with e.g. Softupdates or MBR vs GPT.


----------



## aragats (Dec 6, 2019)

k.jacker said:


> From my experience, modern triple/quad level USB sticks seem to struggle with writing lots of small files.


I guess, not just writing. Most of those modern USB sticks are not recognized by _u-boot_ (in ARM-based systems) because they are too slow to initialize, I had to recompile _u-boot_ with extra delay added before trying to read them. I always prefered SanDisk as most reliable USB sticks until they came up with those modern Glide/Blade/whatever flavors which has many issues for advanced usage.


----------



## Deleted member 30996 (Dec 6, 2019)

aragats said:


> I always prefered SanDisk as most reliable USB sticks until they came up with those modern Glide/Blade/whatever flavors which has many issues for advanced usage.



I bought 10 32GB Blades at $5 each while I had the chance. I have never had a USB stick fail and still use a couple Lexar 1GB sticks for installing FreeBSD.


----------



## aragats (Dec 6, 2019)

Sure, they are good USB sticks for everyday use, no doubts. However, their multiple layers of hardware/firmware make them unsuitable for any advanced usage.
The installing _FROM_ is okay, but the OP is trying to install _ON_ a USB stick.


----------



## Phishfry (Dec 6, 2019)

SanDisk is what I am using.
I had a FreeBSD 11.x stick I used previously with FreeBSD installed on it. I had zero problems with it.

Glad you mentioned mSATA-USB adapters. I actually have a 120GB M.2 SATA module I have been meaning to mount into a USB adapter I bought.
This might be a good way to compare times..


----------

