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

Re: installing udev without rebooting



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.

Also, here's a more complex but hopefully less racy solution:
OLDDEV=/dev
NEWDEV=$(tempfile)

rm $NEWDEV && mkdir $NEWDEV
# The goal is to get the udev mount in a perfect state before moving
mount -o size=5M,mode=0755 -t tmpfs none $NEWDEV
mkdir $NEWDEV/{pts,shm}
# bind mount will allow us to modify pts and shm from both places w/out
# either being in a different state from the other
mount --bind $OLDDEV/pts $NEWDEV/pts
mount --bind $OLDDEV/shm $NEWDEV/shm
# at this point, you could probably run udevstart on $NEWDEV; although, it
# appears that udevstart has /dev hardcoded?  That should be fixed..
(cd $OLDDEV && find . -type s -o -type p | while read s; do cp -a "$s" "$NEWDEV/$s"; done)
# this is the only racy part; between the find and mount --move, there may
# be a socket or pipe added or removed from $OLDDEV but not added or
# removed from $NEWDEV
mount --move $NEWDEV $OLDDEV

$NEWDEV, at that point, should be empty; $OLDDEV should contain its
contents, w/ pts and shm still bind mounted.  Of course, it leaves a bunch
of temporary crap mounted that should (?) be cleaned up.  I'd recommend asking
the user (in postinst) whether they'd like to immediately start udev; if they
say yes, then use the above scheme and suggest a reboot soon.





Reply to: