1

I have a USB where I'm coping an ISO of 5 Mb aprox with a small OS with its own grub. If I connect the device and check it sudo fdisk -l I get:

...
Device     Boot Start   End Sectors  Size Id Type
/dev/sdb1  *        1  9551    9551  4.7M cd unknown

If I copy with dd the ISO sudo dd if=my_os.iso of=/dev/sdb

14852+0 records in
14852+0 records out
7604224 bytes (7.6 MB) copied, 0.538487 s, 14.1 MB/s

It works perfectly. An boot from BIOS in other PC.

The problem is, sometime I forget to connect the USB after update the BIOS, so I do ff WITHOUT the USB connected, the output is:

14852+0 records in
14852+0 records out
7604224 bytes (7.6 MB) copied, 0.00987684 s, 770 MB/s

Now, the /dev/sdb register is corrupted, the copy speed (770 MB/s) have no sense, and cannot user again dd until reboot.

I have tried to repair it with ddrescue and it doesn't work

sudo ddrescue /dev/zero /dev/sdb conv=noerror,sync

My question is, what is happening exactly and if is possible, how to repair /dev/sdb to avoid reboot and dd start working again?

Thanks.

5

Device nodes like /dev/sd* only show up in /dev after the device is connected, not before. (Also, they aren't called "registers".) So when you ran dd of=/dev/sdb it didn't actually touch any device – instead, since the output file didn't exist, dd created a new file by that name.

$ sudo dd if=archlinux-2016.04.01-dual.iso of=/dev/sdc
1482752+0 records in
1482752+0 records out
759169024 bytes (759 MB, 724 MiB) copied, 0.941926 s, 806 MB/s

$ ls -l /dev/sd*
brw-rw---- 1 root disk 8,  0 Jun 15 08:54 /dev/sda
brw-rw---- 1 root disk 8, 16 Jun 15 14:14 /dev/sdb
-rw-r--r-- 1 root root  724M Jun 15 15:06 /dev/sdc

So there's really nothing that could have been "corrupted", and nothing that makes sense to "repair" or ddrescue. You simply have a huge file named /dev/sdb, and because it exists, the kernel can't create a real device node there.

(The write speed makes perfect sense – /dev is stored in RAM, so you just copied the image from RAM, where it was cached, back to RAM, where /dev lives.)

Delete /dev/sdb and reconnect the device, and the real device node should reappear.

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.