Linux File System Overview

Source: Internet
Author: User

1. What is a file system );

1. common definition methods;

What is a file system? It is a little difficult to answer in one or two sentences. This question can only be answered by the file system designer or a professional who is proficient in the file system; the following is the definition of filesystem that I searched from Google.com. The following is an analysis. It is also helpful for us to understand it. If you are a professional and have your own definition method, please leave a message after this article; thank you; Definition 1;

A directory structure contained within a disk drive or disk area. the total available disk space can be composed of one or more filesystems. A filesystem must be mounted before it can be accessed. to mount a filesystem, you must specify
A directory to act as the mount point. once mounted, any access to the mount point directory or its subdirectories will access the separate filesystem. A file system is a directory structure that includes a disk (including a CD, floppy disk, flash disk, and other storage devices) or a partition. An applicable disk device can contain one or more file systems; to access a file system, you must first mount the file system. To mount the file system, you must specify a mount point; once the file system is mounted,
Freebooks.by.ru/view/ShellProgIn24h/31480175.htm

Definition 2;

A method of organising files on a disk, eg NTFS, FAT.

The linux-ntfs.sourceforge.net/ldm/home/terms.html file system is used to organize files on a disk (including a CD, floppy disk, flash disk, and other storage devices) or partition, such as NTFS or FAT;

Definition 3;

A data structure or a collection of files. in Unix, filesystem can refer to two very distinct things, the directory tree or the arrangement of files on disk partitions. A file system is the data structure or organization method of a file. In Unix, the file system involves two very unique things: directory tree or file arrangement on disk or partition; www.emulex.com/ts/docfc/glossary.htm

Definition 4;

The structure of files on a disk medium which is visible via the operating system, ie the structure of files which a Unix user can see using "ls" and other tools file system is based on the operating system and is built on the visible architecture of the disk media, for example, this structure can be seen by using ls or other tools for a Unix user; www.ucolick.org /~ De/deimos/glossary.html

Definition 5;

A software mechanic that defines the way that files are named, stored, organized, and accessed on logical volumes of partitioned memory. A file system is a method that defines the name, storage, organization, and retrieval of files based on logical units on the partitioned storage devices. www.evestigations.com/html/glossary.html

Definition 6;

In computing, a file system is a method for storing and organizing computer files and the data they contain to make it easy to find and access them. file systems may use a storage device such as a hard disk or CD-ROM and involve maintaining
The physical location of the files, or they may be virtual and exist only as an access method for virtual data or for data over a network (e.g. NFS ). in the computer industry, a file system stores files or data in an organized manner to facilitate query and access. The file system is based on a storage device, such as a hard disk or a CD, and maintains the physical location of the file. It can also be said that the file system is also a method for storing virtual data or network data, such as NFS;
En.wikipedia.org/wiki/Filesystem

2. Understand the keywords of the file system;

0) storage medium:

Hard Disk, CD, floppy disk, Flash disk, tape, network storage device, etc;

1) disk segmentation:

This is for large-capacity storage devices, mainly refers to hard disks. For large hard disks, We need to reasonably plan partitions, so we need to talk about hard disk separation. Hard Disk partitioning: Linux has fdisk, cfdisk, and parted, and fdisk is commonly used. Windows and dos also use fdisk, but it is different from Linux in usage. There are third-party programs such as PQ in the hard disk splitting tool. for understanding and operating the partitions, see:
How to Use fdisk for instance explanation

Rational Planning of your hard disk partition

2) create a file system:

This process is the process of creating a file system for the storage device. It is also called formatting or initialization. It is carried out through some initialization tools. In general, each type of operating system has tools for this purpose, as well as multi-functional third-party tools, such as PQ. My suggestion is that if you do not know the tools that come with the operating system, you can use a third-party tool to cut the hard disk, split the hard disk into Several partitions, and then use the work that comes with the operating system to initialize the partition, that is, format the partition. Mkfs tools are available in Linux;

3) mount ):

The file system can only be used for mounting. For Unix operating systems, the same is true for Windows. In Windows, it is more intuitive and we do not know much about the specific internal mechanism. However, Unix operating systems are mounted through mount. mount Points are required when mounting a file system. For example, when we install Linux, we sometimes prompt for partitions, then create a file system and then ask what your mount point is. Most of us choose /. During the use of the Linux system, we will also mount other hard disk partitions and select the mount point. The mount point is usually a vacant directory, preferably our self-built vacant directory;

4) Visible geometric structure of the file system:

The file system is used to organize and arrange file access, so it is visible. in Linux, we can use tools such as ls to view its structure. In Linux, what we see is a tree structure. For example, if the operating system is installed in a file system, it is represented by a/initial tree structure;

[Root @ localhost ~] # Cd/

[Root @ localhost/] # tree

Ii. Types of file systems;

There are many file system types, you can
See in the Linux File System Resource Index. However, we usually use ext3, ext2, and reiserfs in Linux; windows and Dos commonly used file systems are fat series (including fat16 and fat32) and ntfs file systems; disc file systems are ISO-9660 file systems; Network Storage NFS server access at the client, the file system is nfs, which is special. For more information, visit the official website of your file system.
Find the corresponding resources in the file system resource index. Thank you;

3. Linux File System Selection and security;

If you are a professional, you should say which file system is safe. If you use Linuxfish, "the designers of which file system are not dummies, they should understand what is going on in their work .". As a file system designer, we generally encounter problems in the process of use, they should have a solution. But after all, we are not specialized in file system research, so we need to describe the security of the file system from the perspective of use; for beginners of Linux, there will certainly be difficulties in selecting a file system, because most new users do not know which file system is better. Now let's talk about how to choose a file system;

1. Select a file system during Linux installation;

1) ext2 file system;

Ext2 file system should be said to be an authentic Linux File System. In the early days, ext2 was used for Linux. However, with the development of technology, most Linux distributions do not currently use this file system; for example, most of Redhat and Fedora suggest using ext3, And the ext3 file system is developed from ext2. For new Linux users, we recommend that you do not use the ext2 file system; ext2 supports undelete (reverse delete). If you accidentally delete a file, it can be recovered, but the operation is troublesome; ext2 supports large files; ext2 file system official homepage is: http://e2fsprogs.sourceforge.net/ext2.html

2) ext3 File System: developed from the ext2 file system;

Ext3 is a Journalizing file system for Linux (ext3 is a log file system for Linux). ext3 supports large files, but does not support undelete operations; both Redhat and Fedora support ext3. For more features of the ext3 file system, visit
Linux File System Resource Index;

3) reiserfs file system;

The reiserfs file system is an excellent file system that supports large files and undelete. During my test of the file deletion function of ext2 and reiserfs, I found that the reiserfs file system has the most outstanding performance. It can restore more than 90% of the data, sometimes to 100%; it is easier to delete operations; reiserfs supports large files;

4) Comparison of Linux File System Support for large files;

See http://www.suse.de /~ Aj/linux_lfs.html

Filesystem File Size Limit Filesystem Size Limit

Ext2/ext3 with 1 KiB blocksize

16448 MiB (~ 16 GiB)

2048 GiB (= 2 TiB)

Ext2/3 with 2 KiB blocksize

256 GiB

8192 GiB (= 8 TiB)

Ext2/3 with 4 KiB blocksize

2048 GiB (= 2 TiB)

8192 GiB (= 8 TiB)

Ext2/3 with 8 KiB blocksize (Systems with 8 KiB pages like Alpha only)

65568 GiB (~ 64 TiB)

32768 GiB (= 32 TiB)

ReiserFS 3.5.

2 GiB

16384 GiB (= 16 TiB)

ReiserFS 3.6 (as in Linux 2.4)

1 EiB

16384 GiB (= 16 TiB)

XFS

8 EiB

8 EiB

JFS with 512 Bytes blocksize

8 EiB

512 TiB

JFS with 4KiB blocksize

8 EiB

4 PiB

NFSv2 (client side)

2 GiB

8 EiB

NFSv3 (client side)

8 EiB

8 EiB

Note Kernel Limitations: The table above describes

Limitations of the on-disk format. The following kernel limits

Exist:

  • On 32-bit systems with Kernel 2.4.x: The size of a file and

    Block device is limited to 2 TiB. By using LVM several block

    Devices can be combined enabling the handling of larger file

    Systems.

  • 64-bit systems: The sizes of a filesytem and of a file are

    Limited by 263 (8 EiB). But there might be hardware

    Driver limits that do not allow to access such large devices.

  • Kernel 2.6: For both 32-bit systems with option CONFIG_LBD set

    And for 64-bit systems: The size of a file system is limited

    273 (far too much for today). On 32-bit systems

    (Without CONFIG_LBD set) the size of a file is limited to 2 TiB.

    Note that not all filesystems and hardware drivers might handle

    Such large filesystems.

Note in the above:

1024 Bytes = 1 KiB;

1024 KiB = 1 MiB;

1024 MiB = 1 GiB, 1024 GiB = 1 TiB, 1024 TiB = 1 PiB, 1024 PiB = 1

EiB (check

Http://physics.nist.gov/cuu/Units/binary.html)

Maximum Number of Partitions An IDE disk has 64 minors, one is used for the full disk and therefore 63 partitions are possible. a scsi disk has 16 minors and therefore only 15 partitions maximal.

2. Security of the file system;

Any file system is safe in the eyes of experts, just as MS says Windows is secure and reliable. If MS Experts use Windows, there is absolutely no problem. After all, people are experts, we are users; experts and users are quite different; because we are not experts, we have to choose a more secure and easy-to-use file system. Next we will compare ext2, ext3, and reiserfs;

1) Comparison of automatic recovery capabilities of ext2, ext3, and reiserfs file systems;

Both ext2, ext3, and reiserfs can automatically repair damaged file systems. In terms of performance, reiserfs is superior. ext2 and ext3 file systems are "This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first" by default ", that is, the file system is mounted 21 times at intervals or automatically detected every 180 days. In practice, ext2 and ext3 are in auto
Check is risky. Sometimes the file system enters the single-user mode after it is started, and the entire system is "thrown" into the lost + found "directory. If you want to restore the system, fsck is used to fix the problem. Of course, fsck also has risks. Therefore, we need to be prepared for the use of ext2 and ext3 file systems; after all, it is difficult to repair damaged ext2 and ext3 file systems. In addition, ext2 and ext3 file systems may also cause file system damage due to accidental shutdown and power failure, therefore, during use, we must shut down the Server properly. For example, we can execute the poweroff command to shut down the machine. The reiserfs file system can also automatically fix the problem. It has a strong function in automatic detection and repair, there are very few ext2 and ext3 cases, and in terms of speed, it is faster than the ext2 and ext3 file systems. Based on my two-month test, reiserfs
Optimal Performance for unexpected power outages. To verify the security of the reiserfs file system in terms of accidental power failure, I directly shut down the power supply every day, but we should not say that reiserfs is a safe direct power failure, direct Power Failure may also cause physical damage to the hard disk. The reiserfs file system has never been manually repaired like ext2 and ext3. In this regard, reiserfs is extremely secure;

2) Comparison of the reverse deletion functions of ext2, ext3, and reiserfs;

From the perspective of the file system's reverse deletion, both ext2 and reiserfs support reverse deletion, which should be safe for general users, but may mean insecure for the Security Unit. There are also two aspects to describe the security of the file system from the perspective of reverse deletion. He discussed this issue with linuxfish yesterday and said that the file shredder tool was introduced in windows, the purpose is not to recover deleted files. If you are engaged in confidential work, it is better to use ext3, because once the ext3 object is deleted, it cannot be recovered. Although there are several online restore operations related to reverse deletion in ext3, however, in practice, it is not that easy; because reverse deletion can restore the leakage of the corresponding confidential data, ext3 may be more suitable for you; if you are a general user, I still recommend that you use the reiserfs File System. It supports the reverse deletion function, which is easier to perform. However, there may be some problems. For example, in fedora or RedHat, there is a SELinux about system security. By default
SELinux is not supported. However, it is worth noting that SELinux is an absolutely huge security tool with rich functions and a wide range of features. SELinux is not accessible to general users; therefore, we recommend that beginners Turn Off The SELinux feature when using the Linux system, but you can gradually familiarize yourself with it. In the latest fedora and RedHat versions, the reiserfs file system does not support SELinux, therefore, if you use reiserfs in fedora or RedHat and want to use SELinux, you may need to install Kernel patches. check whether this problem exists in other Linux versions, you have to try it;

4. file systems supported by Linux;

Linux currently supports almost all UNIX file systems. In addition to the ext3, reiserfs, and ext2 files to be selected when installing the Linux operating system, it also supports HFS of Apple MacOS, it also supports file systems of other UNIX operating systems, such as XFS, JFS, minix FS, and UFS. You can view them in the source code of the kernel; if you want to compile a file system into a module or a kernel, refer to kernel management overview for how to compile the kernel. of course, Linux also supports the Windows File System NTFs and fat, but does not support writing to the NTFS file system; supports reading and writing to the fat file system; see in Fedora
Core 4.0: loading NTFs and FAT32 partitions details Linux also supports network file systems, such as NFS. The way to mount an NFS file system is: Mount-t nfs server address: /The following is an example of a directory mount point. For example, I have created an NFS server on the machine 192.168.1.4 and NFS can be used for all machines in the 192.168.1.x network segment; the process of creating an NFS server is omitted. Here we only talk about how to mount the server;

[Root @ localhost ~] # Showmount-e 192.168.1.4 first view the file folder shared by the NFS server;

Export list for 192.168.1.4:

/Opt/sirnfs * Note: The/opt/sirnfs directory on the host 192.168.1.4

[Root @ localhost ~] # Mkdir/mnt/sirnfs Note: create a directory on the local machine as an NFS mount point;

[Root @ localhost ~] # Mount-t nfs 192.168.1.4:/opt/sirnfs/mnt/sirnfs Note: mount NFS;

[Root @ localhost ~] # DF-H Note: Check whether NFS is successfully mounted on the local machine;

Filesystem capacity in use available % mount point

/Dev/hda7 11G 7.4G 2.9G 72%/

/Dev/shm 236 M 0 236 M 0%/dev/shm

/Dev/hda9 22G 837 M 22G 4%/opt/data

192.168.1.4:/opt/sirnfs

63G 47G 17G 74%/mnt/sirnfs Note: This is displayed after the mounting is successful;

V. Features of the file system;

The features of the Linux file system determine the attributes of a file. For example, we can use chattr + I to avoid modifying a file and use chattr + I to change it to a read-only file, ext2 and ext3 are acceptable, but reiserfs does not play any role. Different file systems have different features, this feature often determines the attributes of files and directories in the file system, which is also the main reason for my article. Through this article, I can introduce operations on file and directory attributes in Linux; each file system has a series of tools, including creation, repair, backup, etc. It is worth mentioning that most file systems have repair tools. When your file system is extremely normal, it is best not to use a repair tool to detect and fix the problem. For example, it is best not to run the fsck tool, which may damage your system. For details, refer
Detailed procedures for creating and attaching a File System

6. Create and mount a file system in Linux;

For details about how to create a file system and mount a file system in Linux, see section 7. About this article. The file system is too wide and this document is not very easy to write. However, it is barely written, although not professional; maybe some help for new Linux; 8. references; http://www.suse.de /~ Aj/linux_lfs.html

Http://www.xenotime.net/linux/linux-fs.html

... 9. related documents;

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.