Different ways to format SD Card in Linux
Working with Linux can get a little complicated, especially if you are a new user migrating from a platform like Windows. Getting yourself familiar with the new file manager, file system permissions, and even the numerous Terminal commands can be a little challenging for a start. However, that shouldn't scare you away. Linux is an excellent platform with many advantages over other platforms. When working with drives on your Linux system (USB, SD cards, external Hard drives, etc.), you might find yourself in a situation where you need to format them. Linux has multiple methods that you can apply.
In this article, we are going to explore how you can format an SD card on Linux using three different methods:
- The File Manager
- Fdisk command-line utility
Method-1: Format SD Card Using the File Manager
It is one of the easiest methods to format an SD card since you don't need to launch any third-party utilities or execute any Terminal commands. However, it comes with limited options and features compared to utilities like Gparted or Fdisk, which we will look at further in this post.
To get started, insert your SD card in the SD card and launch the file manager. You should see your SD card listed on the left, as shown in the image below.
Right-click on the SD card and select the Format option as shown in the image below.
That will open the "Format volume" window, which contains several options you can use:
- Volume Name: Here, you can enter the name you wish to call your SD card
- Erase: This is an optional feature that overwrites all the existing data. This option is meant to prevent any data recovery procedure but takes much longer.
- EXT4: For use with Linux systems
- NTFS: For use with Windows systems
- FAT: For use with all systems and devices
- Password protect volumes (LUKS): This option allows you to encrypt your SD card using LUKS, the standard disk encryption in Linux systems.
After selecting your options, click Next. You will see a warning screen showing all the choices you have chosen. If you are unsure of anything, you can click the Previous button to go back. Otherwise, click the red Format button to start the formatting process.
After the format process is complete, you should see the SD card appear on the file manager with the new name you assigned it.
Method-2: Format SD Card Using Gparted
Gparted is a free, open-source graphical partition editor. With GParted, you can create, modify, delete, unmount, Format, and perform many more actions on partitions and any connected drives. Gparted is a cross-platform utility available for Kali Linux, Windows, and macOS operating systems. Follow the steps below to get started with GParted.
Step 1: Install GParted.
Gparted comes pre-installed in distribution like Kali Linux; however, for other Linux distributions, you will need to install it manually by executing the command below on the Terminal.
sudo apt install gparted
Insert the SD card into the memory card reader, then insert it to the USB port of your pc or laptop. Now launch GParted by using either Terminal or Application menu. For the Terminal, you can use the command below.
While for Application Menu, search for Gparted in the applications menu, then click on it to launch the application. A window will pop up requiring you to enter the root password to authenticate Gparted. Type the password and click Authenticate.
Step 2: Gparted Window
On starting GParted, you will see a window similar to the image below. By default, Gparted will select the internal hard drive of the computer.
The first thing to do after starting Gparted is to search for available Devices. On the menu bar, Click on GParted.A drop-down menu will appear. Click Refresh Devices.
Selecting Storage device to Format
To select your SD card, go to the top-right corner, select SD card. The devices will be displayed based on their storage sizes; in my case, my SD card, which I want to format, is 16 gigabytes.
After making sure you have a backup copy of your data, proceed by Right-Clicking on the sd card then choosing Format to set up the file system. You can select the disk file format you want according to your preferences. In my case, I will choose fat32. If the format option is greyed out, you will first need to unmount the SD card on your system by selecting the unmount option.
At the bottom of the window, you can see all the pending operations. Click at the tick (✔) sign at the top of the window to apply all the pending operations. A dialog box will pop up, warning against the operations you are about to take. To proceed, click Apply.
The formatting process will start. Wait for a few seconds. When done, you should the message "All operations successfully completed." Click Close.
That's it! You can now close the Gparted window and check the formatted SD card on your file manager window.
Method-3: Format SD Card Using Fdisk
The two ways we have looked above are both graphical methods. Now, we will look at one powerful command-line utility which you can use to format your SD card and any other drives connected to your PC - fdisk. The Fdisk utility, also commonly referred to as "format disk," is a Linux command-line tool for formatting and carrying out other disk operations. Luckily, it comes pre-installed in most Linux distributions.
Execute the command to list all the available drives connected to your system and their partitions to get started.
sudo fdisk -l
You will see a long list of all devices on your system, and it can get quite confusing at times to point out your target device. However, there is a trick. Linux will list all connected drives as
/dev/sdc and so on.
/dev/sda is always the internal drive of your system or the drive which contains the running OS. SD cards might be listed with a different name from /sda.
From the image above, you can see our SD card is listed as
To get started formatting your SD card, use the syntax below.
sudo fdisk [sd-card-label]
sudo fdisk /dev/mmcblk0
You will see an interactive window similar to the image below.
To list all the available options, type "m" and hit enter.
At this point, we need to enter the available options to format our SD card.
- d: To delete all existing partitions
- n: To create a new partition
- w: To write the changes and exit
That's it. When you navigate to the file manager window, you should see your newly formatted SD card listed on the left.
We have looked at three different methods you can use to format your SD card. From experience, I highly recommend Gparted because it comes with so many options, and it also features an easy-to-use user interface. Additionally, Gparted has an ISO file that you can use to boot your PC and manipulate the drives and partitions. That can come quite in handy if you are dealing with a crashed system. Please feel free to share your experience and hit the comments below if you encounter any issues.