I am working on another project and whilst doing so, I was reintroduced to a kind of irritating problem with Desktop Linux. Nothing huge, just annoying enough. Formatting Removable or USB media. This is one area where I agree with the statement that Linux is not as easy to use as Windows. The Linux solutions work but it seems to lack some elegance.
Method #1: The Terminal
Before you start issuing any Format commands, be sure you know what the device name is. The way I prefer is by inserting the drive into the computer and and run in terminal:
dmesg
You’ll see a lot of text and toward the end look for something that reads like:
[109951.128820] sd 6:0:0:0: Attached scsi generic sg3 type 0
[109951.128995] sd 6:0:0:0: [sdc] No Caching mode page found
[109951.128997] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[109951.135052] sdc:
[109951.136745] sd 6:0:0:0: [sdc] Attached SCSI removable disk
That tells me that the device name is sdc and I know that it is mounted under /dev. So this USB drive is /dev/sdc
to verify run:
df -h
If your computer mounted the drive you can take a look at the listing. Somewhere you should see the last drive you plugged in along with the Size of the drive, How much is Used, How much Available, Use of drive as a percentage and where if anyplace it is mounted. In my case:
Filesystem Size Used Avail Use% Mounted on
/dev/sdc 7.5G 946M 6.6G 13% /run/media/cubiclenate/XFER
For the following examples, replace the “X” with your particular drive letter.
Next you need to ask yourself, do you wish to share the contents of this drive with non-Linux machines. If the answer is “yes” than you will need to format in FAT or NTFS.
Format with FAT or in this case VFAT
sudo mkfs.vfat /dev/sdX
Format with NTFS (New Technology File System), more common since Windows XP
sudo mkfs.ntfs /dev/sdX
If this drive is just for you and your Linux buddies, go with a Linux file system. They are “better” in many ways.
Format with EXT4 File System
sudo mkfs.ext4 /dev/sdX
Or, if you are feeling it, go with XFS
sudo mkfs.xfs /dev/sdX
This process isn’t hard just not as straight forward to a new user and if you don’t spend your life in the terminal, these commands can easily be forgotten.
Method #2: Quick USB Formatter
A more graphical, KDE Plasma, friendly feeling option is this USB Format application. This is not in the Official openSUSE repositories.
https://software.opensuse.org/package/quick-usb-formatter
What is nice about this application is that it is very straight forward. After installation, just typing USB will bring this up in the menu / quick launcher as “USB Format”. The executable is located here:
/usr/bin/quickusbformatter
The interface is very straight forward, you select the device, in this case /dev/sdc and it will NOT allow you to select your system drives so there is no shot at making a mistake here. You can select the file system but XFS is not an option. There is a field to type in a label if you so choose as well.
Downside to this interface is that you can’t manage the partitions should you want to delete or add partitions on this drive. Also note, I am not able to format anything in the build in SD Card reader. If these are not a concern then this may be a fine solution for you.
Method #3: Gparted
Perhaps my preferred method for managing storage medium is Gparted. This is the Gnome Partition Editor and is one of the finest pieces of software I have ever used. It just does everything I need to do in a nice, intuitive, easy to use and extremely powerful tool for managing disks. It is described as an “industrial-strength” application for for creating, destroying, resizing, moving, checking and copying partitions, and the filesystems on them.
Gparted is available for both Tumbleweed and Leap, to install:
sudo zypper in gparted
This “do everything tool” for your disks will require root privileges and rightfully so. You can create space on disk for new operating systems, or even copy the file systems.
This has access to all the drives on the system, mounted or not. Also note that modification to SD Cards, as expected, is also not an issue.
This application is fantastic in how you an resize and move partitions around on a drive. The designers have taken great care in paying attention to the finer details of disk interaction.
After you are satisfied with the disk modifications, you commit to the changes by a check box labeled “Apply All Operations”.
Gparted also removes all ambiguity in what is supported with each file system. There is a great report you can review under View > File System Support.
Final Thoughts
Managing USB or Removable media isn’t exactly the most straight forward if you are new to Linux. This might not be true for all distributions or desktop interfaces but my experience on KDE Plasma over many years has been as such. Maybe it shouldn’t be a straight forward process as a user should know what they are doing before they start making any changes to any pieces of hardware and maybe it is also a non-issue as most removable media is already formatted and ready to go.
If you have any other thoughts on interacting with removable media. Please share, I am interested in knowing if there are other or better options out there.
3 thoughts on “USB or Removable Media Formatting in Linux”