Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 1997 15:48:07 -0700 (MST)
From:      chad@anasazi.com (Chad R. Larson)
To:        freebsd-stable@freebsd.org
Subject:   FreeBSD MAKEDEV Hazard (fwd)
Message-ID:  <9710302248.AA06145@chad.anasazi.com>

next in thread | raw e-mail | index | archive | help
E-mail from one of my users...

Forwarded message:
> From wbloom@wbloom.anasazi.com  Thu Oct 30 12:35:06 1997
> Message-Id: <XFMail.971030123458.wbloom@anasazi.com>
> X-Mailer: XFMail 1.0 [p0] on FreeBSD
> Sender: wbloom@anasazi.com
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: quoted-printable
> Mime-Version: 1.0
> Date: Thu, 30 Oct 1997 11:21:50 -0700 (MST)
> Organization: Anasazi Inc.
> From: William Bloom <wbloom@anasazi.com>
> To: ronr@anasazi.com, randy@anasazi.com, nate@anasazi.com, gentner@anasazi.com,
>         ktaylor@anasazi.com
> Subject: FreeBSD MAKEDEV Hazard
> Cc: chad@anasazi.com, naomi@anasazi.com
> 
> A caveat about the FreeBSD /dev/MAKEDEV script...
> 
> If you ever have occasion to recreate special device files for storage
> devices, then here is something to be very careful about.  Doing what
> appears to be, at first blush, obvious from a brief look at the
> MAKEDEV code in order to create new device files for, say, wd0...
> 
>         sh MAKEDEV wd0
> 
> ...is exactly what MAKEDEV itself does if called as 'sh MAKEDEV all'.
> 
> However, the code which executes in order to create files for wd0
> will first create wd0 itself, then...
> 
> for slicepartname in s0h s1 s2 s3 s4
> do
>    sh MAKEDEV $name$unit$slicepartname
> done
> 
> The above code will create device files for wd0 slices (s[1-4]), will
> create device files for partitions wd0[a-h], and will -DELETE- any
> special device files for partitions wd0s[1-4][a-h].  If you use MAKEDEV
> in this fashion to recreate device files for disks that happen to
> have partitions on which your critical mountable filesystems are located
> (e.g. /dev/wd0s1e) and then reboot, the boot may fail.
> 
> So, remember to use something like...
> 
>         sh MAKEDEV wd0 wd0s1a wd0s2a wd1 wd1s1a wd1s2a
> 
> ...and so forth in order to get all the special device files.  It is
> not necessary to spell out -all- the partitions (a - h) since if
> any one partition is mentioned ('a' in this example), then MAKEDEV
> will generate special device files for all the others anyway.  You
> will have to specify at least one partition for -each- unit and slice,
> though.
> 
> If you get into a jam because you can't boot due to this kind of
> problem, then go to the recovery shell prompt and do...
> 
>         /sbin/mount -f /         To force the root filesystem to be
>                                  writable (otherwise you can't do a
>                                  mknod).
>         cd /dev
>         sh MAKEDEV <devices>     As mentioned above; ignore 'chgrp' errors.
>         /sbin/mount /usr         Mount the /usr filesystem
>         /usr/bin/find . -name <name pattern> -group 0 \
>                       -exec /usr/bin/chgrp operator {} \;
> 
> The last command makes all the created special device files have
> 'operator' group ownership.  Pick a name pattern that catches the
> raw devices, too (i.e. rwd0* as well as wd0*).
> 
> I had to go through this exercise when I upgraded a PC from FreeBSD
> 2.1.6 to 2.2.5 using sources.  Recreating the device files -may-
> not have been strictly necessary, but I am changing one whole
> minor revision of FreeBSD and I know that there is new device support,
> so I thought it would be a good idea.  Too bad I got sabotaged by
> /dev/MAKEDEV.
> 
> 
> Bill
> --------------------------------------------------------------------------
> William Bloom <wbloom@anasazi.com>
> (602) 906-7525
> Anasazi, Inc. - 7500 North Dreamy Draw Drive, Suite 120, Phoenix, Az 85020
> 


	-crl
--
Chad R. Larson (CRL22)                          Brother, can you paradigm?
602-870-3330    chad@anasazi.com     chad@anasaz.UUCP      chad@dcfinc.com 
Anasazi, Inc. - 7500 North Dreamy Draw Drive, Suite 120, Phoenix, Az 85020



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9710302248.AA06145>