A USB drive is small, useful and very easy to lose. If it holds client files, family photos or personal documents, anyone who finds it can read everything. This guide shows how to encrypt a USB drive on Linux using LUKS, the standard disk encryption format. You need about fifteen minutes, a drive you can erase, and a passphrase you will remember.
Table of contents
LUKS stands for Linux Unified Key Setup. It is the common way to encrypt storage on Linux, and cryptsetup is the tool you use to work with it. Once a drive is encrypted, it asks for a passphrase before it can be mounted. Without that passphrase, the contents look like random data. That is the whole idea behind how to encrypt a USB drive on Linux: you lock the contents, not just the drive.
Two limits are worth knowing. First, LUKS works natively on Linux, so Windows and macOS will not open the drive without extra software. Second, encryption protects a drive that is locked or lost. It does not protect files from malware while the drive is unlocked and in use. For the wider picture of protecting stored data, see our business data security checks.
Think about where your drive travels: a bag, a train seat, an office desk, a courier parcel. Losing it is common, and a lost drive without encryption is an open book. With encryption, a finder sees an unreadable disk. This matters for freelancers, students and small teams in India who carry client work, certificates or scanned documents, and it takes only minutes to set up. Learning how to encrypt a USB drive on Linux is one of the cheapest security upgrades you can make.
The commands below suit Debian and Ubuntu. Replace the values in angle brackets with your own. If you are new to Ubuntu commands, our Ubuntu setup guide shows the same calm, step-by-step style.

dnf instead of apt.
sudo apt update
sudo apt install cryptsetup
sdb with a partition named sdb1. Check the size matches your drive.
lsblk
sudo umount /dev/<usb-partition>
YES in capital letters when asked, then set your passphrase. This erases the partition.
sudo cryptsetup luksFormat /dev/<usb-partition>
/dev/mapper.
sudo cryptsetup open /dev/<usb-partition> <mapper-name>
sudo mkfs.ext4 -L <drive-label> /dev/mapper/<mapper-name>
sudo mkdir -p /mnt/<mount-folder>
sudo mount /dev/mapper/<mapper-name> /mnt/<mount-folder>
sudo chown "$USER": /mnt/<mount-folder>
When you finish, always lock the drive before pulling it out.
sudo umount /mnt/<mount-folder>
sudo cryptsetup close <mapper-name>
Many Linux desktops also offer a point-and-click option in the Disks app, where you can format a drive with LUKS. The result is the same format. As an optional extra, back up the LUKS header and keep the copy away from the USB drive, because header damage can make data unreadable. Treat that file as private, since it relates to your drive’s keys.
sudo cryptsetup luksHeaderBackup /dev/<usb-partition> --header-backup-file <backup-file>
For a clear overview of LUKS on external storage, read the opensource.com guide to protecting external storage with LUKS.

Most problems when you learn how to encrypt a USB drive on Linux come from a few avoidable mistakes.
lsblk every time. This is the costliest mistake.Not with the method above, which formats the partition. Copy your files elsewhere, encrypt the drive, then copy them back.
LUKS is open source, widely used and publicly reviewed. Its real strength still depends on your passphrase and your habits, which is why how to encrypt a USB drive on Linux is as much about care as commands, such as locking the drive and keeping your system updated.
On modern computers the slowdown is usually small, though results vary by processor and drive. You can run cryptsetup benchmark to see how your machine performs.
Not natively. Third-party tools exist, but support varies. If you move between systems often, use a cross-platform format, and read the cryptsetup FAQ to understand the trade-offs.
Knowing how to encrypt a USB drive on Linux gives you a small act of care for your future self. Back up first, choose the right device, protect your passphrase and lock the drive after use. Do those four things and a lost USB drive becomes an inconvenience instead of a worry.
What do you keep on your USB drives, and have you ever lost one? Share your experience in the comments.
The Nandan Sinha newsletter
Get new articles on technology, practical guides, wellbeing and spirituality, delivered to your inbox.
Subscribe by email. Confirm your address to join. Unsubscribe anytime. Privacy policy.
We use essential cookies to run this website and optional cookies for analytics and advertising. Choose Accept All, Reject, or Preferences to manage optional cookies. You can change your choice at any time.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Google's current Sign in with Google client library. It renders the Google sign-in button, or the One Tap prompt, so visitors can log in to your site with their Google account. It replaces the older Google Sign-In platform library.
Service URL: policies.google.com (opens in a new window)
Google Tag Manager simplifies the management of marketing tags on your website without code changes.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.
AddToAny provides share and follow buttons that let visitors post your pages to social networks, messaging apps, and bookmarking services.
Service URL: www.addtoany.com (opens in a new window)
You can find more information in our Privacy Policy and Privacy Policy.





Leave a Reply