Menu
Is free
registration
home  /  Firmware/ Types of Linux file systems and their features. Physical organization of ext2, ext3, ext4 file systems Ext2 file system

Types of Linux file systems and their features. Physical organization of ext2, ext3, ext4 file systems Ext2 file system

The Linux filesystem is most often ext4. It is journaling and allows you to conveniently work with data when solving the vast majority of problems. However, there are others. Basic types file systems and the principles of working with them will be considered within the framework of this material.

File types Linux systems and their features

Distinctive features are the speed of working with files, security and parameters (such as block size) that exist by default and are set when creating an FS. Perhaps the most important characteristic is the presence of a journal. V system log data is being written or metadata(headers only) by which information can be recovered in the event of a failure.

The file system can be created on any device: disk or system partition.

EXT2 file system

EXT2 is currently an obsolete file system that is hardly used in modern installations. the main drawback is the lack of logging, which, accordingly, makes it impossible to recover data in case of a failure. It is still used on portable storage media such as USB. They do not need a magazine because they take up a certain amount of space.

Also guarantees the maximum speed of work.

  • for EXT2 the maximum file size is -2 TB

EXT3 file system

Supplanted EXT2, main feature is the appearance of the magazine, is fully backward compatible with EXT2 (EXT2 can be freely converted to EXT3). Now it is also rare, EXT4 is almost always used.

The log is a special area in memory where information about all changes is recorded

  • for EXT3 the maximum file size is -2 TB
  • maximum size of all files - 32 TB
  • each directory can have up to 32,000 subdirectories

There are three options for journaling (specified when creating the file system):

  • journal - the journal metadata, as well as the information itself
  • ordered - the default option, only metadata is saved after writing to disk
  • writeback - also only metadata is saved, you can choose to save it before writing to disk or after

EXT4 file system

The modern version of the extended file system, it is most often used

  • max file size -2 TB 16 TB
  • the maximum size of all files is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • each directory can have up to 64,000 subdirectories

In EXT4, logging can be turned off by setting the option data when mounted in off

EXT as the main Linux filesystem and practice

The file system is created by the mk2fs command

The required logging option is specified during mount, for example:

mount / dev / vdc / mnt / 1 -t ext3 -o data = journal

Conversion from EXT2 E to XT3

ReiserFS

ReiserFS (and the modern SELinux-enabled implementation of Reiser4) has good performance and is very productive - especially when working with big amount small files. ReiserFS does not allocate inodes for each small file by processing them together, nor does ReiserFS use a journal with several options available. The file system is currently supported by developers from Russia.

You can create FS for the device with the command

XFS

XFS is a Journaled File System. Uses RAM to store information, so data loss is possible - for example, when the power is turned off.

To use XFS on Ubuntu, you need to install packages xfsprogs and xfsdump

vfat

The Linux file system also exists in the Windows environment. It is used when you need to organize joint access to certain disks and partitions of clients with different operating systems. In other cases, it is not recommended to use it because it can be difficult when working in Linux.

Let's take a look at the logical structure of the ext2fs filesystem. The hard disk is physically divided into 512-byte sectors. The first sector of a disk partition on any file system is considered the boot area. In the primary section, this area contains the boot record, a piece of code that initiates the boot process of the operating system at startup. This area is not used in other sections. The rest of the sectors are combined into logical blocks of 1, 2 or 4 kilobytes. A logical block is the smallest addressable piece of data: the data of each file occupies an integer number of blocks. Blocks, in turn, are combined into block groups. Block groups and blocks within a group are numbered sequentially, starting from 1.

The data structures used when working with the ext2fs file system are described in the / usr / include / linux / ext2fs .h header file.

The superblock serves as the starting point of the file system and stores all

information about her. It is 1,024 bytes in size and is located at 1,024 bytes from the start of the filesystem. In each group of blocks, it is duplicated, which allows you to quickly restore it after failures. The superblock determines the size of the file system, the maximum number of files in the partition, the amount of free space, and contains information about where to look for unallocated areas. When the OS starts up, the superblock is read into memory and all changes to the file system are first reflected in the copy of the superblock in the operating system and written to disk only periodically. This improves system performance as many users and processes are constantly updating files. On the other hand, when the system is stopped, the superblock must be written to disk, which does not allow turning off the computer by simply turning off the power. Otherwise, on the next boot, the information written in the sunblock will not be

corresponding to the real state of the file system.

The superblock is followed by the description (descriptor) of the block group. The information stored in it allows you to find the block and inode bitmaps and the inode table.

A block bitmap is a structure, each bit of which indicates whether the same block is assigned to a file. A value of 1 indicates that the block is busy. This map is used to search for free blocks in cases where you need to allocate space for a file.

The inode bitmap performs a similar function to the inode table: it shows which descriptors are in use.

Each file has one and only one inode (inode, i-node, information node), which is identified by its sequence number - the file index. The inode stores the file metadata. Among them - all the attributes of the file, except for its name, and a pointer to the file data.

For a regular file or directory, this pointer is an array of 15 block addresses. The first 12 addresses in this array are direct references to the block numbers in which the file data is stored. If the data does not fit into 12 blocks, then the indirect addressing mechanism is turned on. The next address in this array is an indirect reference, that is, the address of the block that stores the list of addresses of the next blocks with data from this file.

How many data blocks can you address like this? The block address takes 4 bytes, the block, as already mentioned, is 1, 2 or 4 kilobytes. This means that 256 - 1024 blocks can be accommodated by indirect addressing.

And if the file is even longer? The next address in the pointer array points to a double indirect block (double indirect block). This block contains a list of block addresses, which, in turn, contains the address lists of the following data blocks.

And finally, the last address in the pointer array specifies the address of the triple indirection block, that is, the block with a list of block addresses that are double indirection blocks.

It remains unclear where the file name is located if it is not included in the file's data or in its metadata. In UNIX-like systems, the file name is not an attribute of the file itself, but of the file system, understood as a logical directory structure. The file name is stored only in the directory to which the file is assigned, and nowhere else. Curious consequences follow from this.

First, any number of names assigned to different directories can correspond to a single inode, and they are all real. The number of names (hard links) is counted in the inode. This is the number you can see by the command Is -1.

Secondly, deleting a file simply means deleting the record about it from the directory data and decreasing the link count by 1.

Third, you can only match a name to an inode number within the same file system, which is why you cannot create a hard link to another file system (symbolic - you can, it has a different storage mechanism).

The directory itself is assigned to its parent directory in the same way. The root directory is always written to inode number 2 (number 1 is reserved for the list of bad block addresses). Each directory contains a link to itself and to its parent directory - these are the pseudo-subdirectories "." and "..".

Thus, the number of links to a directory is equal to the number of its subdirectories plus two.

The directory data is a linked list with variable length entries and looks something like this:

Ext2fs directory structure

What about physical device files? They can be located in the same directories as regular files: there is no data in the directory that indicates that the name belongs to a file on a disk or a device. The difference is at the inode level. If the i-node of a regular file points to disk blocks where its data is stored, then the i-node of the device file contains a pointer to the list of device drivers in the kernel - the element of the list that corresponds to the major device number:

Difference between regular file and device file

Ext2fs filesystem properties:

The maximum file system size is 4 TB.

The maximum file size is 2 GB.

The maximum length for a file name is 255 characters.

The minimum block size is 1024 bytes.

The number of inodes to allocate is 1 per 4096 bytes of the partition.

How in Windows environment make it possible to access a disk partition or removable media with file systems Ext2 / 3/4 ? If, for example, there is also a second system on the computer Linux... And you need to work with its data from the environment Windows... Or another example - when inside Windows are mounted virtual disks with installed on virtual machines systems Linux or Android... With Ext2 / 3 / 4 Windows does not know how to work natively, it needs third party funds. What are these means? Consider those below.

***
The first three means will make it possible to read only information devices from Ext2 / 3/4... The latter solution will allow both reading and writing data. All tools discussed below are free.

1. DiskInternals Linux Reader

A simple program is a primitive file manager, made like a regular Windows explorer, with support for file systems Ext 2/3/4 , Reiser4 , HFS , UFS2... In the program window we will see partitions and devices with Linux or Android.

To copy, select a folder or file, press the button "Save".

Then specify the copy path.

2. Plugin for Total Commander DiskInternals Reader

Lovers of the popular can extract data Linux or Android inside Windows using this file manager. But having previously installed a special plugin in it. One of these plugins is, it can connect and read information devices formatted in Ext2 / 3/4 , Fat / exFAT , HFS / HFS + , ReiserFS... Download the plugin, unpack its archive inside , we confirm the installation.

Launch (important) as administrator. We go to the section. Click.

Here, along with other partitions of the disk and media, the one with Ext2 / 3/4 .

Data is copied using traditional way - with the F5 key on the second panel.

3. Plugin for Total Commander ext4tc

A simplified alternative to the previous solution - ext4tc, another plugin for ... It can connect for reading information devices formatted only in Ext2 / 3/4... Download the plugin, unpack its archive inside the file manager, start the installation.

Launch (important) as administrator. We click. We go to.

If you need to copy data, we use the usual way with the F5 key.

4. Ext2Fsd support driver

Program Ext2Fsd Is the driver Ext2 / 3/4, it implements support for these file systems at the operating system level. With disk partitions and drives formatted in these file systems, you can work as usual, supported Windows devices information in the explorer window or third-party programs... The driver allows both reading and writing data.

Download the latest current version Ext2Fsd.

When installing, we activate (if for long-term work) three suggested checkboxes:

1 - Driver autorun together with Windows;
2 - Recording support for Ext2;
3 - Formatting support for Ext3.

At the pre-finish stage, we activate the option to launch the driver manager window - - with the accompanying assignment of information to devices from Ext2 / 3/4 drive letters.

In the window that opened we will see the medium with the letter already assigned. For example, in our case, the carrier with Ext4 the first free letter is specified F.

Now we can work with the disk F in the explorer window.

Assign a letter to new connected devices with Ext2 / 3/4 you can use context menu called on each of the displayed in the window devices. But simply when assigning a drive letter, such a device will not be displayed after restart windows, this solution is for one computer session only. To make a new device with Ext2 / 3/4 permanently visible in the Windows environment, you need to double-click on it to open the setting window and set the permanent connection parameters. In the second column you need:

For removable media, activate the checkbox, indicated by the number 1 in the screenshot, and specify the drive letter;
For internal disks and partitions, activate the checkbox, indicated in the screenshot below by number 2, and also specify the drive letter.

File system(English file system) - an order that determines the way of organizing, storing and naming data on storage media of IT equipment (using portable flash memory cards in portable electronic devices: digital cameras, mobile phones etc.) and computer technology... It defines the format of the content and physical storage of information, which is usually grouped in the form of files. The specific file system determines the size of the file name (folder), the maximum possible file and section size, and a set of file attributes. Some file systems provide service capabilities, such as access control or file encryption.

Filesystem Tasks

The main functions of any file system are aimed at solving the following tasks:

file naming;

software interface for working with files for applications;

mapping the logical model of the file system to the physical organization of the data warehouse;
organization of file system resilience to power failures, hardware and software errors;

In multi-user systems, another task appears: protecting the files of one user from unauthorized access by another user, as well as ensuring joint work with files, for example, when a file is opened by one of the users, for others the same file will be temporarily available in read-only mode ...

The file system is the basic structure used by a computer to organize information on a hard drive. When installing a new hard disk it must be partitioned and formatted for a specific file system, after which data and programs can be stored on it. There are three possible options File System: NTFS, FAT32 and the rarely used legacy FAT system (also known as FAT16).

NTFS is the preferred file system for this version of Windows. It has many advantages over the earlier FAT32 system; some of them are listed below.

Ability to automatically recover from some disk errors (FAT32 does not have this ability).
Improved support for large hard drives.
Higher degree of security. It is possible to use permissions and encryption to deny user access to certain files.

The FAT32 file system and the rarely used FAT system were used in previous Windows versions including Windows 95, Windows 98, and Windows Millenium Edition. The FAT32 file system does not provide the level of security provided by NTFS, so if your computer has a partition or volume formatted for FAT32, the files on that partition are visible to anyone with access to the computer. The FAT32 file system also has file size limits. In this version of Windows, it is not possible to create a FAT32 partition larger than 32GB. Also, a FAT32 partition cannot contain a file larger than 4GB.

The main reason for using the FAT32 system is that the computer can run both Windows 95, Windows 98 or Windows Millenium Edition, and this version of Windows (configuration with multiple operating systems). To create such a configuration, it is necessary to install the previous version of the operating system on a partition formatted for FAT32 or FAT, making it the main one (the main partition may contain the operating system). Other partitions accessed from previous versions of Windows must also be formatted for FAT32. More early versions Windows can only access network NTFS partitions or volumes. NTFS partitions on the local computer will be inaccessible.

FAT - pros:

It takes a little bit to work effectively random access memory.
Fast work with small and medium catalogs.
The disk makes fewer head movements on average (compared to NTFS).
Effective work on slow disks.

FAT - cons:

Catastrophic loss of performance with increasing fragmentation, especially for large drives (FAT32 only).
Difficulties with random access to large (say, 10% or more of the disk size) files.
Very slow work with directories containing a large number of files.

NTFS - pros:

Fragmentation of files has almost no consequences for the file system itself - the performance of a fragmented system is degraded only in terms of access to the file data itself.
The complexity of the directory structure and the number of files in one directory also does not pose any particular obstacles to performance.
Quick access to an arbitrary fragment of a file (for example, editing large .wav files).
Highly fast access to small files (several hundred bytes) - the entire file is located in the same place as the system data (MFT record).

NTFS - cons:

Significant requirements for system memory (64 MB is the absolute minimum, better is more).
Slow drives and controllers without Bus Mastering severely degrade NTFS performance.
Medium-sized directories are difficult to work with because they are almost always fragmented.
A disk that works for a long time in a 80% - 90% full state will show extremely low performance.

The following file systems are considered as "native" for Linux (that is, those on which it can be installed and from which it is able to start): ext2fs, ext3fs, ext4fs, ReiserFS, XFS, JFS. They are usually offered to choose from when installing the vast majority of distributions. Of course, there are ways Linux installations to the FAT / VFAT / FAT32 file systems, but this is only for those honeys and monsieurs who understand a lot about perversions, and I will not talk about them.

The main criteria when choosing a file system are usually reliability and performance. In some cases, it is also necessary to take into account the compatibility factor - in this case, it refers to the ability of other operating systems to access a particular file system.
I'll start with ReiserFS - because the reason for writing this note was the question: what should be considered small files? After all, it is well known that it is the efficiency of working with small files that is strong point this file system.

So, small files are files that are smaller than the logical block of the file system, which in Linux in most cases is equal to four kilobytes, although it can be set during formatting within certain limits (depending on the specific FS). There are countless such small files in any Unix-like OS. Typical examples are the files that make up the FreeBSD ports tree, Gentoo ports, and similar porting systems.
In most file systems, such mini-files have their own inode (an information node containing meta information about a file) and a data block, which leads to both a waste of disk space and a decrease in the performance of file operations. In particular, this is precisely the reason for the catastrophic reverie of file FreeBSD systems(both old, UFS, and new, UFS2) when working with its own port system.

In the ReiserFS file system, in such cases, separate blocks for data are not allocated - it manages to cram the file data directly into the area of ​​its inode. Due to this, both disk space is saved, and performance increases - literally several times compared to all other FS.
Such handling of small files of ReiserFS was the reason for the legend of its unreliability. Indeed, in the event of a file system crash (that is, the destruction of service areas), the data located together with its inodes disappears along with them - and irrevocably. Whereas in those file systems where inodes and data blocks are always spatially separated, the latter can theoretically be restored. So, for ext2 / ext3 there are even tools to do this.

However, like any legend, this one only gives the impression of authenticity. First, irrecoverable data loss applies only to very small files. There are practically no such users among the users, while all the others are easily restored from the distribution kit.
Secondly, speaking about the possibility of recovering data from blocks that have lost their binding to their inodes, I did not accidentally use the word "theoretical". Because in practice this activity is extremely laborious and does not give a guaranteed result. Everyone who has had to do this will agree that it is possible to surrender to it only from complete despair. And this applies to all Linux filesystems. So this aspect can be neglected when choosing a file system.

In terms of overall performance, ReiserFS is definitely faster than all other journaling FS, and in some respects it surpasses ext2. Comparison of the speed of some common file file operations can be found here.
But with the compatibility of ReiserFS, the situation is somewhat worse. Access to it from an OS of the Windows family, as far as I know, is impossible. Some BSD operating systems (DragonFlyBSD, FreeBSD) support this file system, but in read-only mode. Even the chances that an arbitrary Linux LiveCD of yesteryear does not have ReiserFS support is not zero.

And here it is just right to remember ext3fs. Its advantage is not at all greater reliability - this is the same legend as the instability of ReiserFS. I've heard as much about ext3fs crashes as I have heard from ReiserFS. I myself could not destroy either one or the other. Unless it worked with ext2 - but even that was a very long time ago, at the time of the 2.2 kernel (or even 2.0).

No, the main advantage of ext3fs is its compatibility - it is guaranteed to be read by any Linux system. For example, when recovering from some ancient LiveCD henchman - a situation that is practically not so incredible, I had to get into it. Again, most BSD systems understand ext3fs easily (albeit without journaling). For Windows, there are also, as far as I know, all kinds of drivers and plug-ins for the common file managers(like Total commander), providing access to partitions with ext2fs / ext3fs.

In terms of performance, ext3fs is controversial. Firstly, its performance is highly dependent on the logging mode, of which there are three: with full data logging, partial data logging and only metadata logging. In each of the modes, it shows different performance on different types file operations. However, in no case is the performance a record.

However, if the performance requirement is put in the first place, then ext2fs turns out to be out of competition - however, in this case, you will have to put up with the absence of journaling at all. And, consequently, with lengthy checks of the file system in case of any incorrect shutdown - and with the size of modern disks, this can take oh how long ...

The following can be said about XFS. In terms of compatibility, everything that is written for ReiserFS applies to it - moreover, until some time it was not supported by the standard Linux kernel. From the point of view of performance, it does not shine on XFS either, acting in total at about the same level as ext3fs. And at the operation of deleting files, it generally demonstrates depressing slowness.
According to my observations, the use of XFS justifies itself when working not just with large, but with very large files- which are actually just DVD images and video files.

Returning to the question of reliability. A banal power off during normal user work, as a rule, painlessly migrates all journaled file systems (and none of them ensures the safety of user operations not written to disk - rescuing drowning people here remains the work of the drowning themselves). True, for any file system, you can simulate a situation in which turning off the power will lead to more or less serious damage to it. However, in real life, such situations are unlikely to occur. And you can completely eliminate them by purchasing a source uninterruptible power supply- it will give more confidence in the safety of data than the type of file system. Well, the guarantee of recovering damaged data in any case can only be their regular backup ...

I think the above information is enough for an informed choice. My personal choice over the past few years - ReiserFS. Occasionally, on systems where it is justified to move everything out of the root partition, it is advisable to use ext3fs for the root filesystem and ReiserFS for everyone else.

If a separate partition is provided for the / boot directory (and this is recommended when the GRUB boot loader is used by its developers) - for it no other file system, except ext2fs, is justified, any kind of journaling does not make sense here. Finally, if you create a separate section for all kinds of multimedia materials, then you can think about XFS.

If you approach the explanation more methodically

ext - During the early days of Linux, the dominant system was ext2 (extended filesystem version 2). Since 2002, it has been replaced by the ext3 system, which is largely compatible with ext2, but also supports journaling functions, and when working with kernel version 2.6 and higher, it also supports ACL. The maximum file size is 2 TB, and the maximum file system size is 8 TB. In late 2008, a version of ext4 was officially announced, which is backward compatible with ext3, but many features are implemented more efficiently than before. In addition, the maximum file system size is 1 EB (1,048,576 TB), and you can expect that this amount will be enough for some time. About reiser - The system was named after its founder, Hans Reiser, and was the first logging system to access the Linux kernel for data. The Zn version in SUSE has even been considered standard for some time. The main advantages of the reiser over ext3 are its higher speed and placement efficiency when working with small files (and in the file system, as a rule, most files are small). Over time, however, the development of reisefers has stalled. It has long been announced about the release of version 4, which is still not ready, and support for version 3 has ended. About xfs - The xfs file system was originally developed for SGI workstations running on the IRIX operating system. Xfs is especially good for working with large files, in particular it is ideal for working with streaming video. The system supports quotas and extended attributes (ACL).
jfs

jfs - a66peBHaTypaJFS stands for Journaled File System. It was originally developed for IBM and then adapted for Linux. Jfs has never enjoyed much recognition in Linux and is currently dragging out a miserable existence, giving way to other filesystems.
brtfs

brtfs - With the will of the leading kernel developers, the brtfs filesystem in Linux has a bright future. This system was developed from scratch at Oracle. It includes support for device-mapper and RAID. Brtfs is most similar to Sun's ZFS. To her very interesting features includes checking the file system on the go, as well as support for SSDs (solid-state drives are hard drives based on flash memory). Unfortunately, work on brtfs will not be completed in the foreseeable future. Fedora 11 comes with the option to install brtfs, but I only recommend it to file system developers!
There is no "fastest" or "best" file system - the estimate depends on what you intend to use the system for. Novice Linux users working with local computer, it is recommended to work with ext3, and server administrators with ext4. Of course, with ext4, the speed of work is higher than with ext3, but at the same time in the ext4 system the situation is much worse with the reliability of data - you may well lose information if the system is suddenly turned off.

If you have installed a second UNIX-like operating system on your computer, then the following file systems will come in handy when exchanging data (from one OS to another).

sysv - Used by SCO, Xenix and Coherent operating systems.

ufs - Used by FreeBSD, NetBSD, NextStep, and SunOS. Linux can only read information from such file systems, but cannot make changes to the data. To access segments with BSD, you will additionally need the BSD disklabel extension. A similar extension exists for SunOS Partition Tables.

ZFS is a relatively new system developed by Sun for Solaris. Since the ZFS code is not GPL-licensed, it cannot be integrated with the Linux kernel. For this reason, Linux only supports this filesystem indirectly through FUSE.
Windows, Mac OS X

The following file systems will be useful when communicating with MS DOS, Windows, OS / 2, and Macintosh.

vfat - used in Windows 9x / ME. Linux can read information from such partitions and make changes to it. The vfat system drivers also allow working with old MS DOS file systems (8 + 3 characters).

ntfs - the system is used in all modern versions Windows: otNT or higher. Linux can read and modify its files.

hfs and hfsplus - these filesystems are used in Apple computers... Linux can read and modify its files.

Data CDs and DVDs usually use their own file systems.

iso9660 - The file system for CD-ROMs is described in the ISO-9660 standard, which allows only short file names. Long names are supported differently on different operating systems, through a variety of incompatible extensions. Linux is capable of working with both the Rockridge extension, common in UNIX, and the Joliet extension, developed by Microsoft.

udf - this format (universal disk format) appeared and developed as the successor to ISO 9660.

Network file systems

File systems do not need to be on local disk- they
can connect to a computer and over a network. The Linux kernel supports a variety of network filesystems, of which the following are most commonly used.

smbfs / cifs - help to map Windows or Samba network shares to a directory tree.

nfs is the most important network file system in UNIX.

coda - This system is very similar to NFS. It contains many additional functions but it is not very common.

ncpfs - runs on the NetWare kernel protocol; oH is used by Novell Netware.

Virtual file systems

In Linux, there are several file systems designed not for storing data on a hard disk (or other medium), but only for the exchange of information between the kernel and user programs.
devpts - This file system provides access to pseudo-terminals (PTY for short) through / dev / pts / * in accordance with the UNIX-98 specification. (Pseudo-terminals emulate a serial interface. On UNIX / Linux systems, such interfaces are used by terminal emulators such as xterm. Typically, devices such as / dev / ttypn are used. In contrast, the UNIX-98 specification defines new devices. More detailed information reported in the text terminal H0WT0.)
proc and sysfs - the proc file system is used to display service information related to managing the kernel and processes. In addition, the sysfs filesystem builds relationships between the kernel and hardware. Both filesystems are mounted at / proc and / sys.
tmpfs - This system is built on the basis of shared memory in accordance with System V. It is usually mounted at / dev / shm and provides an efficient exchange of information between two programs. On some distributions (eg Ubuntu) the / var / run and / var / lock directories are also created using the tmpfs filesystem. The files in these directories are used by some network daemons to store process identification numbers as well as file access information. Thanks to tmpfs, this data is now reflected in RAM. The method guarantees high speed, and also that after turning off the computer, no files will remain in the / var / run or / var / lock directories.

usbfs - The usbfs file system, starting with kernel 2.6 and higher, gives information about connected USB devices. It is usually integrated into the proc filesystem. About USB device support in Linux.

Other file systems

auto - in fact, there is no file system with that name. However, auto can be used in / etc / fstab or with the mount command to specify a filesystem. In this case, Linux will try to recognize the file system on its own. This method works with most of the most important file systems.
autofs, autofs4

autofs, autofs4 are also not file systems, but kernel extensions that automatically execute the mount command for the selected file systems. If the file system has not been used for some time, the umount command is automatically executed against it. This method is convenient, first of all, in cases when only a few of many NFS directories are actively used at the same time.

To do this, the /etc/init.d/ autofs script automatically runs the automount program at system startup. It is configured using the /etc/auto.master file. The corresponding programs are automatically installed on, for example, Red Hat and Fedora. In any case, autofs is only activated after configuring /etc/auto.master or /etc/auto.misc.
cramfs and squashfs

cramfs and squashfs - Cram and Squash file systems are read-only. They are used to "pack" as many zipped files as possible into flash memory or ROM (read only memory).

fuse - FUSE stands for Filesystem in Userspace and allows you to develop and use file system drivers outside of the kernel. Therefore, FUSE is always used with an external file system driver. FUSE works in particular with the NTFS ntfs-3g driver.

gfs and ocfs - The Global File System and Oracle Cluster File System allow you to build giant networked file systems that can be accessed by multiple computers in parallel at the same time.

jffs and yaffs - Journaling Flash File System and Yet Another Flash File System are specially optimized to work with solid state drives and flash media. Using special algorithms, they try to use all memory cells evenly (wear leveling technology) to avoid premature system failure.
loop

loop - used to work with pseudo devices. A loopback device is an adapter capable of accessing a regular file as a block device. Thanks to it, any file system can be located in any file, and then mount it to the directory tree using mount. The kernel function responsible for this - pseudo device support - is implemented in the loop module.

There are various ways to use pseudo devices. In particular, they can be used when creating in-memory disks for initial initialization (Initial RAM disk) for GRUB or LILO, when implementing encrypted file systems or testing CD ISO images.

File systems of storage media

File systems
ISO 9660
Joliet file extension ISO systems 9660.
Rock Ridge (RRIP, IEEE P1282) is an ISO 9660 file system extension designed to store file attributes used in POSIX operating systems
Amiga Rock Ridge Extensions
El torito
Apple ISO9660 Extensions
HFS, HFS +
Universal Disk Format specification of an operating system-independent file system format for storing files on optical media... UDF is an implementation of the ISO / IEC 13346 standard
Mount rainier

ext2(also called as ext2fs) - Second Extended File System(Second Extended File System) is a file system built on top of the Linux kernel. Ext2 was created and developed by Remy Card. The ext2 file system was built by him to replace the old one, previous version- ext.

In terms of speed and performance, this file system can serve as a benchmark. This is evidenced by the results of performance tests of file systems. For example, in tests for sequential read and write speed, which was carried out by technical Center Dell, ext2 is superior to ext3, and is second only to the more modern ext4 in read speed.

The main disadvantage of ext2 is that it is not a journaling filesystem. However, this flaw was eliminated in the next filesystem - ext3.

ext2 is used on flash drives and solid state drives(SSD) as the lack of journaling is an advantage when dealing with drives with write cycle limits.

Ext2 history

During the rapid development of the Linux system, it used the Minix OS file system. It was quite stable, but at the same time it was 16-bit. As a result, it had a hard limit of 64 Mb per partition. In addition, there was a limitation on the maximum length of a file name, which was 14 characters.

Together, these limitations led to the development of the "extended file system" (hence the term " Extended File System "). She was tasked with solving two key problems of Minix. The new file system was made public in April 1992. It was Ext, it extended the file size limit to 2 gigabytes and set the file name length limit to 255 characters.

However, despite the success of the new file system, there were still quite a few unresolved problems. For example, there was no support for split access, there were no data modification timestamps. The need to solve these problems was the motive for the creation of the next version of the extended ext2 file system (“ Second Extended File System "). ext2 was developed in January 1993, it also implemented the corresponding the POSIX standard ACLs and extended file attributes.

Ext2 logical organization

The ext2 directory hierarchy graph is represented as a network. This is due to the fact that one file can be included in several directories at once.

All file types have symbolic names. Hierarchically organized file systems typically use three types of names: simple, compound, and relative. So it is in ext2. In the case of a simple name, the restriction is that its length should not exceed 255 characters, in addition, the name should not contain the NULL character and slash.

As for the NULL character, the restrictions are related to the representation of strings in the C language, in the case of the slash character, everything lies in the fact that it is used as a separating character between directories.

The fully qualified name is a chain of simple symbolic names of all directories through which the path goes from root to of this file... In ext2, a file can be in multiple directories, which means that it can have multiple fully qualified names (one file - multiple fully qualified names). But anyway, the full name defines the file.

Ext2 attributes:

  • file type and permissions,
  • owner, access group,
  • information on permitted operations,
  • creation time, date of last access, date last change and the time of the last deletion,
  • the current file size,
  • file specification:
    • regular file,
    • catalog,
    • byte-oriented device file,
    • block device file,
    • named pipe,
    • symbolic link,
  • the number of occupied blocks,
  • others

File attributes are contained in special tables, not in directories, as is usually the case with simple file systems. As a result, the directory has a very simple structure with two parts: an inode number and a name.

Physical organization ext2

Disk partition structure

As part of ext2, the following can be distinguished:

  • blocks and block groups;
  • inode;
  • superblock.

The entire disk space is split into fixed-size blocks, which are multiples of the sector size (1024, 2048, 4096, or 8192 bytes). The block size is specified when creating a file system on a disk partition. Sequential numbers are assigned to all blocks. To reduce fragmentation and the number of movements of the hard disk heads when reading large data arrays, blocks are combined into groups.

The basic concept of a filesystem is the inode (also called inode - information node). It is a special structure that contains information about the attributes and physical location of a file. Index decryptors are combined into a table at the beginning of each block group. The superblock is the main element of the ext2 filesystem. It contains general information about the file system. The superblock is located 1024 bytes from the beginning of the section. The integrity of the superblock determines the health of the file system. OS creates several backups superblock - in case the partition is damaged. In the next block after the superblock there is a global descriptor table - a description of block groups in the form of an array with general information about all groups of blocks.

Block group

All blocks on an ext2 partition are split into groups. A separate entry in the global descriptor table is created for each group. This record stores basic parameters such as: block number in bitmaps and tables, number of free blocks in a group, number of inodes containing directories.

Block bitmap Is a system in which each bit informs whether the block corresponding to it is assigned to any file. If the bit is 1, then the block is busy. The inode bitmap performs a similar function: it shows which inodes busy and which are not. The Linux kernel tries to evenly distribute the inodes of directories into groups, and move the inodes of files to a group with the parent directory. All the remaining space that appears in the table as data is allocated for storing files.

Data addressing system

The data addressing system is one of the most serious and key components of the file system. Thanks to her, there is desired file among many empty or occupied blocks on the disk.

ext2 uses the following file block addressing scheme. To store the file address, 15 fields are allocated, each of which consists of 4 bytes. If the file fits into 12 blocks, then the numbers of the corresponding clusters are listed in the first twelve fields of the address. If the file size exceeds 12 blocks, then the next field contains the address of the cluster in which the numbers of the next blocks of the file can be located. So, the thirteenth field is used for indirect addressing.

At maximum size block of 4096 bytes, the cluster corresponding to the 13th field can contain up to 1024 numbers of the following blocks of the file. If the file size exceeds 12 + 1024 blocks, then the 14th field is used, which contains the address of a cluster containing 1024 cluster numbers, each of which refers to 1024 file blocks. Here, double indirect addressing is already used. And if the file contains more than 12 + 1024 + 1048576 blocks, then the last 15th field for triple indirect addressing is applied.

This addressing system allows for a maximum block size of 4096 bytes to have files larger than 2 TB.