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

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

Mounting All Standard Filesystems

To mount all the filesystems listed in /etc/fstab, use the −a option. (The filesystems will use whatever options are given in /etc/fstab.)

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

# mount −a

#

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

Mounting at Nonstandard Locations

To mount filesystems at arbitrary locations, specify them by device name and mount point. You might use this option when installing a new disk, such as mounting the old disk partitions as /old/var, /old/home, and so on, so you can copy their contents at your leisure.

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

# mount /dev/fd0 /home/mwlucas/floppy

#

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

Unmounting

When you have finished with a piece of removable media, eject it with umount(8). Enter the directory where the media is mounted (/home/mwlucas/floppy in the following example) as an argument.

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

# umount /home/mwlucas/floppy

#

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

If you cannot unmount a drive, you're probably accessing it in some way. For example, you cannot unmount a drive while you have a command prompt in a directory on it or while you're reading from or writing to it.

Soft Updates

Soft updates is the biggest innovation to hit FFS in years. Soft updates organize and arrange disk writes so that the filesystem metadata on the disk remains consistent and it comes close to giving the performance of an async mount with the reliability of a sync mount. While that doesn't mean that the data will all be written to disk–a power failure at the wrong moment will still corrupt data–a

376

soft update will prevent a lot of problems.

Enabling Soft Updates

If you followed the suggestions in Chapter 1, you installed your system with soft updates enabled. (Running mount without arguments will tell you whether soft updates are turned on.) However, if you didn't turn on soft updates, they're fairly easy to enable–or disable–with the filesystem tuning program tunefs(8). (Tunefs has many other functions, but most of them require in−depth knowledge of the filesystem.)

To enable soft updates, boot your system into single−user mode, unmount the filesystems you want to change, and use tunefs to enable soft updates:

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

#umount /usr

#tunefs −n enable /usr

#mount /usr

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

Now boot into multi−user mode, and you'll have soft updates! Having done this once, the filesystem remembers that it is running soft updates across reboots.

To disable soft updates on a partition, replace the enable in the previous example with disable.

IDE Write Caching and Soft Updates

Like all filesystems, soft updates works best with SCSI hard drives, due to the robustness of the SCSI architecture. Still, soft updates works as well as the IDE architecture allows, with one critical exception: Many modern IDE drives support write caching.

Write−caching IDE drives have a small onboard chip that records data that needs to be written to the drive. This can be tricky for soft updates, because soft updates expects the hard drive to be honest–when the hard drive reports that data is written to disk, it expects that data to be on that platter. But IDE write caching reports when the data is safely stored in the drive's cache, not when it has been written, and it may be a second or more until that data is actually on the disk.

While this differential wouldn't pose a big risk if this only happened on occasion, it occurs continuously on a server. As such, if you care about your data, you should disable write caching by adding the following line to /boot/loader.conf:

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

hw.ata.wc=0

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

While disabling write caching will slow down the IDE drive somewhat, your data will be safe. I safely run with write caching enabled on desktop and laptop machines, where data is not being written to disk continually, but on servers it's a very bad idea to leave IDE write caching on.[4]

[4]It's just generally a bad idea to use IDE disks in servers, but I think you have the point by now.

377