Beginner: Let's talk about Linux's file system-general Linux technology-Linux technology and application information. The following is a detailed description. If you are a newbie, maybe you still don't know how to copy files from Windows to Linux? Next, we will describe the Unix File System and mount process, and then discuss it in detail.
The usage of mount and related options. If you know how the Unix file system works, skip the following section. Otherwise, you 'd better continue to learn the meaning of "mount.
What is mount?
In some operating systems (such as Windows), computers identify devices by device names. For example, most PC systems include "A: drive" (floppy disk), "C: drive "(hard disk) and" D: drive "(usually a read-only disc ).
For various reasons, Linux generally does not use this method to indicate storage devices. The Linux system uses a single directory tree (similar to the "C: drive" directory tree structure of a Windows User) to locate the content of the storage device by mounting to the branch of the directory tree.
There are a total of four hard drives on this particular computer, all of which are managed by the file system. For example, assume that we use the Windows System Method to name these four hard drives C, D, E, and F, respectively, their Linux path names and Windows equivalent names are shown in table 1.
Windows File Name equivalent to the disk number in Linux
1/C :\
1/var C: \ VAR
1/var/adm C: \ VAR \ ADM
1/var/spool C: \ VAR \ SPOOL
1/home C: \ HOME
1/home C: \ HOMEJACKON
2/usr D :\
2/usr/lib D: \ USR \ LIB
3/usr/X11R6 E :\
4/home F :\
By maintaining the list of devices in the system and the mounted devices, the Linux system knows where to find the data contained in each path table, regardless of the specific device on which the data is stored. Because data ing is automatically completed, you do not need to remember which hard drive the data is on.
For example, for anonymous ftp users, you only need to remember that/home/ftp is in the "home" directory, rather than remembering that all ftp files are in the "F: "Or 4th hard drive, this way
Obviously, it is much more intuitive. Similarly, remember that user-oriented library programs are all on/usr/lib, which is much more intuitive than remembering that user-oriented library programs are all on the "LIB" Directory of 2nd hard drives.
Device ID
To remember where each device is mounted, the Linux system requires a unique method to identify each device. For a person, the task is completed by finding the device name in the/dev directory. However
Yes, this directory contains a large number of special files, each of which indicates different types of devices, or partitions on existing devices. For example, the/dev/hda device indicates the first hard drive of the system;
/Dev/hda1 indicates the 1st partition of the first hard drive, while/dev/hda2 indicates the 2nd partition of the first hard drive. Table 2 shows some common device files and corresponding devices.
Special file Device
/Dev/fdo 1st floppy disk drive
/Dev/fdl 2nd floppy disk drive
/Dev/cdrom CD-ROM driver
/Dev/hda [1-16] 1st hard drive (IDE1, 1) and partition 1-16
/Dev/hdb [1-16] 2nd hard drive (IDE2, 2) and partition 1-16
/Dev/sda [1-16] 1st hard drive (SCSI0) and partition 1-16
/Dev/sdb [1-16] 2nd hard drive (SCSI1) and partition 1-16
/Dev/sdc [1-16] 3rd hard drive (sci2) and partition 1-16
/Dev/sdd [1-16] 4th hard drive (SCSI3) and partition 1-16
Of course, many devices are not listed in table 2. To view the complete list of special devices in your system, run the following command:
#/S/dev
Don't worry. You can never use many devices. Generally, you don't need to study and remember them.
File Format
In addition to remembering where each device is mounted, Linux also needs to remember what type of file system exists on each device. For Windows operating systems, most devices store information
Only two popular formats are used, namely one of FAT16 or FAT32. Only the CD-ROM drive is an obvious exception and it uses the ISO-9660 file format. For
In Linux, the storage information of most devices is Extended-2 (ext2. Similarly, the most notable exception is the CD-ROM drive, which still uses ISO-
9660 file format, but Linux can also identify and mount other file systems. To see which file systems are supported by your Linux kernel, enter the following command: # cat/proc/filesystems
Let's assume that the execution result of the preceding command is:
Ext2
Vfat
Noelevproc
Iso9660
For this specific system, the Linux kernel supports ext2, vfat, proc, and iso9660 file systems. Table 3 lists most file system types supported by Linux.
File System Operating System or Type
Ext2 LinuxExtended-2
Minix Minix file system
Msdos initial FAT file system (short file name)
Other FAT file systems (long file names) in vfat)
Ntfs WindowsNT File System (long file name)
Hpft OS/2 High-Performance File System
Hfs AppleMacintosh File System
Nfs Network File System
Ncpfs NovellNetWare File System
Affs Amiga quick File System
Linux also supports other file systems. To enable Linux to support more file systems, you need to recompile the Linux kernel or download the relevant modules.
Fortunately, when using Linux to maintain the directory tree, users do not have to deal with the device name or file system frequently. We have already mentioned that
The file system is automatically maintained. It also knows where to mount the file system each time. This is mainly because it uses the/etc/fstab file. For the four devices mentioned above
Directory, which can be extracted 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, each time Linux starts mount, it will follow the steps below:
● Mount the 1st partitions (/dev/sda1) of the 1st SCSI hard drive and use it as the first (Root) file system. This is a Linux ext2 disk;
● On the/usr directory tree, mount the 2nd partitions (/dev/sdb1) of the 1st SCSI hard drive, which is a Linux ext2 disk;
● On the/home/ftp directory tree, Mount the 3rd partitions (/dev/sdc2) of the 2nd SCSI hard drive, which is a Windows 95 vfat hard drive.
By appropriately configuring the/etc/fstab file, you can construct a directory tree that can accommodate many different devices and support many different operating system file formats. This directory tree is automatically constructed at the root of Linux every time.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.