Linux operating system - File System Management (1-3)

First, the basic concept of the Linux file system

File System (File System) is a specific format of an area on the disk, the operating system uses a file system to store and manage files.
Different operating systems use different file systems need in order to be compatible with other operating systems, usually operating systems support many types of file systems.

Linux file system

Linux systems use ext2 / ext3 file system.
In the Linux system, the various devices for storing data blocks belong apparatus for a disk device, information is usually stored in a boot sector 0 on the first track, called the master boot record (the MBR), the sector does not belong to a partitions, each comprising a plurality of data blocks, can be considered a collection of block groups.
After establishing ext2 / ext3 file system partition on the disk, each block group structure shown in FIG
Here Insert Picture Description
core ext inode file system structure table and the data blocks is an integral part of the superblock.
Superblock and the group descriptor contains information about the entire set of blocks, for example, and use the total number of index nodes, and the total number of file system usage and the state of the data blocks and the like.
Each node has a unique index number, and corresponds to a file, which contains almost all the information for a specific file, such as file access permissions, owner, settling time, and the corresponding data block address, etc., but not It contains the file name.
It contains the file name and inode number of this file in the directory file. Inode point to a specific data block, the data block is truly a place to store the file contents.

Type II file system

Ext

ext is the first specifically for the Linux file system types, called extended file system.
It is completed in April 1992.
It achieved important role in the development of Linux.
However, there are many defects in performance and compatibility. Now rarely used.

Ext2

ext2 is scalable, high-performance file system to address the shortcomings ext file system designed. Also known as two extended file system.
It was released in 1993, designed by Rey Card.
Linux ext2 file system type is the most used format. And more prominent on the speed and CPU utilization, is GNU / Linux system standard file system, which is characterized by excellent properties to access the file, for small and medium sized documents also show the advantage, that its main benefit fast cluster take good design layer.
Ext2 can support up to 256 bytes long file names, the cluster size of its single file size and file system capacity limit itself to the file system itself is related to the general system of common Intel x86-compatible processors, clusters of up to 4KB, the single file size limit is 2048GB, while the maximum capacity of the file system is 6384GB. Although Linux can support a wide variety of file systems, but in 2000 almost all Linux distributions with ext2 as the default file system.
The disadvantage of ext2: ext2 designer main consideration is the problem of file system performance. ext2 does not write to the file while simultaneously written to the file content meta-data (information and documents relating to, for example: permissions, ownership, and create and access time). Also However, due to the current maximum core 2.4 can be used by a single partition only 2048GB, although the maximum capacity of the file system for the 6384G but the file system capacity can actually be used only up to 2048GB.

Ext3

ext3 is a community-developed open source log file system, the main developer is Stephen tweedie.
ext3 is designed to be an upgraded version of ext2, user-friendly as possible to migrate from ext2fs to ext3fs. ext3 joined the record metadata logging on the basis of ext2, and strive to maintain forward and backward compatibility.
ext3 is a journaling file system. Superiority journaling file system that: Because the file system cache layer are involved in the operation, the file system must be removed when not in use, such as for the write-back cache data layer disk. Therefore, whenever the system to shut down, it must be after all of its file system to remove all the shutdown.
The disadvantages of ext3: its biggest drawback is that no modern high-performance file system has the file can increase data processing speed and decompression, to pay attention to another hard disk quota problems using ext3 file systems until this issue is resolved, important not recommended using ext3 + disk quota (disk quota) on enterprise applications.

Jsf

jsf provides byte-level file-based system log, the file system for transaction-oriented high-performance systems developed.
jsf (Journaled File System Technology for Linux ) developers including major developers jsf's AIX (IBM's Unix) is.
In February 2000, ibm announced in the next open source license, transplant linux version of the JSF file system. JSFs also a large number of users to install and use, enterprise-class file system. It has scalability and robustness compared to non-journaling file system, it has the advantage of its fast restart capability: Jfs file system can be restored in a few seconds or minutes to a consistent state.
Although jsf mainly to meet the server (from a single processor and multi-processor systems to advanced cluster system) high throughput and reliability requirements of the design, can also be used jsf conceivable performance and reliability because the client configuration when the system crashes, jsf provides fast file system restart time, so it is a key technology Internet file server.
jsf drawback: Use jsf journaling file system, there will be some loss of performance, system resources occupancy rate is also high. Because when it is to keep a log, the system needs to write a lot of data.

ReiserFS

xfs is a very good journaling file system, which is designed by SGI.
xfs is known as the industry's most advanced, most scalable file system technology. It is a full 64-bit, fast, robust journaling file system, for many years SGI's IRIX operating system.
sgi decided to support the Linux community, the basic structure of a key technology licensing in Linux. It has released the source code xfs their own resources in the form of an open and began to transplant.
SGI's xfs can bring new features for linux and open source community are: Scalability: xfs is designed to be upgraded to face the most storage capacity and i / o storage requirements that can handle large files and contain huge a large number of files in the directory, to meet the rapidly growing demand for disk twenty-first century.
xfs ability to dynamically allocate space for the index file, the system the ability to effectively support large number of files is formed. In its support, a user may use 1exabyte (1g × 1gb) large files, now much larger than the maximum file system.
Excellent i / o Performance: Typical modern server using a large array of striped disk to provide a total bandwidth of up to several gb / sec. xfs can satisfy the number of I / O requests and the size of the concurrent I / O requests. xfs as the root file system, and support lilo.

The swap file system

The swap file system is a Linux swap partition used by the file system. Use the virtual memory swap space swap partition management in Linux. Usually swap partition size is set to 2 times the physical memory system. When installing the Linux operating system, you must create the swap partition and its file system type must swap. Swap partition managed by the operating system.

vfat file system

vfat file system is a generic term for DOS, FAT16 and FAT32 file system in Windows operating systems under Linux. Red Hat Linux support partition FAT16 and FAT32 format, you can also create and manage a FAT partition.

NFS file system

I.e., network file system NFS for sharing files over a network between UNIX systems, users can network shared directory server NFS mount to the local directory to be the same as access the NFS file system to access the contents of the local file system Content.

ISO 9660 file system

ISO 9660 is a standard file system used by CD-ROM, Linux system has good support for the file system, not only can read the contents of the CD but also supports CD burning capabilities.

Third, specify the file system type of partition

After the hard disk partition, the next step is to create the file system. Similar to format the hard disk under Windows.
A file system on the hard disk partition will wash away the data on the partition, and can not be restored, so before the establishment of the file system to confirm the data on the partition is no longer used. Command creates the file system is mkfs, in the following format:
mkfs [parameters] file system
mkfs commands commonly used parameters option
-t: Specify the file system type to create
-c: to establish before the file system first checks for bad blocks
-l file: From the Files disk file read bad block list, file file is usually produced by a check program for bad blocks
-V: establishing details output file system.

Specify the file system type

Based on / dev / sdb1 ext3 file system type, establish checking for bad blocks and display detailed information.

A file system on a floppy disk

Floppy disk format
using the command badblocks bad blocks on the floppy disk, the bad block information stored in files in badblock-fd0.
A file system with the mkfs command.

Check the file system type

fsck command is used to check the correctness of the file system. And Linux disk repair. fsck command format is as follows:
fsck [parameter options] file system
fsck command parameters commonly used options:
-t: given file system type, if there is defined in the / etc / fstab or kernel itself does not need to add this support .
-s: one by one, the fsck command to check.
-A: on / etc / fstab listed all partitions to be checked.
-C: display a complete check progress.
-d: debug list of results fsck.
-P: -A option when there are simultaneously performed with a plurality of inspection fsck.
-a: If the inspection found an error, then automatically repaired.
-r: If there is an error checking, asking if repair.
For example, check the partition / dev / Is there a mistake on sdb1, if there are errors automatically repaired.

Published 152 original articles · won praise 124 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_44762986/article/details/104827296