Вы находитесь на странице: 1из 1

File System Damage - Orphans and Lost+Found

When a Unix file system suffers damage, one or more nodes may become unreadable. If the
damaged nodes are file nodes, the file data blocks pointed to by those nodes will be missing or
incomplete. If any of the nodes are directory nodes, containing the names of files and sub-
directories, the files and sub-directories that were once pointed to by those nodes will lose their
names and become "orphans" - nodes with nothing pointing to them.

At boot time, the Unix file-system checking program, fsck, notices the existence of files and sub-
directories that no longer have names. (It finds file nodes with a positive link count but can't find
any directories that link to the nodes.) fsck gives the orphans false names (most Unix systems
create new names that are just the node numbers) and links them into a special directory named
"lost+found" when the system reboots itself. The system admin must go into the directory and
figure out what the files are, what their names are, and where they belong.

Note that only the names are lost when a directory is damaged. The owner, permissions, and
access times are all stored with the data, and are not lost.

Many File Systems - one ROOT


A Unix file system is equivalent to a single disk partition. Each Unix file system has its own set
of node numbers. Since the overall hierarchical tree on a Unix system may transparently include
pieces from several file systems (from several partitions), some items in the hierarchical tree will
appear to have the same node numbers, but will actually be different files residing on different
file systems.

A directory's name-to-number mapping applies only within a single Unix file system. It isn't
possible for a directory to map to a node number in a different file system (i.e. in a different disk
partition). A special "mount" command is used to splice together different file systems into one
hierarchical tree.

The "-i" option to the "ls" command shows which node number is associated with a file or
directory; the "df" command can show on which disk partition (file system) the file or directory
resides:

$ df / /usr
Filesystem 512-blocks Free %Used Mounted on
/dev/hd4 49152 10280 80% /
/dev/hd2 2236416 92928 96% /usr

Files under / and under /usr would appear to have the same node numbers; but, being on different
file systems, they are really different files.

Вам также может понравиться