[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: installing udev without rebooting



On Sat, 18 Dec 2004 19:39:07 -0500, Andres Salomon wrote:

> On Sun, 19 Dec 2004 00:50:35 +0100, Marco d'Itri wrote:
> 
>> On Dec 19, Andres Salomon <dilinger@voxel.net> wrote:
>> 
>>> At this point, you should be able to mount tmpfs over /dev, and still
>>> access the old contents of /dev from the $D directory.  `find $D -type
>>> s` should give you a list of all sockets that should be moved (I can't
>>> think of any cases where something would create a socket in /dev that
>>> shouldn't be moved over).
>> Can sockets be moved between different filesystems?
> 
> Yep, use cp -a.
> 

Heh, of course, what you're really asking is; can they be moved without
the processes using them having to be restarted?  Afaict, the answer is no.
However, it is possible to use symlinks.

After playing around w/ it some more, I'm wondering why you need to bother
w/ pts at all; it's just a virtual filesystems kept track of by the kernel.
There's no reason you can't mount them over the tmpfs (as the udev init
stuff appears to do by itself by calling mountvirtfs).  shm, however, is
standard tmpfs, so it must be kept track of.

Here's another attempt at doing what you're trying; this one allows udev
to be started without requiring any services to be restarted.

DEV=/dev
TMPDEV=$(tempfile)
NEWDEV=$(tempfile)

test -f $TMPDEV && rm -f $TMPDEV && mkdir $TMPDEV
test -f $NEWDEV && rm -f $NEWDEV && mkdir $NEWDEV
mount --bind $DEV $TMPDEV  # old /dev remains mounted until reboot
mount -o size=5M,mode=0755 -t tmpfs none $NEWDEV
mkdir $NEWDEV/{pts,shm}
mount none $NEWDEV/pts -t devpts # Is this necessary, or can we wait for mountvirtfs to do it?
mount --bind $DEV/shm $NEWDEV/shm
find $TMPDEV -type s -o -type p | sed "s@$TMPDEV@@" | while read s; do \
	cp -s "$TMPDEV/$s" "$NEWDEV/$s"; \
done
mount --move $NEWDEV $DEV

At that point, udevstart and friends can be called, populating the rest
of dev.




Reply to: