How to add new /dev/hda device file in OpenWrt

Currently i have compiled and installed the openwrt in virtual machine, there am able to see </dev/sda> ,</dev/tty>... , suppose if i want to create a new device file inside for eg: </dev/hda> how to do that, i tried to add in device_table.txt but it didn't work please help on this

the device will be created once the HW is discovered ?

Hi frollic thanks for the reply,

Can't we create device just by adding /dev/hda stuffs in device_table.txt ? am in the assumption that if we add like below it will be created .

/dev/hda b 640 0 0 3 0 0 0 -
/dev/hda1 b 640 0 0 3 1 0 0 -
/dev/hda2 b 640 0 0 3 2 0 0 -
/dev/hda3 b 640 0 0 3 3 0 0 -

is my assumption is wrong ? will that /dev/ is created only when extra device is added ? can't we modify ?

don't know about device_table.txt, but you can create devices with random
names, i just don't see the point of it ?

How to create new block device files ? i need to create /dev/hda and need to mount /writable please help to create new /dev/ files in code

why ?

just because you've created a device, doesn't mean it's mountable, unless the underlying hardware is there.

as I said, the device will be automagically created, when needed.

what kind of device would /dev/hd? be, anyway ?

1 Like

the first IDE hard drive is /dev/hda .

yeah, problem is IDE died 20 years ago ...

2 Likes

oh ok now it's better to use /dev/sda ?

you need to add a new device in the hypervisor, not in owrt. then if owrt can recognize it will be usable within guest os (a.k.a. owrt)

3 Likes

/dev/hda is need it for Virtual device

Create another VM with Linux, and add device there. After success ask here. It is issue of your hypervisor, not OpenWRT, Linux, Windows etc.

1 Like

You answer your question exactly: you can use mknod.

https://man7.org/linux/man-pages/man2/mknod.2.html

That can be needed in some corner cases. I needed that e.g. to create /dev/ubi0_20 in the preinit stage.

In 99% cases creating /dev/ nodes manually is not what you want. They should get created for you automatically. To I suggest looking for actual source of your problem.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.