SD partition issues, read-only or no space, dd error and others

I put OSMC (kod multimedia system for blackberry) system on a SD card using dd commans:

sudo dd bs=4M if=/dev/zero of=/dev/mmcblk0 oflag=sync
sudo dd bs=4M if=OSMC_TGT_rbp2_20200607.img of=/dev/mmcblk0 status=
progress && sync

That worked fine, OS installed itself and was working. While installing HGO EU add on (for HBO GO in EU), it needed to install widevine, so I agreed. The problem was, it was taken from some Chrome OS image, so download file was 1GB. In theory there was a space on SD (32 GB SD card and only ca. 300 MB taken by the system, rest was used for another partiion).
I had no idea where the kodi was downloading this file (OS or another partition), but assume that if run out of space, it will simply error out. Nothing serious. Right? Wrong, deadly wrong…

The system just went blank and didn’t even reboot itsel. I had to manually plug it off and in. I was greeted with some file system serious errors and advice to reinstall OS. So I wanted to do just that…

SD card became not readable. I was able to fix that with command:

sudo dosfsck -l -t /dev/mmcblk0

Then I repeated the first commands above. After starting the blackberry, I was greeted with the same error interface. I tried again and noticed, there were some dd errors:

sudo dd bs=4M if=/dev/zero of=/dev/mmcblk0 oflag=sync                 
dd: save error '/dev/mmcblk0':Not enough space on the device                                                                      
974+0 read records
973+0 saved records
copied 4083318784 baits (4,1 GB, 3,8 GiB), 5,32627 s, 767 MB/s

When checked on gparted, the whole SD card shows 3,8 GB of space, although this is a 32 GB card and should show ca. 29 GB.
What is more weird, is that gparted sees this as empty, while lsblk still sees two partitions that were there before. I tried creating new msdos partition tables, to nuke everything on this SD card and… gparted shows success and yet system still sees the partitions that gparted does not. I’m getting headache :frowning:

dd messed up something and cannot fix it.

Any idea what is happening? Are there any deep disc tools that could help with it?

Don´t get irritated. Some infos about partitions are cached. So i think system shows you cached infos :wink: (there is a command to reread, but i don´t remenber)

gparted does reread the infos everytime fresh from disk.

I do refresh on gparted.

I see:

fdisk -l /dev/mmcblk0                                                  
Dysk /dev/mmcblk0: 3,8 GiB, bajtów: 4083318784, sektorów: 7975232                                                               
Jednostki: sektorów, czyli 1 * 512 = 512 bajtów
Rozmiar sektora (logiczny/fizyczny) w bajtach: 512 / 512
Rozmiar we/wy (minimalny/optymalny) w bajtach: 512 / 512

and lsblk

mmcblk0     179:8    0  29,5G  1 disk 
├─mmcblk0p1 179:9    0   316M  1 part 
└─mmcblk0p2 179:10   0  29,2G  1 part

So even if this lsblk shows cached info, I can’t clean up the SD card, since it doesn’t show all 29GB of space and rasberry also sees old partitions on the boot (the same error as before), which oddly looks like this seemingly cached result… So I’m confused which is true.

Anyway, this is how it looks on rasberry pi:

Of course, I first tried to run fsck on rasberry as suggested, but I got that the command is unknown. I don’t know enough about rasberry, so I thought I just clean up and prepare SD anew, system will install again. But I run into this SD problem. I just can’t figure it out how those deep disk tools cannot write with some issues. It’s as if SD itself got broken in the process.

partitioning emmc devices seems an art of its own.

Please search the forum for “emmc” or “raspi”

On a glance, I don’t understand it at all. It seems to be completely unrelated.

I tried creating various table partitions (gpt then again msdos) on gparted and all went fine, in theory, but it still shows 3,8 GB of space on a disk. It’s as if the SD card just broke irreparably. Maybe that is what happened? This is a new card, but SD cards are rarely of good quality, especially cheap ones.

I found this:

and tried various dd commands, no change. I still get this error:

dd: error writing ‘/dev/sdb’: No space left on device

and the space is limited. Even when I dd the system on SD card and it goes fine, blackberry still has a problem as nothing has changed.

A SD-card is by far not the same as a harddisk :wink:
Maybe you should NOT use dd
I am out here :man_shrugging:

I found different SD cards and… they all behave the same. The same error during zero and when plugged in into blackberry, it doesn’t even boot. So this can’t be SD issue. The dd commands are destroying them somehow.

I’ll try other OSes, maybe this will make some difference. At this point I’m lost and have no idea what is going on. It worked well this morning and now it doesn’t :frowning: .

EDIT:

It looks like zeroing command is limited or not working fully correctly, and it depends what was done before.
So when I had this OSMC image (a small one), it showed max 3,8GB of space and the rest was inaccessible for this command. However, when I put Manjaro on the SD card, it freed the entire SD card, showing full space (one big partition). Then doing zero command on that state, makes correct entire SD blank and consequently, next image flash shows OS partition plus unused one that takes all the SD rest space, so the whole SD is visible (unlike earlier). So in that state raspberry boots as it should and all works fine.

As I said above, it turned out to be a problem with dd and how it works, not with SD. I just wish, I could find some better and proper way of unblocking SD card than putting entire Manjro iso on it… Nevertheless, I found some solution.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.