Date: Mon, 11 Nov 1996 17:35:26 -0800 (PST) From: Doug White <dwhite@gdi.uoregon.edu> To: Guy Silliman <gws@marygreen.com> Cc: freebsd-questions@freebsd.org Subject: Re: Adding another drive Message-ID: <Pine.BSI.3.94.961111173443.24113E-100000@gdi.uoregon.edu> In-Reply-To: <Pine.BSF.3.91.961110104443.181A-100000@mgp.marygreen.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 10 Nov 1996, Guy Silliman wrote:
> Hello... I have been trying to figure out how to get an additional drive
> partitioned and label for use.
>
> It is a scsi drive, 1gig... everything seems fine except I can't seem to
> get a label to stick...
Inbound!
> 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.961111173443.24113E-100000>
