Device files creation

Device files creation

Post by Robert B. Kast » Fri, 19 Feb 1999 04:00:00



Here's an interesting x86 challenge that I am working on...

I have a system on which I ufsdump'd the root partition, in order
to move it to another system. I restored the dump on the new system,
and now I realize that because the boot device node is completely
different, I am running into trouble right at boot time.

The system boots and loads the kernel, but when it comes time
to fsck and mount the file system, it says "cannot stat
/dev/rdsk/c1t6d0s0" and of course there is no device in
/devices that point to this hardware, and thus there is no
/dev/rdsk/c1t6d0s0. (The system is up in maintenance mode
and the filesystem is real-only.)

The question is, can I create this device node manually? I
have another boot device which works fine, and I suppose I
could mount this new disk, and cpio the device nodes. Is
there another way?

Please don't tell me about b -r, /reconfugure or
sys-unconfig. I am way past that point.

Opinions expressed herein are my own and may not represent those of my employer.

 
 
 

Device files creation

Post by D. Roc » Fri, 19 Feb 1999 04:00:00



: Here's an interesting x86 challenge that I am working on...

: I have a system on which I ufsdump'd the root partition, in order
: to move it to another system. I restored the dump on the new system,
: and now I realize that because the boot device node is completely
: different, I am running into trouble right at boot time.

: The system boots and loads the kernel, but when it comes time
: to fsck and mount the file system, it says "cannot stat
: /dev/rdsk/c1t6d0s0" and of course there is no device in
: /devices that point to this hardware, and thus there is no
: /dev/rdsk/c1t6d0s0. (The system is up in maintenance mode
: and the filesystem is real-only.)

: The question is, can I create this device node manually? I
: have another boot device which works fine, and I suppose I
: could mount this new disk, and cpio the device nodes. Is
: there another way?

: Please don't tell me about b -r, /reconfugure or
: sys-unconfig. I am way past that point.
Beware: All commands are from memory and man contain some minor faults.

If you have a separate / and /usr partition then you have to boot from
CD because the necessary tools to rebuild the /devices and /dev tree
are in /usr.

Wheather you are booting from disk or CD-ROM the remaining steps are
similar.
mount a writable fs (tmpfs). This is normally automatically done for CD-ROM
boot. For disk boot, mount /tmp without an entry in /etc/mnttab:
mount -m /tmp

You can now rebuild /devices and /dev in /tmp:
mkdir /tmp/devices; drvconfig -r /tmp/devices -p /tmp/path_to_inst
devlinks -r /tmp; disks -r /tmp
You now can remount / from the /tmp/dev/dsk/... entry:
mount -o remount,rw /tmp/dev/dsk/..... /
Now copy the new /devices and /dev to /. Use the tools in /usr/sbin/static
because after moving away /dev or /devices you won't have a /dev/zero
which is needed for dynamically linked programs.

You may have to change /etc/vfstab to reflect the new numbering of devices.
If you want the device numbering starting at 0 again, remove /etc/path_to_inst,
reboot with the -a flag. If asked to rebuild /etc/path_to_inst, answer with "y"
You can now redo the drvconfig/devlinks and device numbering will start at
0 again.

I have done several system copies with this technique and never had major
problems. At least for desktop configurations I recommend using one big /
instead of a separate /usr. It is a major help in such and other emergency
situations. Many of the machines I configured don't have a CD-ROM drive at all,
so otherwise I'd have to setup a network boot server.

Daniel

 
 
 

Device files creation

Post by Robert B. Kast » Sun, 21 Feb 1999 04:00:00



Thanks for the great advice, Daniel. As you were working from memory, I
can fill in some details below for those who may have the same issues.
Note, this is for Solaris 2.6 x86 and that may account for the minor
differences as well.

Quote:> If you have a separate / and /usr partition then you have to boot from
> CD because the necessary tools to rebuild the /devices and /dev tree
> are in /usr.
> mount a writable fs (tmpfs). This is normally automatically done for
> CD-ROM boot. For disk boot, mount /tmp without an entry in /etc/mnttab:
> mount -m /tmp
> You can now rebuild /devices and /dev in /tmp:
> mkdir /tmp/devices;

cd /tmp
(for some reason, only relative pathnames work here. If I used absolute
paths, nothing was created in /devices. Maybe because / is r-only?)
drvconfig -r devices -p path_to_inst
devlinks -r .
disks -r .

Quote:> You now can remount / from the /tmp/dev/dsk/... entry:
> mount -o remount,rw /tmp/dev/dsk/c?t?d?s? /

cd /
drvconfig
devlinks
disks -

Once / is mounted, I found that rerunning drvconfig, devlinks and disks
from / worked just fine (while cp'ing the devices and dev directories
resulted in*).

Quote:> You may have to change /etc/vfstab to reflect the new numbering of devices.
> If you want the device numbering start at 0 again, remove /etc/path_to_inst,
> reboot with the -a flag. If ask rebuild /etc/path_to_inst, answer with "y"
> You can now redo the drvconfig/devlinks and device numbering will start at
> 0 again.

Voila!

Opinions expressed herein are my own and may not represent those of my employer.

 
 
 

1. Serial Device file creation (/dev/cua?)

I've installed Debian Linux 1.3, but when I tried to get dip working, I
found there were no serial device files.  

I've copied over the dip scripts that worked on the previous version.
Do I just need to create these device files to get it to work ?
If so, how do I create the files under Linux ?
if I just use mknod, what parameters do I need for serial devices ?
(the man pages have been less than helpful).  

Is there some kind of configuration program (similar to the install
program) that I can use to modify the system once it's installed?

Any info (or pointers to info) on this would be very much appreciated.

----------
                                          \//////
                                          [ O o ]
 Ken Tew - Licensed to Program             \_=_/
                                           _| |_
                                          / \_/ \
________________________________________oOOO___OOOo__

2. xrsh on linux ?

3. Gvim is not giving a new file creation, when several files already opened..

4. Printer help

5. SLIP device creation - how?

6. Linux/NIS+

7. Loopback Device Creation

8. Cyrix 486 DLC cache activation

9. device driver creation on MkLinux NuBus

10. relation between device driver and device file

11. NFS export from Linux to NeXTSTEP file creation errors.

12. umask and file creation

13. can umask be used in .profile to set file creation mask?