2

a micro SD card that was used in a Raspberry Pi installation is now plugged into another Raspberry pi as a USB device. I am trying to delete existing partitions and data using fdisk but changes do not seem to get applied even though there is a success message in the terminal. But listing partitions still shows old partitions:

pi@raspberrypi:~ $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="947B-B89A" TYPE="vfat" PARTUUID="6f92008e-01"
/dev/mmcblk0p2: UUID="eda95d8a-9cdd-4224-96d0-890b4791600c" TYPE="ext4" PARTUUID="6f92008e-02"
/dev/sda1: SEC_TYPE="msdos" LABEL="boot" UUID="74BD-74CF" TYPE="vfat" PARTUUID="ba2edfb9-01"
/dev/sda2: UUID="ec2aa3d2-eee7-454e-8260-d145df5ddcba" TYPE="ext4" PARTUUID="ba2edfb9-02"
/dev/mmcblk0: PTUUID="6f92008e" PTTYPE="dos" 

Then I used fidsk like below:

pi@raspberrypi:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.   

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (1-4, default 1):
First sector (2048-61962239, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-61962239, default 61962239):

Created a new partition 1 of type 'Extended' and of size 29.6 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Checking the partitions again:

pi@raspberrypi:~ $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="947B-B89A" TYPE="vfat" PARTUUID="6f92008e-01"
/dev/mmcblk0p2: UUID="eda95d8a-9cdd-4224-96d0-890b4791600c" TYPE="ext4" PARTUUID="6f92008e-02"
/dev/sda1: SEC_TYPE="msdos" LABEL="boot" UUID="74BD-74CF" TYPE="vfat" PARTUUID="ba2edfb9-01"
/dev/sda2: UUID="ec2aa3d2-eee7-454e-8260-d145df5ddcba" TYPE="ext4" PARTUUID="ba2edfb9-02"
/dev/mmcblk0: PTUUID="6f92008e" PTTYPE="dos"

Nothing seems to have changed. Any ideas what could be the problem here?

1

blkid uses a data cache. Try:

sudo blkid -c /dev/null

If you get the correct information, see the description of the -c switch in man blkid.

  • Have tried this, but nothing changed.. The partitions that should have gone are there just as they were.. – Ahmed Apr 14 '16 at 14:57
0

I assume you want to delete the partitions and start again with the SD card? If you have a Windows computer there is a program called MiniTool Partition Wizard, you can download it here.

Plug the SD card into your computer, then open up MiniTool Partition Wizard, you should see your SD card listed with all the partitions on it. Using MiniTool Partition Wizard you can easily adjust the size of different partitions, create new partitions, or delete partitions.

If you want to set the SD card back to its defaults, in MiniTool Partition Wizard, delete all the partitions on the SD card. Next, create a new primary partition which is the full size of the SD card. Once you have done this close MiniTool Partition Wizard and using file explorer format the SD card to device defaults.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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