Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!arclight.uoregon.edu!hammer.uoregon.edu!news.uoregon.edu!Symiserver2.symantec.com!news From: tedm@agora.rdrop.com Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: How to add in another hard disk Date: 14 Dec 1996 19:00:02 GMT Organization: Symantec Corp. Lines: 107 Message-ID: <58utfi$7q3@Symiserver2.symantec.com> References: <01bbe690$2499f810$373bf5c0@sequel> <32AF6816.45F8@OntheNet.com.au> Reply-To: tedm@agora.rdrop.com NNTP-Posting-Host: shiva2.central.com X-Newsreader: IBM NewsReader/2 v1.2.5 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:32603 In <32AF6816.45F8@OntheNet.com.au>, Tony Griffiths <tonyg@OntheNet.com.au> writes: >JinG wrote: >> >> Hi, all: >> >> After FreeBSD 2.1.5 installation, I wish to add in 2nd hard disk, >> /dev/wd1, >> how to partition it and create new filesystem, and mount this hd to /usr2 > >The utilities you need to use, in this order are- > > fdisk : create a DOS-style disk label > disklabel : create a Unix partition label > newfs : create a Unix File System > vi : edit your "/etc/fstab" file > >There are man pages on all of these utilities and the structure of the >fstab file. > Actually, you can also use /stand/sysinstall to do some of this uglyness for you. Here is what I did recently to add a second disk to a FreeBSD machine: 1) Physically mounted the drive into the machine, verified that the master/slave jumpers were properly set, etc. 2) Booted the computer with a DOS disk and ran FDISK and verified that I could see both disks. Created a partition table on the new disk. 3) Booteded with a DOS disk and ran the DOS format command on the new disk. 4) Ran ScanDisk and beat on the disk for a couple of hours to make absolutely sure that there were no bad blocks on the disk. 5) Booted DOS, ran FDISK, and deleted the partition on the new disk. 6) Booted FreeBSD, logged into the colsole as root, and ran /stand/sysinstall 7) Selected option # 6, Custom 8) Selected option #2, Partition 9) Selected wd1 10) Selected A, Use Entire Disk, then selected No when asked to make it compatible with eixting operating systems 11) Selected W to write changes. 12) Selected Leave the Master Boot Record Untouched 13) At this point, I tried going back to the main menu and running Label to set up a partition on the disk, but sysinstall barfed, :-( so I had to do it by hand. Hopefully, this will get fixed in a future release of BSD. Steps 14 - 19 are basically what Label should have done. 14) Exited sysinstall, created /usr2, and edited /etc/fstab with vi 15) copied the /dev/wd0a line to the end of the fstab file and edited it to read: /dev/wd1a /usr2 ufs rw 1 1 16) ran disklabel -r -e wd1 This brings up the disk parameters into an editor. I went through these and made sure that everything was what it was supposed to be. 17) In this screen is a line called sectors/unit: with a number after this. This is the size you have available. Mine was 647073 18) At the bottom of the screen is: 8 partitions: # size offset fstype [fsize bsize bps/cpg] Under it is all the partitions you want on the disk. On mine, I set the entire disk to one giant partition by copying the C: partition as such. (the c partition is BSD'ese for "the entire disk") my label looked like this: a: 647073 0 4.2BSD 0 0 0 # (Cyl. 0 - 641*) c: 647073 0 unused 0 0 0 # (Cyl. 0 - 641*) On a fresh disk, there will only be a c: unused line. 19) Then I wrote and quit the editor, this automatically writes out the disklabel to the disk. 20) Now, you have to create the filesystem on the a partition, with the command: newfs /dev/wd1a Last, reboot (to have fsck check everything and make sure the disk properly automounts. The very last check is a little dangerous, and before doing it I'd suggest that you have a complete backup. Bring up the system and make sure that it is quiescent with NO DISK ACTIVITY AT ALL. Then, power cycle the system WITHOUT DOING A SHUTDOWN. What this does is brings up the disks without the clean flag set, and the fsck check should then verify the disk. If you didn't have any disk activity going you shouldn't lose any files or trash your disks or any of the other horrible stuff that you read. If you made a mistake anywhere on the second disk, fsck will puke with bad magic number or other errors and you can try the whole procedure again. I'll probably be jumped all over for that last, but hey, wouldn't you rather find out there is a configuration error BEFORE you start putting files on the drive?