Stickwash is a terminal-only CLI utility for inspecting, relabeling, and rebuilding removable USB drives on Linux.
It resolves common partitions and partition tables left behind by bootable ISO writers (e.g. Arch, Ubuntu, Ventoy) and restores USB sticks to clean single-partition volumes (ext4, exFAT, or FAT32).
- Zero External Third-Party Python Dependencies: Built entirely using Python 3 standard library modules (
struct,json,subprocess,fcntl,dataclasses). - Built-in Native FAT32 & exFAT Engines: Formats and relabels
FAT32andexFATdirectly in pure Python without needingdosfstools(mkfs.fat) orexfatprogs(mkfs.exfat) installed. - Automated USB Discovery: Detects removable USB block devices with model, size, serial number, and partition layouts.
- Root & Mount Safeguards: Refuses to format drives backing system mounts (
/,/boot,/home,/var,/usr,/etc, or swap). - Subcommands & Interactive TUI: Run interactively without arguments, or use non-interactive CLI commands (
list,inspect,wipe,relabel). - Dry-Run Mode: Simulate wiping or relabeling operations using
--dry-runto inspect exact terminal commands before execution. - JSON Output: Export device and partition structures with
--jsonfor scripting and automation. - User Permission Handover: Automatically mounts formatted volumes for the invoking
$SUDO_USERunder/run/media/$SUDO_USER/<label>or/mnt/<label>.
python3(>= 3.10)util-linux(lsblk,findmnt,wipefs,umount,mount)sfdisk/udev(sfdisk,partprobe,udevadm)
No external Python packages or filesystem tools (dosfstools, exfatprogs) are required. ext4 formatting uses system mkfs.ext4 (e2fsprogs), while FAT32 and exFAT formatting engines are built directly into Stickwash.
Run stickwash as root to open the interactive wizard:
sudo ./stickwashList all removable USB drives:
stickwash listExport layout in JSON format:
stickwash list --jsonInclude internal non-removable disks:
stickwash list --allDisplay detailed partition table and mountpoints for a specific block device:
stickwash inspect /dev/sdcWipe signatures, write a fresh GPT table, and format a primary partition:
sudo stickwash wipe /dev/sdc --fs exfat --label SHAREDATA -ySimulate wiping with --dry-run:
stickwash wipe /dev/sdc --fs ext4 --label DATA --dry-runWipe and automatically mount after formatting:
sudo stickwash wipe /dev/sdc --fs ext4 --label LINUXUSB --mount -yRelabel an existing partition without reformatting:
sudo stickwash relabel /dev/sdc1 --label BACKUP- Destruction Protection: Never touches devices backing
/,/boot,/home, or active swap partitions. - Device Path Typing: Interactive wiping requires explicitly re-typing the full target device path (e.g.
/dev/sdc). - Removable Drive Filtering: Rejects non-removable internal drives unless explicitly overridden with
--force.
stickwash/
├── README.md # Documentation and usage guide
├── pyproject.toml # Package metadata and test runner config
├── stickwash # Executable entry point launcher
├── stickwash_lib/ # Modern Python library
│ ├── __init__.py # Package version
│ ├── cli.py # Argument parsing and interactive TUI controller
│ ├── disk.py # lsblk/findmnt JSON parsing & system mount safeguards
│ ├── formatters.py # Parted/wipefs/mkfs execution & tool detection
│ └── ui.py # ANSI TrueColor styling, tables, & live spinners
└── tests/ # Unit test suite
├── test_cli.py
├── test_disk.py
└── test_formatters.py
Run the unit test suite:
python3 -m unittest discover -s tests