lkml.org 
[lkml]   [2020]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [question] What happens when dd writes data to a missing device?
On Mon, 12 Oct 2020, Mikhail Gavrilov wrote:

> I have a question.
> What happens when dd writes data to a missing device?
>
> For example:
> # dd if=/home/mikhail/Downloads/Fedora-Workstation-Live-x86_64-Rawhide-20201010.n.0.iso
> of=/dev/adb
>
> Today I and wrongly entered /dev/adb instead of /dev/sdb,
> and what my surprise was when the data began to be written to the
> /dev/adb device without errors.
>
> But my surprise was even greater when cat /dev/adb started to display
> the written data.
>
> I have a question:
> Where the data was written and could it damage the stored data in
> memory or on disk?

If the device node /dev/adb does not exist (most likely udev case when
you don't have the device/no module loaded for it) then dd as root will
just create a normal file inside the /dev ramdisk.

Only if the device node exists but is not handled then something else
like an open error will happen.

c'ya
sven-haegar

--
Three may keep a secret, if two of them are dead.
- Ben F.

\
 
 \ /
  Last update: 2020-10-11 22:01    [W:0.215 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site