Although the kernel is the core of Linux, files are the main tool used for user interaction with the operating system. This is especially true for Linux, because in UNIX tradition, it uses file I/O mechanisms to manage hardware devices and data files.
Unfortunately, new users often confuse terms that introduce the concept of Linux file systems. The term file system can be used interchangeably in Linux File preparation to refer to several different but related concepts. In addition to the actual disk partition, the file system also refers to the data structure and file management methods in the partition.
This term is also used to refer to the overall structure of files in the system: directory tree. In addition, this term can also refer to each subdirectory in the directory tree, for example, in the/home file system. Some people think that these directories and subdirectories cannot be called true file systems unless they all reside in their respective disk partitions. However, others call it a file system, which undoubtedly adds confusion.
Linux Veterans can understand the meaning of these terms from the context. However, it is difficult for new users to identify such a context at half past one.
The main goal of this article is to provide sufficient background knowledge to help you identify the context of this term. While clarifying the nuances of File System terms, you will also learn how to increase some useful tools from theoretical applications to practical applications.
This article mainly introduces the features of the Linux disk partition and file management system in the 2.4 Linux kernel. In addition, the new features in the 2.6 Linux kernel are introduced.
Disk Partition Overview
The basic file storage units in Linux and UNIX are disk partitions, which are logical partitions of one or more hard disks. The operating system regards each logical partition as an independent disk. The file and file management system "lives" in the disk partition. Linux processes these disk partitions as devices and uses the file I/O mechanism through special files in the/dev directory.
There are two types of device files: block and character/original. One important difference between the two is that block devices are buffered, and character devices are not buffered because they do not have a file management system. Before the launch of the Oracle Cluster File System (OCFS), using the original device is a common way to improve the performance of Oracle Data File partitioning. In the subsequent sections of this article, we will detail the original devices .)
The partition table that is stored at the beginning of the disk provides the ing of partitions on the disk. You can use the fdisk command to view the Partition Table of the system.
# Fdisk-l
Disk/dev/hda: 240 heads, 63 sectors, 1940 cylinders.
Units = cylinders of 15120*512 bytes
Device Boot Start End Blocks Id System
/Dev/hda 1 286 2162128 + c Win95 FAT32 (LBA)
/Dev/hda2*288 1940 12496680 5 Extended
/Dev/hda5 288 289 15088 + 83 Linux
/Dev/hda6 290 844 4195768 + 83 Linux
/Dev/hda7 845 983 1050808 + 82 Linux swap
/Dev/hda8 984 1816 6297448 + 83 Linux
/Dev/hda9 1817 1940 937408 + 83 Linux
The name/dev/hda to/dev/hdd in the Partition Table represents the IDE drive 1 to 4, where hda represents drive 1, hdb represents drive 2, and so on. Partitions in the drive are represented by numbers, so/dev/hda5 is the fifth partition on the first IDE drive. A similar naming mode is used for SCSI drives:/dev/sda to/dev/sdd.
The first to fourth partitions are reserved for the primary partition, and the fifth and subsequent partitions are used for the logical partition. Therefore, the partition table shown above contains a drive hda, which contains a primary partition hda1, an extended partition hda2, and five logical partitions/dev/hda5 to/dev/hda9. The file system listed in the name shmfs indicates the shared memory file system that is mounted as a special file system according to the POSIX standard in Linux 2.4.
You may have noticed that LBA is enclosed in brackets in the fdisk list. LBA indicates Logical Block Addressing. It converts the cylindrical, block, and sector modes of a hard disk into linear block numbers for processing.
In Linux, partitions are divided into primary partitions, extended partitions, and logical partitions. The term primary partition is a legacy product of the four partition restrictions on the previous x86 system. Unlike DOS and Windows, Linux can be started from the primary partition or logical partition. A primary partition used as a placeholder for a logical partition is called an extended partition. The extended partition itself has a partition table that points to one or more logical partitions. They are only subpartitions of the primary partition. In the above fdisk list, hda2 is an extended partition.