From: Douglas Gilbert <dgilbert@interlog.com>
To: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>,
Linux List Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: [question] What happens when dd writes data to a missing device?
Date: Sun, 11 Oct 2020 21:57:04 -0400 [thread overview]
Message-ID: <b814a441-1f5c-682a-4621-abc3259b7409@interlog.com> (raw)
In-Reply-To: <CABXGCsOVXh89h2e4EuNbDKiCNwKm8599UE-h0GN-jPhpfyoCVA@mail.gmail.com>
On 2020-10-11 3:46 p.m., Mikhail Gavrilov wrote:
> Hi folks!
> 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?
Others have answered your direct question.
You may find 'oflag=nocreat' helpful if you (or others) do _not_ want
a regular file created in /dev ; for example: if you have misspelt a
device name.
That flag may also be helpful in unstable systems (e.g. where device
nodes are disappearing and re-appearing) as it can be a real pain
if you manage to create a regular file with a name like /dev/sdc when
the disk usually occupying that node is temporarily offline. When
that disk comes back online then regular file '/dev/sdc' will stop
device node '/dev/sdc' from being created.
The solution is to remove the regular file /dev/sdc and you probably
need to power cycle that disk. If this becomes a regular event then
'oflag=nocreat' is your friend [see 'man dd' for a little more
information, it really should be expanded].
Doug Gilbert
prev parent reply other threads:[~2020-10-12 2:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 19:46 Mikhail Gavrilov
2020-10-11 19:52 ` Sven-Haegar Koch
2020-10-11 20:31 ` Al Viro
2020-10-12 1:57 ` Douglas Gilbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b814a441-1f5c-682a-4621-abc3259b7409@interlog.com \
--to=dgilbert@interlog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikhail.v.gavrilov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®