1

I have an SD Card. I use it on my Raspberry Pi 4. I flashed a bootloader and successfully rewrote the bootloader on the Pi.

Then, I flashed Raspberry Pi OS on it and when it booted it was a Read-Only Filesystem. Then I shut down the Pi and took out the SD-Card. When I checked its partitions, I saw this:

enter image description here

I think that because of the bootloader this had happened. A new partition had been created. Now I need to extend it to get full space in one partition. The extend option is greyed out. Is there any way I can do this?

EDIT: I am not able to delete the volume. When I click it, it shows me the confirmation message and when I confirm, It does not work.

EDIT 2: Gparted failed. I also remove the SD Card without ejecting it. I think that would also be a cause of corruption. Can you fix such things?

Giacomo1968
  • 58,727
Jandroid
  • 153
  • 1
  • 2
  • 12

5 Answers5

1

Copied from the Rasperry Pi Stack Exchange: (Would have set a Migrate flag, but it's missing from the menu)

You can use DISKPART in Windows, or the equivalent fdisk command under Linux/Mac.

DISKPART (Windows)

Start a command prompt, and start the DISKPART console. List all of your disks by typing LIST DISK, then select the proper disk with SELECT DISK # (where # is the SD card). You can then type CLEAN to clear the partition table on the card, effectively blanking it. MAKE SURE YOU SELECTED THE PROPER DISK BEFORE RUNNING THE CLEAN COMMAND!

To create a primary partition to reuse the space on the card, type CREATE PARTITION PRIMARY. This will then reallocate the previously "cleaned" space.

To format, type FORMAT FS=FAT32 QUICK, and finally, to reassign a drive letter, type ASSIGN.

If you're unable to determine the proper disk, remove the SD card, run DISKPART and LIST DISK, and then re-run it with the SD card inserted. The SD card is just the disk that has been added.

Note that the above commands are not case sensitive; I used caps to match the convention DISKPART displays.

FDISK / CFDISK (Linux/Mac)

In a terminal, start fdisk /dev/sdx where /dev/sdx is your SD card device (may depend on the Linux distro you're using, see below). You can then delete all existing partitions on the device by typing d, and then adding a single new partition & format it. You an also just type n to create a new partition table, and start laying everything out.

cfdisk is also another viable tool, which is basically fdisk with a greatly improved user interface. In both cases, once the drive is formatted, you will lastly need to mount it.

If you're unable to determine the proper device, remove the SD card, run fdisk -l, and then re-run it with the SD card inserted. The SD card is just the device that has been added.

1NN
  • 10,044
0

I think you are confused, some info (including links at bottom) that I think may answer your questions:

  • 1st FAT32 partition labeled boot: is the kernel/boot code for OS as first commenter details. Should not be deleted.

    boot partition I don't believe has anything to do with the bootloader you flashed which I believe is related to the Pi 4's FW (FirmWare) EEPROM which controls the boot process/device (SD or USB) whereas earlier Pi models controlled that with a bootcode.bin file located in the boot filesystem

  • 2nd large partition: doesn't specify file system type. This is likely the OS & your files. Linux uses ext file system that Windows cannot natively read/write to. Deleting this would delete the OS & your files. It already takes up the rest of the SD card space so does not need to be expanded.

If you still have outstanding concerns please clarify what those are by updating your question. As it stands you seem to want multiple things that sometimes contradict themselves:

  1. To unallocate a partition

    Please re-word what you mean, because un-allocate could mean delete partition or make it not the primary?

  2. Extend a partition to get full space on one partition

    Linux/Raspbian likely needs two partitions to operate. As it stands I don't see why you need to extend it. So extending and/or using only one partition is NOT recommended. Should you simply be curious on extending partitions know that you can't always do that easily in Windows when partitions have a drive letter (or are 'Online' aka mounted). Best to do that with a bootable Linux environment (gparted, Ultimate Boot CD, Bart PE, etc.)

  3. Delete/volume partition

    This is simple enough, not sure why its failing without more details. In a comment you seem to imply you don't want the OS on the SD card in that case you can just format the whole SD card instead of deleting/extending/adjusting partitions.

  4. Freshly install Pi OS per a comment you made

    I wouldn't waste time/effort with partitions. Simply format the SD card & re-flash/install OS on blank SD card.

https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained

https://forums.raspberrypi.com/viewtopic.php?t=202923

https://forums.raspberrypi.com/viewtopic.php?t=210435

https://learn.adafruit.com/resizing-raspberry-pi-boot-partition/edit-partitions

gregg
  • 6,307
0

Because you said you wanted a fresh install of Raspberry Pi OS, the easiest tool for your current situation would be something like Rufus or the official Raspberry Pi Imager.

Both of these tools would wipe all partitions off of the SD card before they install anything. You should only do this if you want a fresh install.

Giacomo1968
  • 58,727
0

Other answers address the title which is

How to unallocate a partition on a SD card?

Responses from the OP are "gparted failed", "the SD card is not formatting for some reason", "the imager is not working" etc. Most likely this particular SD card is broken beyond repair. See What can I do if my USB flash drive is write-protected or read-only? Especially this answer where it states:

If the drive is read-only no matter what computer you plug it into, or you've tried the above steps to no avail, then the drive has probably experienced a fault condition, and it's generally not possible to remove write protection from a faulty flash drive. This behavior is typical of flash drive controllers when they detect a problem with the underlying NAND (e.g. too many bad blocks). The write protection is intended to prevent this condition from actually causing data loss, […]

Here on Super User there were other questions about SD cards suddenly going read-only. The questions were simply closed as duplicates of the one I linked, because SD cards can also fail in the described way. It's not uncommon.

While other answers here are useful for healthy SD cards, in your particular case the conclusion is: the card is most likely almost dead, replace it with a healthy one.

-1

You will need to delete the second partition before you can extend the first partition.

Make sure you have no data in the partition before you delete it.

You could also delete both partitions and create a new partition that uses the newly freed space.

user10489
  • 2,081