The officially official Devuan Forum!

You are not logged in.

#1 2020-03-01 21:40:25

nobodyuknow
Member
Registered: 2017-09-10
Posts: 46  

SOLVED: dd to nonexistent device

Usually I pay rapt attention to the destinations of dd and shred commands for obvious reasons. Today I executed the following command:

sudo dd if="a-linux-distro" of=/dev/sdc

Except that there was no /dev/sdc device. There was only /dev/sda and /dev/sdb. I wasn't paying close attention. The command executed for a few seconds and then returned normally. However, I would have expected that it would have returned immediately with some kind of error message: "Hey, blockhead, there is no /dev/sdc device!"

So what happened? Is this another obscure way of sending unwanted bits to the bit bucket or did it actually overwrite something?

Last edited by nobodyuknow (2020-03-01 23:10:08)

Offline

#2 2020-03-01 21:55:34

fsmithred
Administrator
Registered: 2016-11-25
Posts: 1,404  

Re: SOLVED: dd to nonexistent device

I guess you now have a file at /dev/sdc that holds the contents of "a-linux-distro".  If there is no disk /dev/sdc, you can delete the file.

Offline

#3 2020-03-01 23:09:49

nobodyuknow
Member
Registered: 2017-09-10
Posts: 46  

Re: SOLVED: dd to nonexistent device

Thanks for the reply. I looked at /dev and sdc seems to be no different than sda and sdb. However, it's hosed, because I tried "burning" another USB flash drive using sdc and it returned immediately with zero bytes copied, while sdd works just fine. Time for a reinstall.

Offline

#4 2020-03-02 02:46:46

fsmithred
Administrator
Registered: 2016-11-25
Posts: 1,404  

Re: SOLVED: dd to nonexistent device

I think you should be able to delete both of those without any problems. Maybe reboot, but that's probably not necessary.

Offline

#5 2020-03-02 11:52:31

Camtaf
Member
Registered: 2019-11-19
Posts: 37  

Re: SOLVED: dd to nonexistent device

You can delete an over written /dev file, but it is a bit more complicated than a normal directory file to re instate, if I remember rightly, (I did it a couple of times too wink ).

Edit: Check out mknod. (These are 'node' files.)

Last edited by Camtaf (2020-03-02 11:55:43)

Offline

#6 2020-03-02 21:04:34

nobodyuknow
Member
Registered: 2017-09-10
Posts: 46  

Re: SOLVED: dd to nonexistent device

@fsmithred

I reboot once per day at a minimum. I often reboot a few times each day because I switch back-and-forth between different Linux distributions and Windows 10.


@Camtaf

The mknod man page is pretty sparse. One webpage suggested to determine major and minor numbers by looking at /usr/src/linux, but that directory does not exist. I found a webpage from kernel.org (https://git.kernel.org/pub/scm/linux/ke … evices.txt) which appears to be the bible for device numbers. According to that, my command should be "mknod /dev/sdc b 8 32." I rolled the dice and it appeared to complete a dd. I'll post again later after I test it to see if it was a success.

Offline

#7 2020-03-02 21:24:54

nobodyuknow
Member
Registered: 2017-09-10
Posts: 46  

Re: SOLVED: dd to nonexistent device

Yup, that mknod command did the trick. Much easier than a reinstall. Thanks to fmithred and Camtaf for their assistance. Usually my questions are not something someone would find useful, but this one just might be.

Offline

#8 2020-03-02 22:26:36

fsmithred
Administrator
Registered: 2016-11-25
Posts: 1,404  

Re: SOLVED: dd to nonexistent device

I didn't think you would need to use mknod. Since there was no actual device for /dev/sdc, I would expect that there was no /dev/sdc in the filesystem until you made it. I only see as many devices listed as actually exist on my systems. Those get created by udev at boot or when you plug in a removable drive.

Offline

Board footer