134 lines
5.8 KiB
Text
134 lines
5.8 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.2 1998-05-13 19:02:29 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.
|
|
|
|
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>)
|
|
|
|
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 not confuse the <tt>fdisk</tt> utility of the other
|
|
operating system.
|
|
|
|
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 systinstall</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>.
|
|
|
|
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>.
|
|
|
|
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 (/).
|
|
A system should only use the <it>a</it> partition on the system disk.
|
|
The <it>b</it> 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.
|
|
|
|
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. Use
|
|
<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.
|
|
|
|
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.
|
|
|
|
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.
|
|
<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/rsd1c
|
|
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>
|
|
|