Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just got a micro sd card that I plan on using with the Raspberry Pi. I used the KDE partition manager to delete the original partition on the card and to write a new 12GiB ext4 partition. After doing this, the card still says that 6% of it, 30.02 MiB, is being used. Basically, I want to completely wipe of the card of all contents so as to prepare it for a new OS. Would a command like shred or dd do the trick or would that destroy the partition as well?

share|improve this question
    
I am biased, but if you want full control of partitions, don't use graphical partitioning, use the good old fdisk. (Unless you can't because of GPT or other technical restrictions.) –  CijcoSistems Aug 15 at 1:20
    
By the way... does RaspberryPi support loading the kernel from ext4 directly? I remember using FAT for the early boot process (kernel, cmdline, SoC configuration and memory split), and then having the root filesystem on another partition (or NFS if you like) –  CijcoSistems Aug 15 at 1:25

2 Answers 2

If you just made a new partition, there shouldn't be any actual files on it. That 30MB is probably just the filesystem itself. The partition needs a few different tables and whatnot to actually keep track of files.

You can double check that there really isn't anything on it by looking for hidden files with ls -alph from the command line or be enabling hidden files in the "View" menu of Nautilus.

Depending on exactly how you invoke the commands, it is likely that using shred or dd would indeed overwrite the partition table and/or filesystem.

share|improve this answer

Your guessing about dd is right. You can wipe the SD card out by the following command (let's assume, that your SD card is /dev/sdd):

$ sudo dd if=/dev/zero of=/dev/sdd bs=8192

It can take some time depending on size and speed of SD card. If you are convinced, that CIA would like to recover your files, then overwrite the SD card with urandom instead of zero:

$ sudo dd if=/dev/urandom of=/dev/sdd bs=8192

dd command from above examples will erase whole SD card, leaving it without any partitions, even with no partition table. So you will need to recreate partition on SD card. You can do this by any partitioning tool like cfdisk, parted (my recommendation) or gparted.

And one more thing: be extremely careful when calling dd command. A typo in of= argument value can cause disaster.

share|improve this answer
    
If you are worried about CIA, you should use /dev/random and do it like 5 to 10 times... not to mention that you should also burn it in the oven, catch on fire and bury it deep in the ocean :P –  CijcoSistems Aug 15 at 1:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.