Member-only story
đź§˝ How to Format a USB Drive in NixOS (The Simple Way)
đź’ˇ This guide is for beginners using NixOS who just want to clean or reformat a USB stick.
So you’re using NixOS and you want to format a USB drive — maybe to reuse it, erase everything on it, or make it readable on Windows or macOS. But since NixOS does things differently, it can feel confusing. Don’t worry — formatting a USB is still pretty easy.
Let’s walk through it step by step.
🔍 Step 1: Find Your USB Drive
Plug in your USB stick and open a terminal. Then run:
lsblk
You’ll see a list of drives. Look for your USB drive by its size. It might look like this:
NAME SIZE TYPE MOUNTPOINT
sda 512G disk
├─sda1 512G part /
sdb 16G disk
└─sdb1 16G part /run/media/you/USB
In this case, sdb
is the USB. Be very careful here — don’t pick your main drive (like sda
) or you’ll wipe everything!
📦 Step 2: Unmount the USB (If Needed)
Before you can format the drive, you need to unmount it. Run:
sudo umount /dev/sdX1
Replace sdX1
with your actual USB partition (e.g., sdb1
).