From owner-freebsd-questions Fri Feb 21 23:29:59 1997 Return-Path: <owner-questions> Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id XAA26692 for questions-outgoing; Fri, 21 Feb 1997 23:29:59 -0800 (PST) Received: from gdi.uoregon.edu (gdi.uoregon.edu [128.223.170.30]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA26685 for <questions@FreeBSD.ORG>; Fri, 21 Feb 1997 23:29:56 -0800 (PST) Received: from localhost (dwhite@localhost) by gdi.uoregon.edu (8.8.5/8.6.12) with SMTP id XAA00821; Fri, 21 Feb 1997 23:29:56 -0800 (PST) Date: Fri, 21 Feb 1997 23:29:56 -0800 (PST) From: Doug White <dwhite@gdi.uoregon.edu> X-Sender: dwhite@localhost Reply-To: Doug White <dwhite@resnet.uoregon.edu> To: Mike Tancsa <mike@sentex.net> cc: questions@FreeBSD.ORG Subject: Re: Help with IDE drive... In-Reply-To: <3.0.1.32.19970221192904.00b14860@sentex.net> Message-ID: <Pine.BSI.3.94.970221232913.421I-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Fri, 21 Feb 1997, Mike Tancsa wrote: > I have decided to kill my Win95 partition and take it over with FreeBSD. > The problem is, is that I am having no end of troubles trying to disklabel > it... You need to disklabel -w this at some point. Try these instructions. Return-Path: POPmail Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by resnet.uoregon.edu (8.6.12/8.6.12) with SMTP id VAA13274; Thu, 25 Apr 1996 21:10:35 -0700 Received: from freefall.FreeBSD.ORG by halloran-eldar.lcs.mit.edu; (5.65/1.1.8.2/19Aug95-0530PM) id AA30670; Fri, 26 Apr 1996 00:10:26 -0400 Received: from localhost (daemon@localhost) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA17293 Thu, 25 Apr 1996 15:50:21 -0700 (PDT) Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA17204 for questions-outgoing; Thu, 25 Apr 1996 15:48:42 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198..17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA17199 for <questions@FreeBSD.ORG>; Thu, 25 Apr 1996 15:48:30 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id PAA25630; Thu, 25 Apr 1996 15:43:15 -0700 From: Terry Lambert <terry@lambert.org> Message-Id: <199604252243.PAA25630@phaeton.artisoft.com> Subject: A: Installing a second disk drive To: matt@xanadu2.net (Matthew Z. Stout) Date: Thu, 25 Apr 1996 15:43:15 -0700 (MST) Cc: questions@FreeBSD.org In-Reply-To: <317FC95A.200F@xanadu2.net> from "Matthew Z. Stout" at Apr 25, 96 12:50:02 pm X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk Status: O > I have sent several pieces of e-mail in the past few days, and am in > desperate need of a reply. I need to know the exact procedure for > preparing a new hard drive for use in a FreeBSD 2.1 machine. I have a > 2.2 gig SCSI-2 hard drive, and have been struggling with fdisk and > newfs for a week now. I simply need someone to outline the proper > steps for use of fdisk, newfs and mount in the installation of this > hard drive. This is covered both in the handbook and in the -questions archive. Undoubtedly, a search didn't find it because someone used the subject "Need Help!!!" or something similar instead of using something like "Q: Installing a second disk drive". Here are the long and short versions. If you are not running -current or a recent snap, you will need to use the long version. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. =========================================================================== This should be the handbook entry: ] Hmm.. I have a feeling this is 'unsupported' to say the least, but ] after mucking around with fdisk and disklabel, and still getting ] errors from newfs, I wound up doing ] ] <change to console 0> ] login as root ] cd /stand ] ./sysinstall ] ] now do "partition" (or whatever the first selection is) ] After defining everything on the right disk, hit "w" to go into wizard ] mode. From here, do "write". ] Then repeat with "label" (or whatever the second selection is). ] Exit, and newfs ] ] No warranties, but this worked for me when adding the 4th SCSI disk. ] ] -Terje ] ____________________________________________________________________ ] Terje Thoegersen, Systems Consultant | terje.thogersen@hda.hydro.com ] Norsk Hydro a.s, Hydro Data | Tel : +47 2273 9298 ] P.O.Box 200, | Fax : +47 2273 9614 ] 1321 Stabekk, Norway | Pager : 966 32801 Here is the "long form": ] Again, ] ] Here is Seppo Kalio's excellent documentation on how to add a second ] disk. ] ] ] Thanks for everyone who did help me! I hope we did all learn ] something.. ] ] I have now done this about 10 times and now I feel I know something ] about it. ] ] I agree with John Capo <jc@irbs.com> that it is trivial after you ] know how ] to do it ;-). And I agree that the biggest problem is fdisk. It is ] not ] trivial what parameters you have change and how! The disklabel -e -r ] sd1 is ] not so hard to use. Nor newfs or mount ;-) ] ] ] ----------------------------------------------------------------------- ] Here final (?) text how to do it. Or how I have done it. ] ] In an example here I have 80MB SCSI disk (in a AHA 2940 controller), ] FreeBSD 2.0.5R. ] ] You have to start with fdisk (# -lines written by me): ] ] # fdisk -i -u /dev/rsd1 ] ******* Working on device /dev/rsd1 ******* ] parameters extracted from in-core disklabel are: ] cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl) ] ] Figures below won't work with BIOS for partitions not in cyl 1 ] parameters to be used for BIOS calculations are: ] cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl) ] ] # The cylinder count is nonsence, the disk is 80-81 MB, ] # so it should be 80 or 81. Head and sector count OK. ] # On all Adaptec controlled disks heads=64 and sectors=32 ] # The head count has nothing to do with the disk drive hardware ] # head count. Same with cylinder and sector count. ] ] Do you want to change our idea of what BIOS thinks ? [n] n ] ] # Wrong cylinder count does not matter, forward! ] ] Warning: BIOS sector numbering starts with sector 1 ] ] # This should be: "First sector must be 1" ] ] Information from DOS bootblock is: ] The data for partition 0 is: ] sysid 165,(FreeBSD/NetBSD/386BSD) ] ] # Sysid you must know it is 165, it is zero when you have empty disk ] # Where are the docs about this? ] ] start 32, size 163840 (80 Meg), flag 80 ] beg: cyl 0/ sector 1/ head 0; ] end: cyl 79/ sector 32/ head 63 ] Do you want to change it? [n] y ] Supply a decimal value for "sysid" [0] 165 # FreeBSD = 165 ] Supply a decimal value for "start" [0] 0 # 0 (32 on bootdisk?) ] Supply a decimal value for "size" [0] 163840 # This comes from ] 80*32*64 ] # If bootdisk, you must substract 2048 (=32*64) ????????? ] Explicitly specifiy beg/end address ? [n] y ] Supply a decimal value for "beginning cylinder" [0] # (* ] Supply a decimal value for "beginning head" [0] # (* ] Supply a decimal value for "beginning sector" [0] 1 # Must be 1 (* ] Supply a decimal value for "ending cylinder" [0] 79 # Cylinders 0 to ] 79=80 ] Supply a decimal value for "ending head" [0] 63 # (* ] Supply a decimal value for "ending sector" [0] 32 # (* ] sysid 165,(FreeBSD/NetBSD/386BSD) ] start 0, size 163840 (80 Meg), flag 0 ] beg: cyl 0/ sector 1/ head 0; ] end: cyl 79/ sector 32/ head 63 ] Are we happy with this entry? [n] ] ] # (* are same to all disks in Adaptec SCSI controllers. ] # Ending cylinder is same number as the MB count minus one (here ] 80-1) ] ] The data for partition 1 is: ] <UNUSED> ] Do you want to change it? [n] n ] The data for partition 2 is: ] <UNUSED> ] Do you want to change it? [n] n ] The data for partition 3 is: ] <UNUSED> ] Do you want to change it? [n] n ] Do you want to change the active partition? [n] n ] ] We haven't changed the partition table yet. This is your last ] chance. ] parameters extracted from in-core disklabel are: ] cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl) ] ] Figures below won't work with BIOS for partitions not in cyl 1 ] parameters to be used for BIOS calculations are: ] cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl) ] ] Information from DOS bootblock is: ] 0: sysid 165,(FreeBSD/NetBSD/386BSD) ] start 0, size 163840 (80 Meg), flag 0 ] beg: cyl 0/ sector 1/ head 0; ] end: cyl 79/ sector 32/ head 63 ] 1: <UNUSED> ] 2: <UNUSED> ] 3: <UNUSED> ] Should we write new partition table? [n] y # if all is correct ] ] # you will get following error message, forget it. ] ] ioctl DIOCWLABEL: Operation not supported by device ] ] # Then start disklabel -e -r sd1 ] ] # You will get a screen something like: ] ] ] ------------------------------------------------------------------------ ] # /dev/rsd1c: ] type: SCSI ] disk: d80mb ] label: ] flags: ] bytes/sector: 512 ] sectors/track: 32 ] tracks/cylinder: 64 ] sectors/cylinder: 2048 ] cylinders: 80 ] sectors/unit: 165888 ] rpm: 3600 # If this is zero, put here 3600 ] interleave: 1 # If this is zero, put here 1 ] trackskew: 0 ] cylinderskew: 0 ] headswitch: 0 # milliseconds ] track-to-track seek: 0 # milliseconds ] drivedata: 0 ] ] 3 partitions: # Uh? ] # size offset fstype [fsize bsize bps/cpg] ] c: 163840 0 unused 0 0 # (Cyl. 0 ] - 79) ] ] -------------------------------------------------------------------------- ] ] # c: is the whole disk, do not touch it! ] ] # I want to add one 10MB swap to this disk, rest space for files. ] # So I write to extra lines (before the c: -line): ] ] a: 143840 20000 4.2BSD 0 0 ] b: 20000 0 swap ] ] # Note: the sum of size fields is a+b=c. The offset is the starting ] # block number of the partition. When swap starts from 0 and is ] # 20000 blocks then next partition starts from 20000. ] # The extra zeroes on a: line mus be there! ] ] # There it is. Exit from editor, if errors try to correct. ] ] # Next make filesystem: ] ] # newfs /dev/rsd1a ] Warning: calculated sectors per cylinder (4096) disagrees with disk ] label (2048) ] Warning: 3136 sector(s) in last cylinder unallocated ] /dev/rsd1a: 123840 sectors in 31 cylinders of 1 tracks, 4096 ] sectors ] 60.5MB in 2 cyl groups (16 c/g, 32.00MB/g, 7680 i/g) ] super-block backups (for fsck -b #) at: ] 32, 65568, ] ] # So some sectors could be defined more .. this terminology is ] awfull: ] # Here newfs is speaking about 3136 sectors. In fdisk we define that ] # the disk has 32 sectors! ] # These must be blocks of 512 bytes, or what are they???? 3136 blocks ] # is 1605632 bytes that is 1.6MB. The actual size of my disk is more ] # than 80MB, it is about 81 MB. ] ] # And mount it: ] ] # mount /dev/sd1a /mnt ] # df ] Filesystem 1K-blocks Used Avail Capacity Mounted on ] /dev/sd0a 96143 30253 58198 34% / ] /dev/sd0s1f 1404471 741255 550858 57% /home ] /dev/sd0s1e 387503 273317 83185 77% /usr ] procfs 4 4 0 100% /proc ] kaarna:/home/www 1518207 1310531 86219 94% /opt/www ] /dev/sd1a 59951 1 55153 0% /mnt ] ] # If you get to this point, you are lucky. It is not easy. The ] # fdisk is the hardest part. ] ] Seppo ] ] ] ] ----------------------------------------------------------------------- ] Andrew Webster Network Manager / Special Projects ] Dataradio Inc. 200-5500 Royalmount Ave. TEL: +1 514 737 0020 ] Town of Mount Royal, QC, CANADA H4P 1H7 FAX: +1 514 737 7883 ] http://www.dataradio.com Email: awebster@dataradio.com =========================================================================== >From j@uriah.heep.sax.de Sun Jul 28 16:08:53 1996 Date: Sat, 27 Jul 1996 13:29:43 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> Reply-To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> To: FreeBSD-current users <freebsd-current@freebsd.org> Cc: Ernie Elu <ernie@spooky.eis.net.au> Subject: Re: Adding a second scsi drive As Ernie Elu wrote: > Can someone one email me a set of instructions on how to add a second scsi > drive with -current without using sysinstall? I mailed my procedure a dozen times: disklabel -Brw sd1 auto disklabel -e sd1 # edit partitions for filesys in `get file system partitions of sd1` do newfs -d0 /dev/rsd1${filesys} done vi /etc/fstab This creates ``dangerously dedicated'' drives (thus no `fdisk' required), as long as this is fine with you, the above is perhaps the easiest way. > Sysinstall still core dumps when I try and usr it to partition and and > disklabel the second drive. Analyze it, and tell Jordan about the actual problem. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) >From darrylo@hpnmhjw.sr.hp.com Tue Oct 1 19:26:51 1996 Date: Mon, 30 Sep 1996 12:44:20 -0700 From: Darryl Okahata <darrylo@hpnmhjw.sr.hp.com> Reply-To: darrylo@sr.hp.com To: Mark Cheeseman <cheese@bbq.websource.com.au> Cc: questions@freefall.freebsd.org Subject: Re: Adding a second disk - what am I missing? > I thought sysinstall was supposed to take care of that so I haven't tried it > until now. Everything looks sensible except for the last few lines which > say something like (excuse any typos - I don't have cut/paste here): > > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > c: 2031650 0 unused 0 0 # (Cyl. 0 - 27088*) > > Can I just change "unused" to "freebsd"? What should I do about the 8 > partitions? Change it to 1, or leave it as it is? 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 (you did mention "sd0" -- IDE drives may work in the following, but I don't know). * You want to dedicate the *ENTIRE* disk to FreeBSD. * 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 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. 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. Your earlier posting said "sd0", a SCSI disk -- is this correct? This implies that you're probably booting off an IDE disk, and not a SCSI disk, as "sd0" is typically the boot drive (when booting from a SCSI disk). * Assuming that "sd0" really is correct (MAKE SURE OF THIS, AS YOU'LL LOSE ALL DATA ON YOUR BOOT DISK, IF YOU'RE WRONG), do the following (assuming Bourne shell /bin/sh syntax): # This won't work if you're using /bin/csh: d=sd0 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=sd0 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 [ In case anyone's interested, I'm working on a perl script from h*ll that attempts to simplify adding an hard disk (this perl script generates a shell script that does the proper fdisk/disklabel/newfs crud). I hope to release an alpha version this week to solicit comments. ] -- 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