FormatUSB is a modern, powerful graphical tool for formatting USB drives and removable storage devices on Linux systems. Built with Qt5/6 and C++20, it provides an intuitive, safe, and user-friendly interface for formatting USB drives with various filesystem options.
Important Note: FormatUSB is a Linux desktop application that requires an X11/Wayland display server, root privileges, and physical USB hardware access. While the code can be developed and compiled in cloud environments (like Replit), the application must be run on a local Linux system with physical USB devices.
- Features
- System Requirements
- Installation
- Usage
- Supported Filesystems
- Safety Features
- Building and Development
- Troubleshooting
- Project Structure
- Changelog
- Contributing
- License
- Credits
- π¨ Modern GUI: Clean, contemporary design with intuitive controls
- πΎ Multiple Filesystem Support:
- FAT32 - Universal compatibility (Windows/Mac/Linux/Android)
- NTFS - Windows native with large file support
- ext4 - Linux native with optimal performance
- exFAT - Cross-platform with large file support
- π Automatic Device Detection: Intelligent USB device detection with multiple methods
- π‘οΈ Advanced Safety Features:
- System drive protection to prevent accidental formatting
- Removable device filtering
- Confirmation dialogs before destructive operations
- βοΈ Partition Table Options: Support for GPT, MBR/MSDOS, and automatic selection
- π·οΈ Custom Volume Labels: Set custom names for your drives with filesystem-specific validation
- π Internationalization: Supports 50+ languages
- π¦ Embedded Resources: CHANGELOG and assets bundled directly in the binary
- β‘ Fast & Efficient: Multi-threaded device detection and formatting
| Distribution | Minimum Version | Status |
|---|---|---|
| Ubuntu | 18.04 LTS | β Tested |
| Debian | 9 (Stretch) | β Tested |
| Linux Mint | 19 | β Compatible |
| Elementary OS | 5.0 | β Compatible |
| Pop!_OS | 20.04 | β Compatible |
| Fedora | 30+ | β Compatible |
| Arch Linux | Latest | β Compatible |
| Other Debian-based | - |
- RAM: Minimum 512 MB (Recommended: 1 GB+)
- Disk Space: 10 MB for application
- Display: X11 or Wayland display server
- USB Port: For devices to be formatted
Required:
- Qt5 β₯ 5.9 or Qt6 (Core, GUI, Widgets modules)
- C++ Compiler with C++20 support (GCC 7+, Clang 10+)
- X11 or Wayland display server
- Root/sudo privileges for formatting operations
System Tools:
parted- Partition table manipulationlsblk- Block device listingudevadm- Device information (optional, fallback)
Filesystem Tools (install as needed):
mkfs.vfat(dosfstools) - For FAT32mkfs.ntfs(ntfs-3g) - For NTFSmkfs.ext4(e2fsprogs) - For ext4mkfs.exfat(exfatprogs or exfat-utils) - For exFAT
Ubuntu/Debian/Linux Mint:
# Update package lists
sudo apt update
# Install build tools and Qt5
sudo apt install -y \
build-essential \
gcc \
g++ \
make \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools \
pkg-config \
git
# Install system utilities
sudo apt install -y \
parted \
dosfstools \
ntfs-3g \
e2fsprogs
# Install exFAT support (choose one)
# For modern systems (Ubuntu 20.04+, Debian 11+):
sudo apt install -y exfatprogs
# Or for older systems (Ubuntu 18.04, Debian 9-10):
sudo apt install -y exfat-fuse exfat-utilsFedora/RHEL/CentOS:
sudo dnf install -y \
gcc \
gcc-c++ \
make \
qt5-qtbase-devel \
git \
parted \
dosfstools \
ntfs-3g \
e2fsprogs \
exfatprogsArch Linux:
sudo pacman -S --needed \
base-devel \
qt5-base \
git \
parted \
dosfstools \
ntfs-3g \
e2fsprogs \
exfatprogsVerify Dependencies:
# Check Qt5 installation
qmake --version
# Expected: QMake version 3.x, Using Qt version 5.x
# Check compiler
g++ --version
# Expected: g++ 7.0 or newer
# Check system tools
parted --version
lsblk --version# Clone from GitHub
git clone https://github.com/dezuuu12/FormatUSB.git
# Enter project directory
cd FormatUSB# Generate Makefile with qmake
qmake src.pro
# Compile with make (use multiple cores for speed)
make -j$(nproc)
# Result: 'formatusb' executable will be created in current directoryExpected Output:
...
g++ -Wl,-O1 -o formatusb main.o mainwindow.o about.o cmd.o ...
# Check executable file
ls -lh formatusb
# Expected: -rwxr-xr-x ... 160K ... formatusb
# Check version
./formatusb --version
# Expected output: Version: 1.1.0If you don't want to do manual installation steps, use the provided installation script:
# Make sure FormatUSB is built first
make
# Run the installer
sudo ./install.shThis will automatically:
- Copy the binary to
/usr/local/bin - Copy required libraries to
/usr/lib/formatusband/usr/local/lib/formatusb - Install icons and desktop entry
- Update the desktop database
make to generate formatusb) before running install.sh.
Verify Installation:
which formatusb
# Expected: /usr/local/bin/formatusb
formatusb --version
# Expected: Version: 1.1.0From Source Directory:
# Run directly from build folder
sudo ./formatusbIf Installed System-Wide:
# Run from terminal
sudo formatusb
# Or find in application menu: System β FormatUSBImportant Notes:
β οΈ Application requires root privileges for formatting operations- If prompted for password, enter your user password
- Use polkit/pkexec for automatic privilege escalation
- Connect the USB drive you want to format
β οΈ BACKUP ALL IMPORTANT DATA from the USB drive- Launch FormatUSB application (
sudo formatusb)
- In the "Select Target USB Device" dropdown, choose the correct device
β οΈ CHECK CAREFULLY - ensure you select the right USB device!- Tip: Check the capacity and device name to verify it's your USB drive
Additional Options:
- βοΈ Show all devices - Display all storage devices (
β οΈ DANGER! Can show internal drives) - βοΈ Show partitions - Display individual partitions instead of whole devices
| Format | Max File Size | Max Volume Size | Compatibility | Best Use Case |
|---|---|---|---|---|
| FAT32 | 4 GB | 2 TB | Windows/Mac/Linux/Android | USB for small files, maximum compatibility |
| NTFS | 16 TB | 256 TB | Windows/Linux (read-only on Mac) | Windows USB, large files (>4GB) |
| ext4 | 16 TB | 1 EB | Linux only | Linux-only USB, best performance |
| exFAT | 16 EB | 128 PB | Modern Windows/Mac/Linux | Modern cross-platform USB, large files |
Recommendations:
- πΎ General purpose, maximum compatibility: FAT32 (if all files < 4GB)
- π₯ Large videos, ISOs, archives: exFAT or NTFS
- π§ Linux-only usage: ext4 (best performance)
- πͺ Windows-only usage: NTFS
- Defaults - Let the system choose automatically (recommended for most users)
- MBR/msdos - Compatible with old BIOS and legacy systems
- GPT - Modern standard, recommended for drives > 2TB
- Enter a custom name for your USB drive
- Allowed characters vary by filesystem:
- FAT32: A-Z, 0-9, _, - (max 11 characters)
- NTFS: A-Z, 0-9, _, ., -, space (max 32 characters)
- ext4: A-Z, 0-9, _, ., - (max 16 characters)
- exFAT: A-Z, 0-9, _, ., -, space (max 15 characters)
- Examples:
MYUSB,Backup_2025,Data Drive
- Click the "Next" button
β οΈ CONFIRM the operation in the warning dialog- Wait for the formatting process to complete (progress shown in output log)
- Check the output log for any errors
- β SUCCESS! - Safely eject the USB drive when complete
- Pros: Universal compatibility, works on all operating systems
- Cons: 4 GB file size limit, 2 TB volume limit
- Use Case: USB drives for transferring small files between different systems
- Pros: Large file support, native Windows filesystem, journaling
- Cons: Limited Mac support (read-only without additional software)
- Use Case: Windows-centric environments, large files
- Pros: Best performance on Linux, journaling, large file support
- Cons: Not natively supported on Windows/Mac
- Use Case: Linux-only USB drives, backup drives
- Pros: Modern cross-platform support, large file support, no 4GB limit
- Cons: Requires modern OS versions
- Use Case: Modern cross-platform USB drives, large media files
- β Formatting PERMANENTLY DESTROYS all data on the selected drive
- β Deleted data CANNOT be recovered
- β Always backup important data before formatting
- β Double-check device selection before confirming
- π‘οΈ System Drive Protection - Automatically prevents formatting of system drives (root
/and boot partitions) - π‘οΈ Removable Device Filtering - Only shows removable/USB devices by default
- π‘οΈ Multiple Confirmation Dialogs - Requires explicit confirmation before destructive operations
- π‘οΈ Device Verification - Uses multiple methods to verify USB devices (lsblk, udevadm, /sys/block)
- π‘οΈ Process Monitoring - Logs all operations for debugging and verification
- β Always verify device selection before formatting
- β Backup important data before any formatting operation
- β Test the USB drive after formatting by copying test files
- β Never unplug the USB drive during formatting
- β Use "Show all devices" option only when absolutely necessary
- β Safely eject the USB drive after formatting completes
- Build Tool: qmake (Qt Meta-Object Compiler)
- Compiler: GCC 7+ or Clang 10+ with C++20 support
- Qt Version: Qt5 (5.9+) or Qt6
# Clean previous build
make clean
# Generate Makefile
qmake src.pro
# Build (parallel)
make -j$(nproc)
# Build (single-threaded for debugging)
make
# Clean everything including generated files
make distclean# Install development tools
sudo apt install -y \
git \
valgrind \
gdb \
qtcreator \
clang-format- Follow Qt coding conventions
- Use modern C++20 features where appropriate
- Add comments for complex logic
- Keep functions focused and single-purpose
Error:
Error: Permission denied
Cannot access /dev/sdb
Solution:
# Run with sudo
sudo ./formatusb
# Or if installed system-wide
sudo formatusbError:
error while loading shared libraries: libQt5Core.so.5
Solution:
# Install Qt5 runtime libraries
sudo apt install -y qtbase5-dev libqt5widgets5 libqt5gui5 libqt5core5a
# Or install Qt5 full
sudo apt install -y qt5-default # For older Ubuntu/DebianSymptoms: Device dropdown is empty or USB doesn't appear
Solution:
-
Check USB Connection:
# List all block devices lsblk # Check USB devices lsusb # Check system log for USB events sudo dmesg | tail -20
-
Try Different USB Port
-
Enable "Show all devices" (
β οΈ Be careful!) -
Check udev rules:
ls -l /dev/sd*
Error:
Error: Failed to create filesystem
Solution:
-
Unmount device first:
# Check mounted partitions mount | grep sdb # Unmount all partitions sudo umount /dev/sdb*
-
Verify filesystem tools are installed:
# Check available mkfs tools ls /sbin/mkfs.* # Install missing tools sudo apt install dosfstools ntfs-3g e2fsprogs exfatprogs
-
Check device for errors:
# Check device status sudo parted /dev/sdb print # Check for bad blocks (warning: slow!) sudo badblocks -v /dev/sdb
Error during compilation:
Solution:
# Clean build artifacts
make clean
rm -f Makefile moc_* ui_* qrc_*
# Regenerate Makefile
qmake src.pro
# Rebuild
make -j$(nproc)Missing Qt headers:
# Install all Qt5 development packages
sudo apt install -y qtbase5-dev qtbase5-dev-tools qt5-qmakeApplication logs are saved to:
/tmp/formatusb.log
For debugging, monitor the log file in real-time:
tail -f /tmp/formatusb.logFormatUSB/
βββ src.pro # Qt project configuration file
βββ Makefile # Generated by qmake (after build)
βββ formatusb # Compiled executable (after build)
β
βββ main.cpp # Application entry point
βββ mainwindow.cpp # Main window logic
βββ mainwindow.h # Main window header
βββ mainwindow.ui # Qt Designer UI file (GUI layout)
βββ about.cpp # About dialog implementation
βββ about.h # About dialog header
βββ cmd.cpp # Command execution wrapper
βββ cmd.h # Command execution header
βββ version.h # Version definitions (1.1.0)
β
βββ images.qrc # Qt resource file (embedded assets)
βββ CHANGELOG.txt # Application changelog (embedded in binary)
βββ README.md # This file - User documentation
βββ LICENSE # GPL v3 License
β
βββ lib/
β βββ formatusb_lib # Core formatting library (Bash script)
β
βββ images/
β βββ FORMAT.png # Screenshot
β βββ logo.svg # Application logo
β
βββ translations/ # Internationalization files
β βββ formatusb_en.ts # English
β βββ formatusb_id.ts # Indonesian
β βββ formatusb_de.ts # German
β βββ formatusb_fr.ts # French
β βββ formatusb_es.ts # Spanish
β βββ formatusb_zh_CN.ts # Chinese (Simplified)
β βββ formatusb_ja.ts # Japanese
β βββ ... (50+ languages)
β
βββ debian/ # Debian packaging files
β βββ changelog # Debian changelog
β βββ control # Package dependencies
β βββ copyright # Copyright information
β βββ install # Installation rules
β βββ rules # Build rules
β βββ source/
β βββ format # Source format
β
βββ polkit-actions/ # PolicyKit rules
βββ org.usbformat.pkexec.formatusb.policy
Major Update:
- β Updated copyright to danko12
- β Updated repository URLs to https://github.com/danko1122q/FormatUSB
- β Modernized codebase with enhanced error handling
- β Improved build system compatibility with Replit environment
- β Enhanced comprehensive English documentation
- β Fixed compilation warnings
- β Enhanced USB device detection algorithm
- β Improved user interface with modern styling
- β Better safety checks for system drive protection
Technical Improvements:
- Enhanced multi-method USB device detection (lsblk, udevadm, /sys/block)
- Improved error handling in formatting library
- Modern C++20 features usage
- Better Qt5/Qt6 compatibility
- Cleaner code structure and organization
Changes:
- β Added comprehensive health check script
- π Updated documentation with detailed installation guide
- π§ Improved README with troubleshooting section
- π Converted all documentation to English
Changes:
- β Removed license button from about dialog (cleaner UI)
- π¦ Embedded CHANGELOG.txt into application resources
- π Improved resource management and portability
Changes:
- π Initial release after fork from MX Linux FormatUSB
- π Enhanced USB detection
- π¨ Modern GUI with compact design
- π Updated copyright
- π οΈ Improved error handling
Contributions are welcome! Here's how you can help:
- Open GitHub Issues
- Check if the bug is already reported
- Create a new issue with:
- OS & Version: Ubuntu 22.04, Debian 12, etc.
- Qt Version: Output from
qmake --version - Steps to Reproduce: Clear steps to trigger the bug
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Logs: Output from
/tmp/formatusb.log - Screenshots: If applicable
- Fork the repository
- Clone your fork:
git clone https://github.com/danko1122q/FormatUSB.git
- Create feature branch:
git checkout -b feature/amazing-feature
- Make changes and test thoroughly
- Commit with descriptive messages:
git commit -m "Add: Support for F2FS filesystem" - Push to your fork:
git push origin feature/amazing-feature
- Create Pull Request on GitHub
- Follow Qt coding conventions
- Use modern C++20 features where appropriate
- Add comments for complex logic
- Test on multiple Linux distributions
- Update documentation for user-facing changes
- Ensure code compiles without errors
This project is licensed under GNU General Public License v3.0.
FormatUSB - USB Drive Formatting Tool
Copyright (C) 2025 danko12
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
See LICENSE file for complete details.
- danko12 - Lead Developer & Maintainer
- MX Linux Team - Original FormatUSB implementation
- James Bowlin (BitJam) - live-usb-maker utilities
- Qt Framework - Excellent GUI toolkit
- GNU Project - Core utilities
- Linux Kernel - USB and block device support
- GitHub Repository: https://github.com/dezuuu12/FormatUSB
- Issues & Bug Reports: GitHub Issues
- Email: formatusb1122@gmail.com
If this project is useful to you, please give it a β on GitHub!
Made with β€οΈ for the Linux community by danko12
FormatUSB is an open-source tool developed to make formatting USB drives on Linux safe, easy, and intuitive.
