[comp.sys.sun] SunOS 3.5 Network Disk

larrys@uunet.uu.net (02/21/90)

Maybe this is old hat.  Does anyone have a quick way to copy files from a
client's ndp0 without booting the client?  In other words, where is ndp0?
Please -- no RTFM's.  The M is driving me crazy.

Disclaimer:  I am not a crook.  This is a server whose entire network is
in my little department.  I can swipe any files out of it I want.  It's
mine, I tell you!!!  All Mine!!

dupuy@cs.columbia.edu (02/24/90)

Ahhh, ND.  It's been a while, but I think there's a 3.5 Sun-3 server on
the net that I _still_ haven't upgraded (next week, I promise!:-).

All the answers lie in the file /etc/nd.local; here's a simple example:

#
# These lines added by the Sun Setup Program
#
# /pub /dev/ndp0
user 0 0 /dev/xy0e 0 -1 -1
user alpha 0 /dev/xy0c 493120 4020 0
user beta 0 /dev/xy0c 489100 4020 1
user alpha 1 /dev/xy0c 183580 48240 -1
user beta 1 /dev/xy0c 231820 48240 -1

The syntax is a bit confusing, but it is possible to decipher it.  The
first, "user 0" line describes the /dev/ndp0 partition (as it appears to
the diskless clients) or /dev/xy0e partition (as it appears to the
server).  On both server and clients, this partition is mounted as /pub
(server rw, clients ro).  This is the partition that you asked for, but I
suspect not the one you want, since it's so easy(?) to find.

The second, "user alpha 0" line describes the /dev/nd0 partition (as it
appears to the client alpha) and the /dev/ndl0 partition as it appears to
the server).  This is mounted (rw) on alpha as /, but isn't typically
mounted on the server.  You can mount it on the server but BE SURE THAT
YOU MOUNT IT RO if the client is running!  Otherwise the client and server
will confuse each other greatly, and probably scramble the filesystem.
The third "user beta 0" line describes a similar client root partition for
beta, but appears to the server as the /dev/ndl1 partition (that last
number on the line determines the ndl number).  The last two entries
describe the client swap areas (/dev/nd1) which are not accessible as ndl
partition on the server (last number is -1).  But since these swap areas
don't have filesystems, you can't mount them on the server anyhow.

I know you said no RTFMs, but perhaps with this explanation, a
reexamination of nd(8c) and your own nd.local file will prove
enlightening.

inet: dupuy@cs.columbia.edu
uucp: ...!rutgers!cs.columbia.edu!dupuy

richard@sunkist.west.sun.com (Richard Seegmiller) (02/24/90)

#Maybe this is old hat.  Does anyone have a quick way to copy files from a
#client's ndp0 without booting the client?  In other words, where is ndp0?
#Please -- no RTFM's.  The M is driving me crazy.

I recall doing this very thing ( a looonnnnggg time ago).

1. You need to make sure that the machines that mount the nd partitions
that you want to use are turned off (or at least, not booted).  

2. On the server, look in /etc/nd.local for an entry of the form 
   user machine_name 0 /dev/xy0c 211720 6700 3 <------- use this number 
   user machine_name 1 /dev/xy0c 218420 33500 -1 

3. Determine the number for the source machine you want to use in the
copy. Also determine the number for the destination machine you want.  

4. Create to directory in the root partition on the file server (eg
'/mnt1' and '/mnt2') 

5. Using the numbers determined in step 3, mount the ndl# partition.  For
example if you want to copy from machineA whose nd partion is 1 to
machineB whose nd partion is 2, do the following: 

      mount /dev/ndl1 /mnt1 mount /dev/ndl2 /mnt2 

6. You may now execute a tar pipe like this: 

      cd /mnt1 tar cf - ./* | (cd /mnt2; tar xvBpf

This will copy the whole root partition to machineB's root partition.
NOTE: You have also copied all of the system files in /etc.  Some of the
files in /etc on machineB will have to be modified.  One that I know of
off hand is /etc/fstab to reference the nd partition of machineB.  If you
only need to copy some files (not the whole root partition of the client)
then the 'tar' command is just a 'cp' of the files you want.  BEWARE: (if
you don't already know) cp does not copy symbolic links, it copies the
file the symbolic link points to.  tar copies symbolic links and preserves
them as links.  

7. Unmount the nd partions by: 

     cd / umount /mnt1 umount /mnt2 rmdir /mnt1 rmdir /mnt2 

8. Boot the machines that were used in the copy.

Good Luck

Richard Seegmiller
Research & Techonology Development
De La Rue Printrak
1250 N. Tustin Ave.
Anaheim, CA 92807

Phone:    (714)666-2700
Internet: sol!richard@sunkist.West.Sun.COM 
	  sol!richard%sunkist.West@Sun.COM	(for hosts table hosts)
UUCP:	  ...!sun!sunkist!sol!richard