Is it possible to create a directory under /dev?

Oliver Fromme olli at lurza.secnetix.de
Fri May 23 16:00:54 UTC 2008


Andriy Gapon wrote:
 > But, by the way, there is a (slightly) more valid reason to want to 
 > create a directory under /dev, I recently had it. For one non-standard 
 > third-party application I needed to create a link to existing device in 
 > a certain subdirectory. I.e.:
 > /dev/subdirX/device -> /dev/deviceX
 > And I couldn't do that.

You could create a directory elsewhere and use UNIONFS to
merge it with your existing /dev.  I haven't tried this,
but I think it should work.

# mkdir /mydev
# mount -t unionfs -o below /mydev /dev
# cd /mydev
# mkdir subdirX
# ln -s /dev/deviceX subdirX/device

The "-o below" option is used so that any modifications on
/dev -- such as creating symlinks -- still happen on the
real /dev, not on /mydev.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

Passwords are like underwear.  You don't share them,
you don't hang them on your monitor or under your keyboard,
you don't email them, or put them on a web site,
and you must change them very often.


More information about the freebsd-stable mailing list