Building a Secure Portable Ubuntu Environment (Part 1)

May 6, 2023 - Reading time: 15 minutes

Hardware BLUF:

  • CPU: Intel Core i9-11980HK and above, AMD Zen 7xxx and above

  • USB Drive: SanDisk Extreme PRO Portable SSD V2

"Physical access trumps cybersecurity" - Bruce Schneier

Ubuntu’s latest installers make it easy to deploy encrypted Linux boxes. And there exists a number of guides already out there about how to build a live Linux USB drive. There also exists guidance on how to properly secure Ubuntu Linux from the start. But there is very little out there about how to do all of this at once.

My goal for this initial series of blog posts is to outline the process of creating a secure (meaning encrypted), portable (meaning contained on a portable USB drive), Ubuntu environment that conforms to a high standard of hardening. We will start with some basic hardware selection advice, talk about the initial setup and installation, discuss additional hardening, and finally we will go over maintenance and disposal.

Selecting the right USB Drive

We could literally write a hundred posts about the performance implications of whole-disk encryption, especially as we are dealing with a USB drive whose encryption/decryption will be performed by the CPU and not some dedicated hardware. Paul-Philipp Kuschy discovered whopping performance hits on flash I/O when using dmcrypt[1], and that was with an AMD server-grade CPU. We will put CPU selection aside for a moment, but keep in mind that performance always comes at a cost.

The most important thing to understand in selecting a suitable USB drive is that the actual disk I/O performance will be less than the maximum speed of the USB specification. And as much as it should be considered false advertising, many drives are advertised at the USB-spec speed. So if a drive advertises itself as 5 Gbit/s or 10 Gbit/S, that is most likely the speed of the USB spec, not the drive itself.

Because USB 2.0 is limited to 480 Mbit/s, we should only consider USB 3.1 or USB 3.2 drives. From my experience, a minimum of 1 Gbit/s is needed if you hope to maintain a decent user experience. That leaves only a handful of options, of which here are three:

The Kingston and SanDisk Extreme Portable meet our minimum performance requirement. The SanDisk Extreme PRO Portable, which I have personally used in this application, is capable of double the performance at 2 Gbit/s. Which one you choose should be based on the CPU you pair it with.

So which CPU should I use?

We’ve established that the faster your raw disk performance, the more CPU power will be needed. And with mitigations for the Spectre vulnerabilities wrecking the performance of some CPUs more than others, we have to look at which specific CPUs have the highest AES encryption performance for your given disk I/O.

My recommendation is that your CPU not spend more than 40% of its capacity performing encryption calculations. Based on CPU benchmarks[2], if you intend on using the SanDisk Extreme PRO, then you should use a CPU scoring higher than 5000 MiB/s in AES 512b encryption. As of this writing, those CPUs are:

  • Intel Core i9-13900K

  • Intel Core i5-13600K

  • AMD Ryzen 7 7700X 8-Core

  • AMD Ryzen 9 7900X 12-Core

  • Intel Core i9-12900K

  • AMD Ryzen 5 7600X 6-Core

  • Intel Core i5-12600K

  • Intel Core i9-11980HK

  • AMD Ryzen 9 7950X 16-Core

  • Intel Core i5-13400


If you already have a system you intend to use for this application, its existing CPU should drive which USB drive you choose. Using a high-speed USB drive with a CPU that can’t keep up, will be worse than a moderate-speed USB drive with the same CPU.

In the next post we will look at hooking everything up, booting into Ubuntu live, and performing the initial installation.