Chris Mendez in For Developers, Security, Encryption

How to encrypt a USB thumb drive on Mac OS High Sierra using Command Line

Here's how to encrypt a USB thumbdrive with HSF+ (Journaled) using Disk Utility and Terminal.

Warning

This will teach you how to encrypt your drive as HFS+ (Journaled). Do not follow these steps if you want to encrypt using APFS.

Step 1 - Insert a USB drive and Open up Terminal

step-01-open-terminal

Step 2 - List Your Drives

Our first step is to list our all of our available drives. This includes our main hard drive as well as the USB thumb drive. Using terminal, type this command.

diskutil list

You should see something really scarry like this.

step-02-diskutil-list-1

In order to find our USB thumb drive, we'll need to look for some clues.

Clue 1 - Look for something that says external, physical. This means it's an external, physical drive.

Clue 2 - Look for something that matches the name of your USB thumb drive. My drive is currently titled "STORE N GO".

step-02-diskutil-list-highlighted

Take node of the "IDENTIFIER". My identifier is titled disk2s1 and that is the drive and partition we will be formatting.

Step 3 - Reformat

This command is telling Apple's Disk Utility to erase the disk and format it for Mac OS Extended, Journaled Hierarchical File System Plus (JHFS+).

Take note that the only reason why this process is work is because we are making a GUID partition map (GPT).

diskutil eraseDisk JHFS+ "My New Storage" GPT disk2

Step 4 - Encrypt

This final step is to encrypt the file partition with the disk identifier disk2s2.

diskutil cs convert disk2s2 -passphrase

step-03-reformatt


Resources