loading...

Linux Mint – Formatting flash drives

How to configure nginx for Joomla

In the earlier versions of Mint, there was no official method of formatting flash drives. Users typically would download and install a third-party utility (such as gparted) to format flash drives. Thankfully, a new graphical application (USB Stick Formatter) is included, beginning with Linux Mint 16.

Accessing this application couldn’t be simpler. To format a USB stick using this graphical tool, simply right-click on the icon shown for your flash drive and click on Format. Then, choose a label, click on Format, and that’s it. Once the format is done, you’re all set. The following screenshot shows the Linux Mint USB formatter window:

It goes without saying, but make sure you format the correct device. If you use more than one flash drive, you could format the wrong one. Additionally, if you use command-line tools to format a USB stick, it’s very easy to format your main device accidently, thus resulting in data loss. Take your time, and also ensure that you have current backups before formatting any file system, just in case.

As with most activities in Linux, if there’s a way to do it in the GUI, there’s also a way to do it via shell commands (and vice versa). If a desktop environment isn’t available to you or you prefer command-line tools, read on for another method to format your flash drive.

First, ensure that your flash drive is not mounted (in use). If you are using a desktop environment, look for an Eject icon next to the flash drive in Nemo. If it’s there, click on it to safely remove the device. If you’re not using the GUI, you can try the following commands instead.

To determine the device name of your flash drive, execute the following command before and after inserting your flash drive:


sudo fdisk -l

Compare the output. The device that shows up after inserting your flash drive but does not show up in the output before inserting it is probably the drive you’re looking for. It should be fairly easy to determine which entry is the flash drive you wish to format using the process of elimination. In most cases, you’ll definitely want to leave /dev/sda alone. Others that show up on the list may be removable devices. Try comparing the size of the devices against your flash drive, and the one that is your target should immediately become apparent. For example, if /dev/sdc is a 4 GiB partition in the fdisk output and your flash drive is 4 GB, chances are that it’s the one you’re looking for. Unless you have more than one 4 GB flash drive inserted, in this case, /dev/sdc would be the device you would want to format. The following screenshot shows the terminal output from the fdisk command:

To unmount the device, look at the partition number. A flash drive typically only has a single partition; in this case, /dev/sdc1. (Additional partitions might be /dev/sdc2, /dev/sdc3, and so on, but this is not common with flash drives.) The following command would unmount the flash drive:


umount /dev/sdc1

(replace sdc1 with the partition number in the fdisk output).

Now, you’re ready to format your device. Use the mkfs command in the following format to do so:


mkfs.ext2 /dev/sdc1

In the preceding command, replace ext2 with the filesystem type you would like to use. However, ext2 is more than sufficient for most uses. The ext2 filesystem doesn’t include the added overhead of the ext3 filesystem. It is also more stable than newer filesystems such as ext4. With a maximum size of 32 TB, it will be quite some time until typical removable media sizes outgrow ext2.

Next, give your flash drive a label (if desired). This can be done using the following command line:


sudo e2label /dev/sdc1 "My Label"

Again, replace sdc1 with the device name of your flash drive. Finally, give your user account access to the entire drive using the following command line:


sudo chown username -R /media/username/nameofdevice

If you’re using Cinnamon, it’s preferable to use the graphical USB Stick Formatter in order to format your flash drive as it is simpler to use; however, for those who wish to become Linux administrators, learning the command-line methods is recommended.

Comments are closed.

loading...