V
V
vlarkanov2018-08-09 15:56:50
Debian
vlarkanov, 2018-08-09 15:56:50

Why doesn't dd write the image to the flash drive correctly?

Hello! Linux Mint 18 is installed on the computer. Some time ago there was a problem when writing images.
I do

dd if=debian-9.5.0-amd64-netinst.iso of=/dev/sdb bs=4M status=progress conv=fsync

The command immediately exits with the following output:

72+1 records received
72+1 records sent
305135616 bytes (305 MB, 291 MiB) copied, 0.77144 s, 396 MB/s

Those. the output contains no errors, but the write should have taken some time, not a second.
Of course, it is not possible to boot from a flash drive.
fdisk says it's on it
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 0 595967 595968 291M 0 Empty
/dev/sdb2 3772 4603 832 416K ef EFI (FAT-12/16/32)

The same nonsense happens with other image files and with other flash drives.
Previously, everything worked well, on a laptop with the same OS version, the same flash drive and the same images, everything works fine. In the logs there is nothing interesting from the word at all.
Who is to blame and what to do?
UPD. When running gparted, it complains that "The driver says the physical block size is 2048 bytes, but Linux says it's 512 bytes." But this is more likely not a cause, but a consequence - if you burn a USB flash drive on another computer, insert it into this computer and run gparted - there is no such message.
SOLUTION: it turned out that /dev/sdb is a file not associated with the flash drive (of course, this file was present even when the flash drive was not inserted):
l
ls -l /dev/sd*
brw-rw---- 1 root disk 8, Aug 0 9 16:40 /dev/sda
brw-rw---- 1 root disk 8, Aug 1 9 16:40 /dev /sda1
brw-rw---- 1 root disk 8, Aug 2 9 16:40 /dev/sda2
brw-rw---- 1 root disk 8, Aug 3 9 16:40 /dev/sda3
-rw-r --r-- 1 root root 305135616 Aug 9 17:32 /dev/sdb

I deleted this file and the flash drives began to record again as expected:

dd if=debian-9.5.0-amd64-netinst.iso of=/dev/sdb status=progress conv=fsync
295371264 bytes (295 MB, 282 MiB) copied, 28.0138 s, 10.5 MB/s
595968+ 0 records received
595968+0 records sent
305135616 bytes (305 MB, 291 MiB) copied, 57.8727 s, 5.3 MB/s

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2018-08-09
@notwrite

I am writing a cp image of a device. Well, reset the file cache.

R
Radjah, 2018-08-09
@Radjah

> 396 MB/s
Запись в кэш идёт же.
Можешь добавить oflag=direct, чтобы запись шла непосредственно на устройство, или сделай sync перед извлечением.
Еще можно conv=fsync
dd --help в помощь.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question