SD cards play a special role for Linux desktop users. Yes, they serve as a way to store photos or videos and bring both to your hard drive. They also provide an easy way to expand how many files you can carry on the laptop.
But in many cases, these little squares of portable storage are all you need to turn your Windows or macOS machine into a Linux box in the first place.
There are several ways to configure and manage your SD card, either from the command line or using a handful of graphical applications. Here’s how you do it.
What is a partition manager?
A partition is a region of digital storage space. This can be your entire hard drive, but isn’t always the case. Dual booters will have one part dedicated to whatever Linux distribution is installed, and the other allocated to Windows.
Some use partitions to keep their operating system separate from their personal files. Typically, Linux-based OSes also have a separate partition for swap.
A partition editor is a tool for managing these partitions. These are the ones you use to format, create new partitions, or duplicate the SD card.
SD cards usually come with a single partition, but you can split a 32 GB card into two 16 GB ones if you prefer.
Here you can see a 32GB card inserted into a Linux computer running GNOME Disks.
You’ll get a long list of results, so this approach is recommended for people who already have some idea of what they’re looking for.
Some desktop environments and distributions come with their own partition editors. GNOME Disks (pictured above) integrates with the GNOME desktop, while KDE users will want KDE Partition Manager. Many distributions still use GParted. All do essentially the same thing.
If you are looking for a software that does not require additional software to be installed and works in Linux distribution, then dd is your best option. This command-line tool makes backing up and image writing to your SD card a straightforward, one-line task. But you need to be careful as one wrong command can erase the contents of your entire hard drive.
format sd card on linux
Partition editors will usually give you the option of selecting a partition and formatting it into a new one. If you want to give away or recycle a card, you can choose to completely erase all of its contents.
This process takes some time, so if you just want to clear the data on the card so you can put more stuff on it or intend to turn it into a bootable Linux drive, it’s fine to choose the faster option.
When you do this you have to choose a partition type. The FAT format will work on a variety of desktop operating systems, and that’s how most SD cards start their lives. Chances are, this is the option you want.
To wipe the card using the command line, we turn to dd. The command below will erase all data from your card and replace it with zeros. It’s not impossible to recover data erased this way, but most people won’t be able to do it.
In the dd command, the if parameter determines the source of the data. Indicates the destination of. Here, we are copying zeroes to /dev/sdc . As mentioned above, replace it with whatever location your computer assigns to your card.
After running this command, you may need to create a new partition. Maybe even two.
create a separate partition
Creating a separate partition from the one you are currently using is a risky way to lose data. To play it safe, back up your data and start fresh. – Erase your current partition by tapping on the icon or selecting the option from the menu. Then tap on the + icon or select the relevant menu option to create a new menu.
Repeat this process for as many partitions as you want to create.
If you want to do it from the command line, you can go to fdisk to do the magic.
Back Up an SD Card on Linux
The most straightforward way to back up your SD card is to open a file manager and copy the files to a folder on your computer. But this method is not the best if you want to create identical copies or store multiple backups.
In that case, you want to create a partition image. Chances are, you can find this option in your partition editor.
The above command backs up the contents of your SD card to an IMG file in your Home folder, allowing you to restore an identical copy later.
You must have free space on your hard drive equal to the size of the SD card, which means that a 32GB card will consume 32GB on your computer. Waiting for the task to complete may take some time, and it will appear that dd has stopped working. just be patient.