Using Linux:Managing the Filesystem
-->
Previous
Table of Contents
Next
How to Organize Your File System Tree
It is often useful to have major parts of the Linux file system on separate partitions; this can make upgrades and reinstalls easier, and it can also facilitate backup and network administration.
Good Candidates for Separate Filesystems
The best candidate for being on a separate filesystem is the /home tree. A separate /home file system means that your own data will survive unscathed even if you have to reinstall everything from scratch. If you have more than one machine, it is often useful to mount /home over the network so that your files can be shared between all the machines.
Other filesystems are made separate for different reasonsfor example, so that they can be mounted over the network, or so that they can have different mount options.
Because the /usr file system is large, it is often on a separate filesystem, sometimes mounted from another machine. A separate /usr also allows you to have a much smaller root (/) partition. Having a small root partition is beneficial because this tends to reduce the chances of it becoming corrupted when the power fails. Having a separate /var partition can help for the same reason.
Some of the machines that I administer are security-critical. On these machines I make /var/log a separate, huge filesystem. There are two reasons for this. First, it means that filling up /tmp or /var will not mean that the system cannot continue to log activity. Second, making /var/log large means that an attacker (or cracker) cant fill up the partition in order to prevent the logging of future activities.
Bad Candidates for Separate Filesystems
There are some directories that absolutely must be part of the root filesystem. These are listed in Table 29.3.
Table 29.3 Essential Linux directories of the root filesystem
Directory Name
Description
/bin
The mount command lives in /bin and if it is not available on the root file system, there is no way to mount any other filesystem.
/sbin
Contains programs essential to booting, such as /sbin/init, the very first program to be started (the kernel starts it in order to get the system going).
/etc
Contains many configuration files that must be present at boot time, such as /etc/inittab, and /etc/fstab.
/dev
Contains device files for all the other filesystems in /dev. The mount command needs these in order to work.
/lib
Contains libraries to which many programs needed at boot time are dynamically linked.
/root
Its a good idea to have roots home directory available even when some filesystems cannot be mounted; useful backup files may be kept there.
Almost any other directories can be on separate filesystems. Insightful users will note that the /boot directory is not in this list. That is because the files in /boot are not needed at boot time; they are needed only when you run the program /sbin/lilo. As long as the BIOS can read these files by sector-by-sector BIOS calls, the kernel can be loaded by the boot loader. After the kernel is loaded and the root file system is mounted, these files have done their job. Having a separate /boot file system allows you to ensure that it resides near the start of a large hard disk. This can be vital for some older PC-compatible machines.
Repairing Filesystems
Some disk data is kept in memory temporarily before being written to disk, for performance reasons (see the previous discussion of the sync mount option). If the kernel does not have an opportunity to actually write this data, the filesystem can become corrupted. This can happen in several ways:
The storage device (for example, a floppy disk) can be manually removed before the kernel has finished with it.
The system might suffer a power loss.
The user might mistakenly turn off the power or accidentally press the reset button.
Previous
Table of Contents
Next
Wyszukiwarka
Podobne podstrony:
499 510Peugeot 508 napełnianie zbiornika dodatku(1)2014 12 23 Dec nr 508 MON 1 BPZ 17 Wlkp BZ odznakiGreer RCI 510 Fault Codes508 (3)510 513WAŻNE !!!! RNS 510 Opis co i jak !!!!!NTC TLV 510 Laser M579 87m04 (508)505 508odblokowanie nawigacja manta 510507 510więcej podobnych podstron