Thursday, 10 March 2016

Format a memory card back to its original size

After using an SD card to install Kali Linux on Raspberry Pi, I decided I had to reformat it to its original size. If you try to do this using the format tool on Windows you won't be able to format your card. 

The best way to do this, if you want to use Windows, is to start the command prompt and use the diskpart command line tool. Insert your memory card and follow the instructions below.

Start the command prompt and run the command: diskpart
This will open up a new command prompt window similar to the following screen.



Type list disk to list all of your connected disks (drives). In order to select the disk (memory card) use the command select disk # (where # is the number that represents the memory card). 
As you can see above, after typing list disk, you can see a list of drives (disk) connected to the system. Disk 0 is the 250 GB Solid State Drive, and Disk 1 is the 32 GB memory card. Thus, we need to select Disk 1, which is the memory card we want to format. 

After typing select disk 1 and listing the disks once again with list disk, you will notice a star (*) next to Disk 1 which means it has been selected. Effectively, any commands executed after this stage will affect only the selected disk, which means Disk 1

Make sure you have selected the correct disk before running the following command!

You can now type clean and hit enter. This will clear the partition table on the card, allowing you to see the whole capacity as it should. 

Now you need to create a primary partition in order to reuse all the available space on the card. You can do this by typing create partition primary and hit enter.

One last step to go. You can now format the memory card. To do this simple type format fs=fat32 quick and hit enter*. Type exit to, exit the diskpart command line tool. 

Remove your card safely from your system. 

* This is optional but if you want to reassign a drive letter type assign. 

No comments:

Post a Comment