In this guide, we go through the steps to format an SD or USB disk in Linux. This can be done via GUI or command line, and we'll cover the process for both. The guide will be applicable regardless of what Linux distribution you've decided to use, especially the command line method.
This will wipe all the data from your USB or SD disk and get it ready for use under Linux or another system. It's also used to clear the device before creating a bootable live USB drive.In this tutorial you will learn:
- How to format an SD or USB disk via GUI
- How to format an SD or USB disk via command line
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Format SD or USB disk via GUI
Depending on what Linux distribution you're using, the screenshots below may not match up with exactly what you see on your own screen. We're using Ubuntu Linux in these steps, but the process should be mostly the same no matter what distro you're on. The key point is that you'll need to find and open your operating system's disk utility software.
- Once you have inserted the SD or USB disk into the computer, get started by opening your system's disk management application.
- You should see your SD or USB disk listed among the other storage devices on your system. Make sure you select the one that you wish to format.
- You'll have several options on what to do with this drive. Click the one that says "Format Disk" or something similar.
- On our test system, we have a few different options for erasing and partitioning our USB thumb drive. A quick format won't securely erase the current data on the disk but it will perform the formatting very quickly, as the name implies. The other option is to rewrite the disk with all zeros (not necessary in the majority of situations). You can also create a MBR or GPT table, or apply no partitioning. If you're not sure, just leave the defaults selected and click "Format."
- As mentioned earlier in the guide, this process will completely erase the contents in your SD or USB disk. The formatting software warns us once again to make sure we're aware, then it wipes the drive completely.
The UAF Geophysical Institute, is looking for an experienced Linux Systems Analyst to join their team of research cyber infrastructure analysts and engineers. LOCATION: Fairbanks, Alaska, USA
That's all there is to it. If you chose the quick format option, the whole process should only take a matter of seconds. If you'd like to learn how to do this via command line, which is more universal across all Linux systems, we cover that in the next section.
Format SD or USB disk via command line
Once you've inserted the SB or USB disk into your computer, open a terminal and type the following commands to format it:
- First, let's figure out how to identify the media we wish to format. The name should start with
/dev/sdand then a letter. Type the following command in terminal to see:
$ sudo fdisk -l
- In our example, the USB disk has been assigned
/dev/sdb. Use the
mkfs command to format the disk with any file system you'd like. In this example, we're using ext3:
$ sudo mkfs -t ext3 /deb/sdb
That's all there is to it. You can also specify things like ext2, ext3, ext4, fat32, ntfs, etc. If no file system is specified with
-t, the device will be formatted as ext2.
In this guide, we saw how to format an SD or USB stick on Linux. The process is simple and can be done either via GUI or command line. The steps are pretty much the same on any Linux distro, though each disk utility may have a different name and have some different looking menus.