The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

12.3 Adding Disks

Originally contributed by David O'Brien.

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 to the wide variations of procedures to do this, the details are beyond the scope of this document.

Login as user root. After you have installed the drive, inspect /var/run/dmesg.boot to ensure the new disk was found. Continuing with our example, the newly added drive will be da1 and we want to mount it on /1 (if you are adding an IDE drive, the device name will be wd1 in pre-4.0 systems, or ad1 in most 4.X systems).

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 dedicated mode. Otherwise, FreeBSD will have to live within one of the PC BIOS partitions. FreeBSD calls the PC BIOS partitions slices 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 fdisk utility of the other operating system.

In the slice case the drive will be added as /dev/da1s1e. This is read as: SCSI disk, unit number 1 (second SCSI disk), slice 1 (PC BIOS partition 1), and e BSD partition. In the dedicated case, the drive will be added simply as /dev/da1e.

12.3.1 Using sysinstall(8)

  1. Navigating Sysinstall

    You may use /stand/sysinstall to partition and label a new disk using its easy to use menus. Either login as user root or use the su command. Run /stand/sysinstall and enter the Configure menu. Within the FreeBSD Configuration Menu, scroll down and select the Fdisk option.

  2. fdisk Partition Editor

    Once inside fdisk, we can type A to use the entire disk for FreeBSD. When asked if you want to ``remain cooperative with any future possible operating systems'', answer YES. Write the changes to the disk using W. Now exit the FDISK editor by typing q. Next you will be asked about the Master Boot Record. Since you are adding a disk to an already running system, choose None.

  3. Disk Label Editor

    Next, you need to exit sysinstall and start it again. Follow the directions above, although this time choose the Label option. This will enter the Disk Label Editor. 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 a partition is used for the root partition (/). Thus only your system disk (e.g, the disk you boot from) should have an a partition. The b partition is used for swap partitions, and you may have many disks with swap partitions. The c 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 e partition for non-root, non-swap partitions. Within the Label editor, create a single file system by typing C. When prompted if this will be a FS (file system) or swap, choose FS and type in a mount point (e.g, /mnt). When adding a disk in post-install mode, sysinstall will not create entries in /etc/fstab for you, so the mount point you specify is not important.

    You are now ready to write the new label to the disk and create a file system on it. Do this by typing W. Ignore any errors from sysinstall that it could not mount the new partition. Exit the Label Editor and sysinstall completely.

  4. Finish

    The last step is to edit /etc/fstab to add an entry for your new disk.

12.3.2 Using Command Line Utilities

12.3.2.1 Using Slices

This setup will allow your disk to work correctly with other operating systems that might be installed on your computer and will not confuse other operating systems' fdisk utilities. It is recommended to use this method for new disk installs. Only use dedicated mode if you have a good reason to do so!

    # dd if=/dev/zero of=/dev/rda1 bs=1k count=1
    # fdisk -BI da1 #Initialize your new disk
    # disklabel -B -w -r da1s1 auto #Label it.
    # disklabel -e da1s1 # Edit the disklabel just created and add any partitions.
    # mkdir -p /1
    # newfs /dev/da1s1e # Repeat this for every partition you created.
    # mount -t ufs /dev/da1s1e /1 # Mount the partition(s)
    # vi /etc/fstab # Add the appropriate entry/entries to your /etc/fstab.

If you have an IDE disk, substitute ad for da. On pre-4.X systems use wd.

12.3.2.2 Dedicated

If you will not be sharing the new drive with another operating system, you may use the dedicated 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 does not understand.

    # dd if=/dev/zero of=/dev/rda1 bs=1k count=1
    # disklabel -Brw da1 auto
    # disklabel -e da1               # create the `e' partition
    # newfs -d0 /dev/rda1e
    # mkdir -p /1
    # vi /etc/fstab               # add an entry for /dev/da1e
    # mount /1

An alternate method is:

    # dd if=/dev/zero of=/dev/rda1 count=2
    # disklabel /dev/rda1 | disklabel -BrR da1 /dev/stdin
    # newfs /dev/rda1e
    # mkdir -p /1
    # vi /etc/fstab                   # add an entry for /dev/da1e
    # mount /1

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру