Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Absolute BSD - The Ultimate Guide To FreeBSD (2002).pdf
Скачиваний:
29
Добавлен:
17.08.2013
Размер:
8.15 Mб
Скачать

Chapter 16: Filsystems and Disks

The importance of managing filesystems and disks cannot be overstressed. Disk flexibility and reliability are paramount to the operating system because your disks contain your data. FreeBSD has a variety of filesystems and different ways to handle them. In this chapter, we'll look at the most common things a systems administrator deals with.

Device Nodes

Device nodes are special files that represent a piece of hardware on the system. They're used as logical interfaces between user programs and either a device driver or the physical device. By using a command on a device node, sending information to a device node, or reading data from a device node, you're telling the operating system to perform an action upon a physical device. These actions can be very different for different devices—after all, writing data to a disk generates very different results than writing data to a sound card! These device nodes can be found in the /dev directory.

Before you can do any work with a disk or disk partitions, you need to know its device name, or the name of the file on the disk that represents it. Device node names are frequently cryptic, and are generally based upon the name of the device driver for that piece of hardware; device driver names are, in turn, usually based upon the chipset used in the device, not upon what the device appears to be. See /dev for examples of many different device nodes.

There are man pages covering most device nodes. The device nodes we're most interested in are those for disk devices of one sort or another. The following list shows the most common device nodes you'll encounter. (See the man page for each if you want the gory details.)

Device Node Description

/dev/fd*

Floppy disks

/dev/acd*

IDE CD−ROMs

/dev/ad*

IDE hard disks and partitions

/dev/cd*

SCSI CD−ROMs

/dev/da*

SCSI hard disks and partitions

Hard Disks and Partitions

Let's look at IDE disks first. Our first IDE disk is called /dev/ad0. Subsequent disks would be /dev/ad1, /dev/ad2, and so on, and subdivisions of each disk all start with /dev/ad0[1] and then add something on the end, like /dev/ad0s1b. While you might expect a disk to start off as a monolithic whole, you will see lots of subdivisions if you look in /dev for everything that begins with /dev/ad0:

...............................................................................................

#ls /dev/ad*

 

 

 

/dev/ad0

/dev/ad0s1b

/dev/ad0s1f

/dev/ad0s1h

/dev/ad0s1a

/dev/ad0s1e

/dev/ad0s1g

 

#

 

 

 

...............................................................................................

So, what are all these subdivisions? Think back to when you allocated disk space for FreeBSD. If you followed the recommendations in this book, you used the whole disk for FreeBSD. You could have created a second chunk of disk for another operating system, or even cut the disk into two FreeBSD sections. These sections are called partitions in the Microsoft and Linux world, and slices in FreeBSD land. The "s1" in the preceding /dev/ad* listing represents these large partitions, or

367