Talking about Linux 's File System

xiaoxiao2021-03-30  196

If you are a novice, maybe you still don't know how to copy the file from Windows to Linux? Below, we will explain the UNIX file system and the Mount work process, and then discuss more detail.

Use of mount and related options. If you have learned how UNIX file system work, you can skip the following section. Otherwise, you should continue to learn the meaning of "mount".

What is MOUNT?

In some operating systems (such as Windows), the computer identifies the device through the device name, for example, most PC systems include "A: Drive", "C: Drive" and "D: Drive" (Generally a read-only disc).

For a variety of reasons, the Linux system generally does not indicate storage devices in this way. The Linux system features a single directory tree (similar to the "C: Drive" directory tree structure on Windows), and looks for the contents of the storage device through the branch of the directory tree.

On this specific computer, there are 4 hard drives, which are all managed by file system. For example, suppose we use the Windows system to name C, D, E, respectively, respectively, respectively, the LINUX path name and the equivalent of Windows are shown in Table 1.

Disk number Linux path equivalent Windows file name 1 / C: / 1 / var c: / var1 / var / number c: / var / spool1 / home c: / home1 / home C: / homejackon2 / usr d: / 2 / usr / lib d: / usr / lib3 / usr / x11r6 E: / 4 / home f: /

The Linux system knows where to find data contained in each path table by maintaining the list of devices in the system, as well as the device in the system, and the device is mount. Because the operation of the data map is automated, the user does not need to remember on which hard drive on which the data is in.

For example, for anonymous FTP users, just remember that / home / ftp is on the "home" directory without having to remember that all FTP files are on "f: /" or the 4th hard drive, which is obviously intuitive. too much. Similarly, remember that the user-oriented library program is all on / usr / lib, which is much more intuitive than the "lib" directory of the user's library program is all in the "lib" directory of the second hard drive.

Equipment Identity

In order to remember where each device is arrived, the Linux system needs to have a unique way to identify each device. For people, the task is completed by finding the device name on the / dev directory. However, this directory contains a large number of special files, each file indicates different types of devices, or partitions on existing devices. For example, / dev / hda devices indicate the first hard drive of the system;

/ DEV / HDA1 indicates the first partition of the first hard drive, and / DEV / HDA2 is the second partition of the second hard drive. Table 2 shows some commonly used equipment files and corresponding devices.

Special Document Equipment / DEV / FD0 Sifak Drive / DEV / FD1 2 Soft Plate Driver / DEV / CDROMCD-ROM Drive / DEV / HDA [1-16] 1-16, 1-1, 1) and Partition 1-16 / DEV / HDB [1-16] second hard drive (IDE2, 2) and partition 1-16 / dev / sda [1-16] 1-16 / dev / sdb [1- 16] Second Hard Drive (SCSI1) and Partition 1-16 / DEV / SDC [1-16] Third Hard Drive (SCSI2) and Partition 1-16 / DEV / SDD [1-16] Fourth Hard Drive (SCSI3 ) And partition 1-16

Of course, there are many devices that have not been possible in Table 2. To see a list of special devices in your system, you can use the following command:

# / s / dev

Don't worry, many devices you will never use, usually don't need to study and remember them.

file format

In addition to remember where each device is used by MOUNT, the Linux system also needs to remember what type of file system exists on each device. For the Windows operating system, most devices store information, only the currently popular format, that is, one of FAT16 or FAT32. Only CD-ROM drives are an obvious exception, which uses ISO-9660 file format. For Linux systems, most device store information uses the extended-2 file system. Similarly, the most significant exception is also a CD-ROM drive, which is still using ISO-9660 file format, but Linux can also identify and other file systems. To see which file systems support your Linux kernel, you can enter the following command:

#cat / proc / filesystems

Let us assume that the results of the above command are:

EXT2

vfat

Noelevproc

ISO9660

For this specific system, Linux kernel supports EXT2, VFAT, PROC, and ISO9660 file systems. Table 3 shows most of the file system types supported by Linux.

File system operating system or type EXT2LINUX EXTENDED-2Minixminix file system MSDOS original FAT file system (short file name) VFAT other FAT file system (long file name) NTFSWINDOWSNT file system (long file name) HPFTOS / 2 high performance file system HFSAPPLEMACINTOSH file System NFS Network File System NCPFSNOVELL NETWARE File System Affsamiga Quick File System

Linux also supports other file systems. In order to allow Linux to support more file systems, need to recompile Linux kernels, or download the relevant modules.

The / etc / fstab file is fortunate, when using the Linux maintenance directory tree, users do not have to be dealt with frequently and device names or file systems. We have mentioned that Linux is in Mount

When the file system is automatically maintained, it also knows where the Mount file system is started every time, mainly it uses the / etc / fstab file. For the 4 devices mentioned above, you can take the relevant content from the / etc / fstab file:

/ DEV / SDA1 / EXT2 Defaults 1 1

/ DEV / SDC1 / USR EXT2 EXT2 DEFAULTS 1 2

/ DEV / SDC1 / USR / X11R6 EXT2 Defaults 1 2

/ DEV / SDC2 / HOME / FTP VFAT Defaults 1 2

For the above-mentioned / etc / fstab information, Linux will be processed by the following steps each time MOUNT:

● Mount First SCSI hard drive's first partition (/ dev / sda1), uses it as the first (root) file system, which is a Linux EXT2 format disk;

● On / usr's directory tree, Mount 2nd SCSI hard drive's first partition (/ dev / sdb1), this is a disk in EXT2 format;

● On the / home / ftp directory tree, the second partition (/ dev / sdc2) of the third SCSI hard drive, which is a hard disk of a Windows 95 VFAT format.

By properly configuring the / etc / fstab file, the user can construct a directory tree, which can accommodate many different devices and support many different operating system file formats. This directory tree will be automatically constructed each time the roots of Linux will be used.

转载请注明原文地址:https://www.9cbs.com/read-130605.html

New Post(0)