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

Mounting and Unmounting Disks

Mount(8) mounts disk devices onto your filesystem. (Go ahead and boot your FreeBSD machine into single−user mode [see Chapter 3] and follow along.)

On boot, the system mounts the root partition, which gives it enough information to do basic setup and get core systems running before mounting the rest of the filesystems. To do anything interesting in single−user mode, though, you'll need to mount your other filesystems.

Mounting Standard Filesystems

To mount a filesystem that is listed in /etc/fstab, such as /usr or /var, enter a command like this:

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

# mount /usr

#

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

This mounts /usr as read−write.

Mounting with Options

To use a separate option, such as read−only, you can use the options flag −o. These options include async, noasync, sync, rdonly, nodev, and noexec, as discussed in the "FFS Mount Types" section earlier. For example, to mount /usr as read−only, enter this:

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

# mount −o rdonly /usr

#

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

A read−only mount is a great choice for a damaged filesystem. In the past, I've had filesystems that were so badly damaged that they wouldn't fsck. (These were Usenet news servers with hundreds of thousands of articles, and I generally did something to damage them badly. Hey, everybody has to learn somehow.) If you just want to pull some information off the disk without risking further damage to data, you can mount the partition as read−only and copy to your heart's content. (This isn't true in the case of physical disk damage, mind you; if one of the platters is coming apart, you're basically doomed.)

Forcing Read−Write Mounts

If a partition is marked dirty, you will need to fsck it before mounting it as readwrite. While this generally isn't a problem, you may not want to fsck it for various reasons. If so, you can try using the −f flag to force it to mount, though forcing a mount has a good chance of crashing your system, again.

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

# mount −f /usr

#

375