From owner-freebsd-questions Mon Nov 11 17:35:56 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA04635 for questions-outgoing; Mon, 11 Nov 1996 17:35:56 -0800 (PST) Received: from gdi.uoregon.edu (gdi.uoregon.edu [128.223.170.30]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA04625 for ; Mon, 11 Nov 1996 17:35:49 -0800 (PST) Received: from localhost (dwhite@localhost) by gdi.uoregon.edu (8.7.5/8.6.12) with SMTP id RAA24142; Mon, 11 Nov 1996 17:35:27 -0800 (PST) Date: Mon, 11 Nov 1996 17:35:26 -0800 (PST) From: Doug White Reply-To: dwhite@resnet.uoregon.edu To: Guy Silliman cc: freebsd-questions@freebsd.org Subject: Re: Adding another drive In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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