2bee656802
Submitted by: Eivind
137 lines
5.9 KiB
Text
137 lines
5.9 KiB
Text
<!-- This is an SGML document in the linuxdoc DTD describing
|
|
Disks and FreeBSD. By David O'Brien, 1998.
|
|
|
|
$Id: disks.sgml,v 1.3 1998-05-15 09:36:42 obrien Exp $
|
|
|
|
The FreeBSD Documentation Project
|
|
|
|
<!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN">
|
|
|
|
<article>
|
|
<title> Disks and FreeBSD
|
|
<author> David O'Brien <tt/obrien@cs.ucdavis.edu/
|
|
<date> 26 April 1998, (c) 1998
|
|
|
|
<abstract> This document describes disk administration task under
|
|
FreeBSD. It tells how to set up disks and bring them online.
|
|
</abstract>
|
|
|
|
<toc>
|
|
-->
|
|
|
|
<chapt><heading>Disks<label id="disks"></heading>
|
|
|
|
<p><em>Contributed by &a.obrien;<newline>26 April 1998</em>
|
|
|
|
<p>Lets say we want to add a new SCSI disk to a machine that currently
|
|
only has a single drive. First turn off the computer and install the
|
|
drive in the computer following the instructions of the computer,
|
|
controller, and drive manufacturer. Due the wide variations of procedures
|
|
to do this, the details are beyond the scope of this document.
|
|
|
|
<p>Login as user <it>root</it>. After you've installed the drive,
|
|
inspect <tt>/var/run/dmesg.boot</tt> to ensure the new disk was found.
|
|
Continuing with our example, the newly added drive will be <tt>sd1</tt>
|
|
and we want to mount it on <tt>/1</tt>.
|
|
(if you are adding an IDE drive substitute <tt>wd</tt> for <tt>sd</tt>)
|
|
|
|
<p>Because FreeBSD runs on IBM-PC compatible computers, it must take into
|
|
account the PC BIOS partitions. These are different from the traditional
|
|
BSD partitions. A PC disk has up to four BIOS partition entries. If the
|
|
disk is going to be truly dedicated to FreeBSD, you can use the
|
|
<it>dedicated</it> mode. Otherwise, FreeBSD will have to live with in
|
|
one of the PC BIOS partitions. FreeBSD calls the PC BIOS partitions,
|
|
<it>slices</it> so as not to confuse them with traditional BSD
|
|
partitions. You may also use slices on a disk that is dedicated to
|
|
FreeBSD, but used in a computer that also has another operating system
|
|
installed. This is to not confuse the <tt>fdisk</tt> utility of the other
|
|
operating system.
|
|
|
|
<p>In the slice case the drive will be added as <tt>/dev/sd1s1e</tt>.
|
|
This is read as: SCSI disk, unit number 1 (second SCSI disk), slice 1
|
|
(PC BIOS partition 1), and <tt>e</tt> BSD partition.
|
|
In the dedicated case, the drive will be added simply as <tt>/dev/sd1e</tt>.
|
|
|
|
<sect><heading> Using sysinstall</heading>
|
|
<p> You may use <tt>/stand/sysinstall</tt> to partition and label a new
|
|
disk using its easy to use menus. Either login as user <it>root</it>
|
|
or use the <tt>su</tt> command. Run <tt>/stand/sysinstall</tt> and enter
|
|
the <it>Configure</it> menu. With in the <tt>FreeBSD Configuration
|
|
Menu</tt>, scroll down and select the <it>Partition</it> item. Next you
|
|
should be presented with a list of hard drives installed in your system.
|
|
If you do not see <tt>sd1</tt> listed, you need to recheck your physical
|
|
installation and <tt>dmesg</tt> output in the file
|
|
<tt>/var/run/dmesg.boot</tt>.
|
|
|
|
<p>Select <tt>sd1</tt> to enter the <tt>FDISK Partition Editor</tt>.
|
|
Choose <tt>A</tt> to use the entire disk for FreeBSD. When asked if you
|
|
want to ``remain cooperative with any future possible operating systems'',
|
|
answer <it>YES</it>. Write the changes to the disk using <it>W</it>.
|
|
Now exit the FDISK editor using <it>q</it>.
|
|
Next you will be asked about the Master Boot Record. Since you are
|
|
adding a disk to an already running system, choose <it>None</it>.
|
|
|
|
<p>Next enter the <it>Disk Label Editor</it>. This is where you will
|
|
create the traditional BSD partitions. A disk can have up to eight
|
|
partitions, labeled a-h. A few of the partition labels have special
|
|
uses. The <it>a</it> partition is used for the root partition (/).
|
|
Thus only your system disk (e.g, the disk you boot from) should have
|
|
an <it>a</it> partition.
|
|
The <it>b</it> partition is used for swap partitions, and you may
|
|
have many disks with swap partitions. The <it>c</it> partition
|
|
addresses the entire disk in dedicated mode, or the entire FreeBSD
|
|
slice in slice mode. The other partitions are for general use.
|
|
|
|
<p>Sysinstall's Label editor favors the <it>e</it> partition for non-root,
|
|
non-swap partitions. With in the Label editor, create a single file
|
|
system using <it>C</it>. When prompted if this will be a FS (file
|
|
system) or swap, choose ``FS'' and give a mount point (e.g,
|
|
<tt>/mnt</tt>). When adding a disk in post-install mode, Sysinstall
|
|
will not create entries in <tt>/etc/fstab</tt> for you, so the
|
|
mount point you specify isn't important.
|
|
|
|
<p>You are now ready to write the new label to the disk and create a
|
|
file system on it. Do this by hitting <it>W</it>. Ignore any errors
|
|
from Sysinstall that it could not mount the new partition. Exit
|
|
the Label Editor and Sysinstall completely.
|
|
|
|
<p>The last step is to edit <tt>/etc/fstab</tt> to add an entry for your
|
|
new disk.
|
|
|
|
<sect><heading> Using command line utilities</heading>
|
|
|
|
<sect1><heading> * Using Slices</heading>
|
|
|
|
<sect1><heading> Dedicated</heading>
|
|
<p>If you will not be sharing the new drive with another operating system,
|
|
you may use the <it>dedicated</it> mode. Remember this mode can confuse
|
|
Microsoft operating systems; however, no damage will be done by them.
|
|
IBM's OS/2 however, will "appropriate" any partition it finds which
|
|
it doesn't understand.
|
|
<tscreen><verb>
|
|
dd if=/dev/zero of=/dev/rsd1 bs=1k count=1
|
|
disklabel -Brw sd1 auto
|
|
disklabel -e sd1 # create the `e' partition
|
|
newfs -d0 /dev/rsd1e
|
|
mkdir -p /1
|
|
vi /etc/fstab # add an entry for /dev/sd1e
|
|
mount /1
|
|
</verb></tscreen>
|
|
|
|
An alternate method is:
|
|
|
|
<tscreen><verb>
|
|
dd if=/dev/zero of=/dev/rsd1 count=2
|
|
disklabel /dev/rsd1 | disklabel -BrR sd1 /dev/stdin
|
|
newfs /dev/rsd1e
|
|
mkdir -p /1
|
|
vi /etc/fstab # add an entry for /dev/sd1e
|
|
mount /1
|
|
</verb></tscreen>
|
|
|
|
|
|
<sect><heading> * Non-traditional Drives</heading>
|
|
<sect1><heading> * Zip Drives</heading>
|
|
<sect1><heading> * Jazz Drives</heading>
|
|
<sect1><heading> * Sequest Drives</heading>
|
|
|