LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't remove partition on sd card (https://www.linuxquestions.org/questions/linux-newbie-8/can%27t-remove-partition-on-sd-card-4175586275/)

iFunction 08-04-2016 10:42 AM

Can't remove partition on sd card
 
Hi there,

trying to use fdisk to remove a partition on an sd card but it won't budge. I have a 32Gb sd card, that claims 28Gb free, so on typing df -h, there is an old partition I named "test" sitting there as a boot partition on the disk.

Run fdisk /dev/sda
d to delete partition
quit
and it's still there, I expected to get an error message saying it can't read an empty disk without a partition on it.

How do I get rid of this annoying part? I have 60 of these to reformat.

Regards
iFunc

michaelk 08-04-2016 10:52 AM

You need to write the changes to the drive i.e. the w command. In some cases the OS does not reread the drive so it still uses the old information.

Emerson 08-04-2016 11:03 AM

You can go straight ahead and format them mkfs.ext4 /dev/sda, it will wipe the partition table and create a single filesystem on device.

suicidaleggroll 08-04-2016 11:09 AM

You can also wipe out the partition table with dd (just be careful to get the device name correct)
Code:

dd if=/dev/zero of=/dev/sda bs=512 count=1

iFunction 08-04-2016 12:11 PM

Thanks guys, I'm going to go this Emerson's suggestion as I understand that one, it's something I have used before. I will look at the others a if I can't get it to work, but it I think it should.

suicidaleggroll 08-04-2016 12:20 PM

Quote:

Originally Posted by iFunction (Post 5585985)
Thanks guys, I'm going to go this Emerson's suggestion as I understand that one

What in michaelk's response was not understandable? In fdisk, everything you do is temporary until you hit "w" to write the changes to the disk. If you make a bunch of changes and then just quit out of it, like you said you did in your OP, it won't do anything.

iFunction 08-04-2016 05:49 PM

Ah, ok, I didn't know that, that will be what the issue was then, will try tomorrow and feedback solution for any other newbies like meself. Thank you.


All times are GMT -5. The time now is 01:29 AM.