2

Full cat /proc/partitions + lsblk + fdisk -l output is here: http://pastebin.com/jYCCmwsU

I just bought my new class10 16GB SDCard and I started to restore the Raspbian system for the Raspberry with this command:

sudo dd bs=4M if=~/raspbian.img of=/dev/sdb

I accidentally pressed and ejected the SDCard physically after a few seconds. Since then, I experience the following:

  • The size of raspbian.img is 14.9 GB
  • The size of sdb is shown as 1.91 GB in KDE partition manager
  • First sector: 34
  • Last sector: 4 012 526
  • Number of sectors: 4 012 493

The SDCard is "unknown media" in Kubuntu partition manager, but I can create GPT or MS-Dos partition table, BUT I can not create any file systems using the partition manager:

Create a new partition (1,91 GiB, ext3) on ‘/dev/sdb’ Job: Create new partition on device ‘/dev/sdb’ Create new partition ‘/dev/sdb1’: Success

Job: Create file system ‘ext3’ on partition ‘/dev/sdb1’ Command: mkfs.ext3 -q /dev/sdb1 Create file system ‘ext3’ on partition ‘/dev/sdb1’: Error Create a new partition (1,91 GiB, ext3) on ‘/dev/sdb’: Error

After this I can not create file system again, I have to delete the unknown first. If I connect this SD Card to the latest Windows 10 PC, it will freeze and GUI will crash.

Is there any mkfs / dd magic to write the inaccessible sectors?


Update1:

I tried this: dd if=/dev/zero of=/dev/sdb bs=1M count=1

Now the KDE partition manager in Linux shows 1 MB unknown device as sdb, and I can't even create a partition table.

I never seen anything like this, but sdb disappeared from fdisk and tons of /dev/ram appeared.

sudo fdisk -l:

Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Full cat /proc/partitions + lsblk + fdisk -l output is here: http://pastebin.com/jYCCmwsU

The raspbian.img is 14.9 GB: -rw-r--r-- 1 root root 16009658368 sept 12 18:56 raspbian.img


Update 2:

I still can't write the 14.9 GB iso into the 16GB card: dd will still stop where I accidentally ejected the card

zs@deneb:~$ sudo dd bs=1M if=~/raspbian.img of=/dev/sdb
dd: error writing ‘/dev/sdb’: No space left on device
1960+0 records in
1959+0 records out
2054430720 bytes (2,1 GB) copied, 34,2516 s, 60,0 MB/s
zs@deneb:~$
4
  • 2
    dd if=/dev/zero of=/dev/sdb and start over?
    – John
    Commented Oct 6, 2015 at 17:43
  • dd still stops at around 2 GB, the raspbian.img is 14.9 GB: -rw-r--r-- 1 root root 16009658368 sept 12 18:56 raspbian.img Commented Oct 6, 2015 at 18:43
  • @ZsoltPinter It's starting to sounds like you have a fake sd card, that pretends to be bigger than it is. I would google "fake sd card".
    – Patrick M
    Commented Jun 18, 2017 at 18:11
  • One other possibility: When you pulled the card during the dd, /dev/sdb would have continued to exist. If you promptly reinserted it, it would now be /dev/sdc, If you then tried writing to /dev/sdb, you would wind up making a file. This could easily give you the "No space left on device" error, and might look like a fake sd card. So, any time you insert media, identify what its device is before trying to use it.
    – David G.
    Commented Jul 17, 2023 at 9:03

1 Answer 1

2

Your best bet is to connect it back to a Linux system, preferably one without any automounting enabled (most require a click to do this, even in GVFS or similar), and start over. Optionally:

dd if=/dev/zero of=/dev/sdb bs=1M count=1

This will delete any conceivable partition table, and so hopefully make the disk stop crashing Windows. Then just repeat the initial:

dd bs=4M if=~/raspbian.img of=/dev/sdb

Both commands should be run as root, so prefix with sudo or start a root shell.

3
  • I tried this: dd if=/dev/zero of=/dev/sdb bs=1M count=1 Now the KDE partition manager in Linux shows 1 MB unknown device as sdb, and I can't even create a partition table. I never seen anything like this, but sdb disappeared from fdisk and tons of /dev/ram appeared. Full terminal output is here: pastebin.com/tg09qeJr Commented Oct 6, 2015 at 17:57
  • While you're at it, add the output of lsblk.
    – Tom Hunt
    Commented Oct 6, 2015 at 18:04
  • Info added to question and full cat /proc/partitions + lsblk + fdisk -l output is here: pastebin.com/jYCCmwsU Commented Oct 6, 2015 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .