Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jan 1997 12:19:33 -0800 (PST)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Gary Kline <kline@tera.com>
Cc:        FreeBSD Questions Mailgroup <freebsd-questions@freebsd.org>
Subject:   Re: adding SCSI drive
Message-ID:  <Pine.BSI.3.94.970112121746.4490C-100000@localhost>
In-Reply-To: <199701120356.TAA15971@athena.tera.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 11 Jan 1997, Gary Kline wrote:

> 
>   I just added a 728MB SCSI drive (as SCSI devive 3). The hardware
>   is recognized, which is the first step.   What's the next step?
> 
>   How do I format//newfs or whatever, and add the files to /etc/fstab?
>   I thought the details would be in the handbook.ascii, but found the
>   section yet to be filled in.

Here is one of the two documents I have.  If this doesn't work for you, or
you prefer to share this disk with other OSes, let me know and I'll send
you the long version.

This will eventually be formatted and submitted, once I get a disk to
experiment with.

> The easiest way (esp. with SCSI) is to not mess with them at all and use
> the 'auto' disktype. 

     If and only if all of the following are true:

* You're an intermediate- to expert-level user.  (DON'T EVEN THINK ABOUT
  DOING THE FOLLOWING IF YOU'RE A NOVICE USER!)

* You have a SCSI disk (IDE drives may work in the following, but I
  don't know).

* You want to dedicate the *ENTIRE* disk to FreeBSD.  This is
  *IMPORTANT*, as the following assumes that you really do want to
  dedicate the entire disk to FreeBSD (yes, *all* of it).  If you want
  to use even a teensy, tiny part of the disk for something else like
  MSDOS or Windows, you CANNOT use the following instructions.  Period.

* You have no data on the disk that you want to keep.

* You don't mind losing ALL DATA that is currently on the disk.

* You don't mind destroying any and all MSDOS or Windows 3.1/95/NT or
  any other information that is on the disk.

* You don't plan on using or sharing the disk with other operating
  systems (e.g., MSDOS or Windows).

* You want to partition the *ENTIRE* FreeBSD slice into a single FreeBSD
  filesystem.  (If this isn't true, you have to change the "newfs"
  command below.)

Then, the easiest way to add a dedicated disk is the following:

* First, determine the base disk name of the disk you want to
  add/dedicate (e.g., "sd1").

* Assuming that "sd1" really is correct, do the following (assuming
  Bourne shell /bin/sh syntax):

	# This won't work if you're using /bin/csh:
	d=sd1
	dd if=/dev/zero of=/dev/r$d count=2
	disklabel /dev/r$d | disklabel -B -R -r $d /dev/stdin
	# We only want one partition, so using slice 'c' should be fine:
	newfs /dev/r${d}c

  (Thanks to Bruce Evans for the procedure.)

You can then mount the drive via a command like:

	mount /dev/${d}c /mnt

Expert users can partition the FreeBSD slice into multiple filesystems
using a slightly different procedure:

	# This won't work if you're using /bin/csh:
	d=sd1
	dd if=/dev/zero of=/dev/r$d count=2
	TMP=/tmp/label$$
	disklabel /dev/r$d > $TMP
	# Edit disklabel to add partitions:
	vi $TMP
	disklabel -B -R -r $d $TMP
	# newfs partitions appropriately

     To comment on the earlier message: you don't need entries in
/etc/disktab to add new disks (this file is probably obsolete).  All you
might need to know is the disk geometry used at boot time (unnecessary
in certain cases, like dedicated disks), and, maybe, the size of the
disk in blocks (this is automatically determined for SCSI disks, and
probably also for IDE ones).

> In response to the shiny automatic way to add disks, I saw an announcement
> some time ago for a perl script which automates this somewhat.  I wish I
> had the reference, you might check the -current and possibly -announce
> archives for that one.

     I uploaded such a perl script to freefall, but it turns out that it
works only with 2.2-snap-960801, and maybe versions up to 2.2-current
(it depends on an undocumented ioctl() -- DIOCGCSLICEINFO).  I hope to
fix this, and upload a new version in the next week or so.

     For those of you who missed the earlier announcement, this perl
script provides an easy way to create a Bourne shell script that
initializes a disk using fdisk, disklabel, and newfs.  A Bourne shell
script is created because it's very useful for (1) disaster recovery
(you don't need perl on a fixit disk), and (2) a production environment
where you want to create lots of identical systems (just run the script
to initialize disks).  It's also aimed at intermediate- to expert-level
users, as it doesn't mount the new filesystems or edit /etc/fstab (which
are trivial for these users).

     -- Darryl Okahata
	Internet: darrylo@sr.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Hewlett-Packard, or of the
little green men that have been following him all day.


Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.94.970112121746.4490C-100000>