What is an element of the file system. File inodes. Comparison of file systems for Windows

The ability of the OS to “shield” the complexities of real hardware is very clearly manifested in one of the main subsystems of the OS - file system. The operating system virtualizes a separate set of data stored on an external drive as a file - a simple unstructured sequence of bytes with a symbolic name. For ease of working with data, files are grouped into catalogs, which, in turn, form groups - directories of more high level. The user can use the OS to perform actions on files and directories such as searching by name, deleting, displaying content on an external device (for example, on a display), changing and saving content.

To represent a large number of data sets, scattered randomly across cylinders and surfaces of various types of disks, in the form of a familiar and convenient hierarchical structure of files and directories, the operating system must solve many problems. The OS file system converts the symbolic names of files that the user or application programmer works with into physical addresses of data on the disk, organizes shared access to files, and protects them from unauthorized access.

When performing its functions, the file system closely interacts with the external device management subsystem, which, at the request of the file system, transfers data between disks and RAM.

The external device control subsystem, also called the input/output subsystem, acts as an interface to all devices connected to the computer. The range of these devices is very extensive. The range of manufactured hard drives, floppy and optical drives, printers, scanners, monitors, plotters, modems, network adapters and more special input/output devices, such as analog-to-digital converters, can number hundreds of models. These models may differ significantly in the set and sequence of commands used to exchange information with the computer’s processor and memory, operating speed, encoding of transmitted data, the ability to share and many other details.

A program that controls a specific model of an external device and takes into account all its features is usually called driver this device (from the English drive - to manage, to lead). The driver can control a single device model, such as the ZyXEL U-1496E modem, or a group of devices of a specific type, such as any Hayes-compatible modems. It is very important for the user that the operating system includes as many different drivers as possible, as this guarantees the ability to connect to the computer large number external devices from various manufacturers. The success of the operating system in the market largely depends on the availability of suitable drivers (for example, the lack of many necessary external device drivers was one of the reasons for the low popularity of OS/2).



The creation of device drivers is carried out both by developers of a specific OS and by specialists from companies that produce external devices. The operating system must support a well-defined interface between the drivers and the rest of the OS so that I/O device developers can provide drivers for the operating system with their devices.

Application programmers can use the driver interface when developing their programs, but this is not very convenient - such an interface usually represents low-level operations, burdened big amount details.

Maintaining a high-level unified application programming interface to heterogeneous I/O devices is one of the most important tasks of the OS. Since the advent of the UNIX OS, such a unified interface has been used in most operating systems is based on the concept of file access. This concept is that communication with any external device looks like an exchange with a file that has a name and is an unstructured sequence of bytes. The file can be either a real file on disk or an alphanumeric terminal, printing device, or network adapter. Here we are again dealing with the ability of an operating system to replace real hardware with user- and programmer-friendly abstractions.

OS tasks for managing files and devices

The input-output subsystem (Input-Output Subsystem) of a multiprogram OS must solve a number of problems when exchanging data with external computer devices common tasks, of which the most important are the following:

Organization parallel work I/O devices and processor;

Coordination of exchange rates and data caching;

Separation of devices and data between processes;

Providing convenient logical interface between devices and the rest of the system;

Support for a wide range of drivers with the ability to easily add a new driver to the system;

Supports multiple file systems;

Supports synchronous and asynchronous I/O operations.

One of the main tasks of the operating system is to provide convenience to the user when working with data stored on disks. To do this, the OS replaces the physical structure of the stored data with some user-friendly logical model. Logical file system model materializes in the form directory tree, displayed by utilities such as Norton Commander or Windows Explorer, in symbolic compound file names, in file commands. Basic element this model is file, which, like the file system as a whole, can be characterized by both logical and physical structure.

File is a named area external memory, into which data can be written to and from which data can be read. Files are stored in power dependent memory, usually magnetic disks. However, there are no rules without exceptions. One such exception is the so-called electronic disk, when a structure simulating a file system is created in RAM.

Main purposes of using the file:

Long-term and reliable storage of information. Durability is achieved through the use of storage devices that do not depend on power, and high reliability is determined by means of protecting access to files and general organization OS program code, in which hardware failures most often do not destroy the information stored in files.

Sharing information. Files provide a natural and easy way to share information between applications and users by having a human-readable symbolic name and consistency in the information stored and file location. The user must have convenient tools for working with files, including directories that combine files into groups, tools for searching files by characteristics, a set of commands for creating, modifying and deleting files. A file can be created by one user and then used by a completely different user, and the file creator or administrator can determine the access rights of other users. These goals are implemented in the OS by the file system.

File system(FS) is a part of the operating system, including:

The collection of all files on the disk;

Sets of data structures used to manage files, such as file directories, file descriptors, free and used disk space allocation tables;

A set of system software tools that implement various operations over files, such as creating, destroying, reading, writing, naming and searching files.

The file system allows programs to make do with a set of fairly simple operations to perform actions on some abstract object that represents a file. This way, programmers don't have to deal with the details of the actual location of data on disk, data buffering, and other low-level issues of transferring data from long-term storage. The file system takes on all these functions. The file system allocates disk memory, supports file naming, maps file names to corresponding addresses in external memory, provides access to data, and supports file partitioning, protection, and recovery.

Thus, the file system plays the role of an intermediate layer that screens out all the complexities of the physical organization of long-term data storage, and creates a simpler logical model for this storage for programs, as well as providing them with a set of easy-to-use commands for manipulating files.

The problems solved by the FS depend on the way the computing process is organized as a whole. The simplest type is a file system in single-user and single-program operating systems, which include, for example, MS-DOS. The main functions in such a FS are aimed at solving the following tasks:

File naming;

Software interface for applications;

Mapping the logical model of the file system to the physical organization of the data warehouse;

File system resilience to power failures, hardware and software errors.

FS tasks become more complicated in single-user multiprogram operating systems, which, although designed for the work of one user, give him the ability to run several processes simultaneously. One of the first operating systems of this type was OS/2. In addition to the tasks listed above new task sharing a file from multiple processes. The file in this case is a shared resource, which means that the file system must solve the whole range of problems associated with such resources. In particular, the FS must provide means for blocking a file and its parts, preventing races, eliminating deadlocks, reconciling copies, etc.

In multi-user systems, another task appears: protecting one user's files from unauthorized access by another user. The functions of the FS, which operates as part of a network OS, become even more complex.

File systems support several functionally different file types, which usually include regular files, directory files, special files, named pipes, memory-mapped files, and others.

Regular files, or simply files, contain arbitrary information that is entered into them by the user or that is generated as a result of the operation of system and user programs. Most modern operating systems (for example, UNIX, Windows, OS/2) do not restrict or control the contents and structure of a regular file in any way. The contents of a regular file are determined by the application that works with it. For example, text editor creates text files consisting of strings of characters represented in some code. These can be documents, source codes of programs, etc. Text files can be read on the screen and printed on a printer. Binary files do not use character codes and often have complex internal structures, such as executable program code or an archive file. All operating systems must be able to recognize at least one file type - their own executable files.

Catalogs- this is a special type of files that contain system reference information about a set of files grouped by users according to some informal criterion (for example, files containing documents of the same contract, or files that make up one software package are combined into one group). On many operating systems, a directory can contain any type of file, including other directories, creating a tree structure that is easy to search. Directories establish a mapping between file names and file characteristics that are used by the file system to manage files. Such characteristics include, in particular, information (or a pointer to another structure containing this data) about the type of file and its location on the disk, access rights to the file, and the dates of its creation and modification. In all other respects, directories are treated by the file system as regular files.

Special files- These are dummy files associated with I/O devices, which are used to unify the mechanism for accessing files and external devices. Special files allow the user to perform I/O operations using normal commands for writing to a file or reading from a file. These commands are processed first by file system programs, and then at some stage of the request execution they are converted by the operating system into control commands for the corresponding device.

Modern file systems support other file types, such as symbolic links, named pipes, and memory-mapped files.

Users access files by symbolic names. However, abilities human memory limit the number of object names that a user can access by name. The hierarchical organization of the namespace allows us to significantly expand these boundaries. This is why most file systems have a hierarchical structure, in which levels are created by allowing a lower-level directory to be contained within a higher-level directory (Figure 2.16).

Figure 2.16. Hierarchy of file systems (a – single-level structure, b – tree structure, c – network structure)

The graph describing the directory hierarchy can be a tree or a network. Directories form a tree if a file is allowed to be included in only one directory (Figure 2.16, b), and a network - if the file can be included in several directories at once (Figure 2.16, c). For example, in MS-DOS and Windows, directories form a tree structure, while in UNIX they form a network structure. In a tree structure, each file is a leaf. The top-level directory is called root directory, or root.

With this organization, the user is freed from remembering the names of all files; he only needs to have a rough idea of ​​which group a particular file can be assigned to in order to find it by sequentially browsing directories. The hierarchical structure is convenient for multi-user work: each user with their files is localized in their own directory or subtree of directories, and at the same time, all files in the system are logically connected.

A special case of a hierarchical structure is a single-level organization, when all files are included in one directory (Figure 2.16, a).

All file types have symbolic names. Hierarchically organized file systems typically use three types of file names: simple, compound, and relative.

Simple, or short, symbolic name identifies a file within the same directory. Simple names are assigned to files by users and programmers, and they must take into account OS restrictions on both the range of characters and the length of the name. Until relatively recently, these boundaries were very narrow. Thus, in the popular FAT file system, the length of names was limited to scheme 8.3 (8 characters - the name itself, 3 characters - the name extension), and in the s5 file system, supported by many versions of the UNIX OS, a simple symbolic name could not contain more than 14 characters. However, it is much more convenient for the user to work with long names because they allow you to give the files easy-to-remember names that clearly indicate what is contained in the file. Therefore, modern file systems, as well as improved versions of pre-existing file systems, tend to support long, simple symbolic file names. For example, in the NTFS and FAT32 file systems included in the Windows NT operating system, file name can contain up to 255 characters.

In hierarchical file systems different files It is allowed to have the same simple symbolic names, provided that they belong to different directories. That is, the “many files - one simple name” scheme works here. To uniquely identify a file in such systems, a so-called full name is used.

Full name is a chain of simple symbolic names of all directories through which the path from the root to the given file passes. Thus, the full name is a compound name, in which simple names are separated from each other by the separator accepted in the OS. Often a forward or backslash is used as a delimiter, and it is customary not to specify the name of the root directory. In Figure 2.16, b, two files have the simple name main.exe, but their compound names /depart/main.exe and /user/anna/main.exe are different.

In a tree file system, there is a one-to-one correspondence between a file and its full name: one file - one full name. In file systems that have a network structure, a file can be included in several directories, and therefore have several full names; here the correspondence “one file - many full names” is valid. In both cases, the file is uniquely identified by its full name.

The file can also be identified by a relative name . Relative name file is defined through the concept of “current directory”. For each user, at any given time, one of the file system directories is the current directory, and this directory is selected by the user himself upon an OS command. The file system captures the name of the current directory so that it can then use it as a complement to relative names to form the fully qualified file name. When using relative names, the user identifies a file by the chain of directory names through which the route from the current directory to the given file passes. For example, if the current directory is /user, then the relative file name /user/anna/main.exe is anna/main.exe.

Some operating systems allow you to assign multiple simple names to the same file, which can be interpreted as aliases. In this case, just as in a system with a network structure, the correspondence “one file - many full names” is established, since each simple file name corresponds to at least one full name.

And although the full name uniquely identifies the file, it is easier for the operating system to work with the file if there is a one-to-one correspondence between the files and their names. For this purpose, it assigns a unique name to the file, so that the relationship “one file - one unique name” is valid. The unique name exists along with one or more symbolic names assigned to the file by users or applications. The unique name is a numeric identifier and is intended only for the operating system. An example of this unique name file is the inode number on a UNIX system.

The concept of “file” includes not only the data and name it stores, but also its attributes. Attributes- This is information describing the properties of the file. Examples of possible file attributes:

File type (regular file, directory, special file and so on.);

Owner of the file;

File Creator;

Password to access the file;

Information about permitted file access operations;

Times of creation, last access and last modification;

Current file size;

Maximum file size;

Read-only sign;

“Hidden file” sign;

Sign " system file»;

Sign “archive file”;

Sign "binary/character";

The sign is “temporary” (remove after the process is completed);

Blocking sign;

Length of the file record;

Pointer to the key field in the record;

Key length.

The set of file attributes is determined by the specifics of the file system: in file systems different types Different sets of attributes can be used to characterize files. For example, on file systems that support flat files, there is no need to use the last three attributes in the list that are related to file structuring. In a single-user OS, the set of attributes will lack characteristics relevant to users and security, such as the owner of the file, the creator of the file, the password for accessing the file, information about authorized access to the file.

The user can access attributes using the facilities provided for this purpose by the file system. Typically, you can read the values ​​of any attribute, but only change some. For example, a user can change the permissions of a file (provided they have the necessary permissions to do so), but they are not allowed to change the creation date or current size of the file.

File attribute values ​​can be directly contained in directories, as is done in the MS-DOS file system (Figure 2.17a). The figure shows the structure of a directory entry containing a simple symbolic name and file attributes. Here the letters indicate the characteristics of the file: R - read-only, A - archived, H - hidden, S - system.

Figure 2.17. Directory structure: a - MS-DOS directory entry structure (32 bytes), b - UNIX OS directory entry structure

Another option is to place attributes in special tables, when the catalogs contain only links to these tables. This approach is implemented, for example, in the ufs file system of the UNIX OS. In this file system, the directory structure is very simple. The entry for each file contains a short symbolic file name and a pointer to the file index descriptor, this is the name in ufs for the table in which the file attribute values ​​are concentrated (Figure 2.17, b).

In both versions, directories provide a link between file names and the files themselves. However, the approach of separating the file name from its attributes makes the system more flexible. For example, a file can easily be included in several directories at once. Entries for this file in different directories may have different simple names, but the link field will have the same inode number.

The user's view of the file system as a hierarchically organized set information objects has little to do with the order in which files are stored on disk. A file that has the image of a solid, uninterrupted set of bytes is in fact very often scattered in “pieces” throughout the disk, and this partitioning has nothing to do with the logical structure of the file, for example, its individual logical record may be located in non-contiguous sectors of the disk. Logically combined files from one directory do not have to be adjacent to each other on the disk. Principles for placing files, directories and system information on a real device are described by the physical organization of the file system. Obviously, different file systems have different physical organization.

The main type of device used in modern computing systems for storing files is disk drives. These devices are designed to read and write data to hard and floppy disks. A hard drive consists of one or more glass or metal plates, each of which is coated on one or both sides magnetic material. Thus, the disk generally consists of a stack of plates (Figure 2.18).

Thin concentric rings are marked on each side of each plate - tracks(traks) on which data is stored. The number of tracks depends on the disc type. Track numbering starts from 0 from the outer edge to the center of the disc. As the disk spins, an element called a head reads binary data from a magnetic track or writes it to a magnetic track.

Figure 2.18. Scheme hard devices disk

The head can be positioned over a given track. The heads move over the disk surface in discrete steps, each step corresponding to a shift of one track. Recording on a disc is carried out thanks to the ability of the head to change the magnetic properties of the track. Some drives have one head moving along each surface, while others have one head for each track. In the first case, to search for information, the head must move along the radius of the disk. Typically, all heads are mounted on a single moving mechanism and move synchronously. Therefore, when a head stops on a given track on one surface, all other heads stop over tracks with the same numbers. In cases where each track has a separate head, no movement of the heads from one track to another is required, thereby saving time spent searching for data.

The set of tracks of the same radius on all surfaces of all plates of the package is called cylinder(cylinder). Each track is divided into fragments called sectors(sectors), or blocks (blocks), so that all tracks have equal number sectors into which the same number of bytes can be written as much as possible. The sector has a fixed size for a specific system, expressed as a power of two. The most common sector size is 512 bytes. Considering that tracks of different radii have the same number of sectors, the recording density becomes higher the closer the track is to the center.

Sector- the smallest addressable unit of data exchange between a disk device and RAM. In order for the controller to find the desired sector on the disk, it is necessary to give it all the components of the sector address: cylinder number, surface number and sector number. Because application program in the general case, what is needed is not a sector, but a certain number of bytes, not necessarily a multiple of the sector size, then a typical request includes reading several sectors containing the required information, and one or two sectors containing, along with the required, redundant data (Figure 2.19).

Figure 2.19. Reading redundant data when exchanged with disk

When working with a disk, the operating system usually uses its own unit of disk space, called cluster(cluster). When a file is created, disk space is allocated to it by clusters. For example, if a file has a size of 2560 bytes, and the cluster size in the file system is defined as 1024 bytes, then the file will be allocated 3 clusters on disk.

Tracks and sectors are created by performing a physical, or low-level, disk formatting procedure before the disk is used. To determine block boundaries, identification information is written to disk. The low-level disk format does not depend on the type of operating system that the disk will use.

Disk partitioning for a specific file system type is performed by high-level, or logical, formatting procedures.

At high level formatting The cluster size is determined and the information necessary for the operation of the file system is written to the disk, including information about available and unused space, the boundaries of areas allocated for files and directories, and information about damaged areas. In addition, the operating system loader is written to the disk - a small program that begins the process of initializing the operating system after turning on the power or restarting the computer.

Before formatting a disk for a specific file system, it can be partitioned. Chapter is a contiguous portion of a physical disk that the operating system presents to the user as a logical device (the names logical disk and logical partition are also used). The logical device functions as if it were a separate physical disk. It is with logical devices that the user works, referring to them by symbolic names, using, for example, the designations A, B, C, SYS, etc. Operating systems of different types use a common idea of ​​partitions for all of them, but create logical ones based on it devices specific to each OS type. Just as a file system that one OS operates on cannot generally be interpreted by another type of OS, logical devices cannot be used by operating systems of different types. On every logical device only one file system can be created.

Material for review lecture No. 33

for specialty students

"Information Technology Software"

Associate Professor of the Department of Computer Science, Ph.D. Livak E.N.

FILE MANAGEMENT SYSTEMS

Basic concepts, facts

Purpose. Features of file systemsFATVFATFAT 32,HPFSNTFS. File systems UNIX OS (s5, ufs), Linux OS Ext2FS. System areas of the disk (partition, volume). Principles of file placement and storage of file location information. Organization of catalogs. Restricting access to files and directories.

Skills

Using knowledge of file system structure for protection and recovery computer information(files and directories). Organization of access control to files.

File systems. File system structure

Data on disk is stored in the form of files. A file is a named part of a disk.

File management systems are designed to manage files.

The ability to deal with data stored in files at the logical level is provided by the file system. It is the file system that determines the way data is organized on any storage medium.

Thus, file system is a set of specifications and their corresponding software that are responsible for creating, destroying, organizing, reading, writing, modifying and moving file information, as well as for controlling access to files and managing the resources that are used by files.

The file management system is the main subsystem in the vast majority of modern operating systems.

Using a file management system

· all system processing programs are connected using data;

· problems of centralized distribution of disk space and data management are solved;

· the user is provided with opportunities to perform operations on files (creation, etc.), exchange data between files and various devices, and protect files from unauthorized access.

Some operating systems may have multiple file management systems, giving them the ability to handle multiple file systems.

Let's try to distinguish between a file system and a file management system.

The term "file system" defines the principles of access to data organized in files.

Term "file management system" refers to a specific implementation of the file system, i.e. This is a set of software modules that provide work with files in a specific OS.

So, to work with files organized in accordance with some file system, an appropriate file management system must be developed for each OS. This UV system will only work on the OS for which it is designed.

For the Windows OS family, the main file systems used are: VFAT, FAT 32, NTFS.

Let's look at the structure of these file systems.

On the file system FAT The disk space of any logical drive is divided into two areas:

system area and

· data area.

System area created and initialized during formatting, and subsequently updated when the file structure is manipulated.

The system area consists of the following components:

· boot sector containing the boot record (boot record);

· reserved sectors (they may not exist);

· file allocation tables (FAT, File Allocation Table);

· root directory (ROOT).

These components are located on the disk one after another.

Data area contains files and directories subordinate to the root one.

The data area is divided into so-called clusters. A cluster is one or more adjacent sectors of a data area. On the other hand, a cluster is the minimum addressable unit of disk memory allocated to a file. Those. a file or directory occupies an integer number of clusters. To create and write a new file to disk, the operating system allocates several free disk clusters for it. These clusters do not have to follow each other. For each file, a list of all cluster numbers that are assigned to that file is stored.

Splitting the data area into clusters instead of using sectors allows you to:

· reduce the size of the FAT table;

· reduce file fragmentation;

· the length of file chains is reduced Þ speeds up file access.

However, too big size cluster leads to inefficient use of the data area, especially in the case of a large number of small files (after all, on average half a cluster is lost for each file).

In modern file systems (FAT 32, HPFS, NTFS) this problem is solved by limiting the cluster size (maximum 4 KB)

The data area map is T file allocation table (File Allocation Table - FAT) Each element of the FAT table (12, 16 or 32 bits) corresponds to one disk cluster and characterizes its state: free, busy or a bad cluster.

· If a cluster is allocated to a file (i.e., busy), then the corresponding FAT element contains the number of the next cluster of the file;

· the last cluster of the file is marked with a number in the range FF8h - FFFh (FFF8h - FFFFh);

· if the cluster is free, it contains the zero value 000h (0000h);

· a cluster that is unusable (failed) is marked with the number FF7h (FFF7h).

Thus, in the FAT table, clusters belonging to the same file are linked into chains.

The file allocation table is stored immediately after the boot record of the logical disk; its exact location is described in a special field in the boot sector.

It is stored in two identical copies, which follow each other. When the first copy of the table is destroyed, the second one is used.

Due to the fact that FAT is used very heavily during disk access, it is usually loaded into the RAM (into I/O buffers or cache) and remains there for as long as possible.

The main disadvantage of FAT is its slow processing of files. When creating a file, the rule is that the first free cluster is allocated. This leads to disk fragmentation and complex file chains. This results in slower work with files.

To view and edit the FAT table you can use utilityDiskEditor.

Detailed information about the file itself is stored in another structure called the root directory. Each logical drive has its own root directory (ROOT).

Root directory describes files and other directories. A directory element is a file descriptor.

Each file and directory descriptor includes it

· Name

· extension

date of creation or latest modification

· time of creation or last modification

attributes (archive, directory attribute, volume attribute, system, hidden, read-only)

· file length (for a directory - 0)

· reserved field that is not used

· number of the first cluster in the chain of clusters allocated to a file or directory; Having received this number, the operating system, referring to the FAT table, finds out all the other cluster numbers of the file.

So, the user launches the file for execution. The operating system looks for a file with the desired name by looking at the descriptions of the files in the current directory. When the required element is found in the current directory, the operating system reads the first cluster number of this file, and then uses the FAT table to determine the remaining cluster numbers. Data from these clusters is read into RAM, combining into one continuous section. The operating system transfers control to the file, and the program begins to run.

To view and edit the root directory ROOT you can also use utilityDiskEditor.

File system VFAT

The VFAT (virtual FAT) file system first appeared in Windows for Workgroups 3.11 and was designed for protected mode file I/O.

This file system is used in Windows 95.

It is also supported in Windows NT 4.

VFAT is the native 32-bit file system of Windows 95. It is controlled by the VFAT .VXD driver.

VFAT uses 32-bit code for all file operations and can use 32-bit protected mode drivers.

BUT, the file allocation table entries remain 12- or 16-bit, so the disk uses the same data structure (FAT). Those. f table formatVFAT is the same, like the FAT format.

VFAT along with "8.3" names supports long file names. (VFAT is often said to be FAT with support for long names).

The main disadvantage of VFAT is the large clustering losses with large logical disk sizes and restrictions on the size of the logical disk itself.

File system FAT 32

This is a new implementation of the idea of ​​using the FAT table.

FAT 32 is a completely self-contained 32-bit file system.

First used in Windows OSR 2 (OEM Service Release 2).

Currently, FAT 32 is used in Windows 98 and Windows ME.

It contains numerous improvements and additions over previous FAT implementations.

1. Uses disk space much more efficiently due to the fact that it uses smaller clusters (4 KB) - it is estimated that savings of up to 15%.

2. Has an extended boot record that allows you to create copies of critical data structures Þ increases the disc's resistance to damage to disc structures

3. Can use FAT backup instead of standard one.

4. Can move the root directory, in other words, the root directory can be in any location Þ removes the limitation on the size of the root directory (512 elements, since ROOT was supposed to occupy one cluster).

5. Improved root directory structure

Additional fields have appeared, for example, creation time, creation date, last access date, checksum

There are still multiple handles for a long filename.

File system HPFS

HPFS (High Performance File System) is a high-performance file system.

HPFS first appeared in OS/2 1.2 and LAN Manager.

Let's list main features of HPFS.

· The main difference is basic principles placement of files on disk and principles of storing information about the location of files. Thanks to these principles, HPFS has high performance and fault tolerance, is reliable file system.

· Disk space in HPFS is allocated not in clusters (as in FAT), but blocks. In the modern implementation, the block size is taken equal to one sector, but in principle it could be of a different size. (In fact, a block is a cluster, only a cluster is always equal to one sector). Placing files in such small blocks allows use disk space more efficiently, since the overhead of free space is on average only (half a sector) 256 bytes per file. Remember that the larger the cluster size, the more disk space is wasted.

· The HPFS system strives to arrange the file in contiguous blocks, or, if this is not possible, place it on the disk in such a way that extents(fragments) of the file were physically as close to each other as possible. This approach is essential reduces write/read head positioning time hard drive and wait time (delay between installing the read/write head on the desired track). Let us recall that in a FAT file the first free cluster is simply allocated.

Extents(extent) - file fragments located in adjacent sectors of the disk. A file has at least one extent if it is not fragmented, and multiple extents otherwise.

·Used method balanced binary trees for storing and searching information about the location of files (directories are stored in the center of the disk, in addition, automatic sorting of directories is provided), which is essential increases productivity HPFS (vs. FAT).

· HPFS provides special extended file attributes that allow control access to files and directories.

Extended Attributes (extended attributes, EAs ) allow you to store additional information about the file. For example, each file can be associated with its unique graphic (icon), file description, comment, file owner information, etc.

C HPFS partition structure


At the beginning of the partition with HPFS installed there are three block controls:

boot block

· additional block (super block) and

· spare (backup) block (spare block).

They occupy 18 sectors.

All remaining disk space in HPFS is divided into parts from adjacent sectors - stripes(band - strip, tape). Each strip takes up 8 MB of disk space.

Each strip has its own sector allocation bitmap.The bitmap shows which sectors of a given band are occupied and which are free. Each sector of a data strip corresponds to one bit in its bitmap. If bit = 1, then the sector is busy, if 0, then it is free.

The bitmaps of the two lanes are located side by side on the disk, as are the lanes themselves. That is, the sequence of stripes and cards looks like in Fig.

Compare withFAT. There is only one “bit map” for the entire disk (FAT table). And to work with it you have to move the read/write heads across half the disk on average.

It is in order to reduce the time of positioning the read/write heads of a hard disk that in HPFS the disk is divided into stripes.

Let's consider control blocks.

Boot block (bootblock)

Contains the volume name, its serial number, BIOS parameter block and boot program.

The bootstrap program finds the file OS 2 LDR , reads it into memory and transfers control to this OS boot program, which, in turn, loads the OS/2 kernel from disk into memory - OS 2 KRNL. And already OS 2 KRIML using information from the file CONFIG. SYS loads all other necessary program modules and data blocks into memory.

The boot block is located in sectors 0 to 15.

SuperBlock(super block)

Contains

· pointer to a list of bitmaps (bitmap block list). This list lists all the blocks on the disk that contain the bitmaps used to detect free sectors;

· pointer to the list of defective blocks (bad block list). When the system detects a damaged block, it is added to this list and is no longer used to store information;

· pointer to directory band

· pointer to the file node (F -node) of the root directory,

· date of the last scan of the partition by CHKDSK;

· information about the stripe size (in the current HPFS implementation - 8 MB).

Super block is located in sector 16.

Spareblock(spare block)

Contains

· pointer to the emergency replacement map (hotfix map or hotfix -areas);

· pointer to the list of free spare blocks (directory emergency free block list);

· a number of system flags and descriptors.

This block is located in sector 17 of the disk.

The backup block provides high fault tolerance to the HPFS file system and allows you to recover damaged data on the disk.

File placement principle

Extents(extent) - file fragments located in adjacent sectors of the disk. A file has at least one extent if it is not fragmented, and multiple extents otherwise.

To reduce the time it takes to position the read/write heads of a hard disk, the HPFS system strives to

1) place the file in adjacent blocks;

2) if this is not possible, then place the extents of the fragmented file as close to each other as possible,

To do this, HPFS uses statistics and also tries to conditionally reserve at least 4 kilobytes of space at the end of files that are growing.

Principles for storing file location information

Each file and directory on the disk has its own file node F-Node. This is a structure that contains information about the location of a file and its extended attributes.

Each F-Node occupies one sector and is always located close to its file or directory (usually immediately before the file or directory). The F-Node object contains

· length,

· first 15 characters of the file name,

· special service information,

· statistics on file access,

· extended file attributes,

· a list of access rights (or only part of this list, if it is very large); If the extended attributes are too large for the file node, then a pointer to them is written to it.

· associative information about the location and subordination of the file, etc.

If the file is contiguous, then its location on disk is described by two 32-bit numbers. The first number is a pointer to the first block of the file, and the second is the extent length (the number of consecutive blocks that belong to the file).

If a file is fragmented, then the location of its extents is described in the file node by additional pairs of 32-bit numbers.

A file node can contain information about up to eight extents of a file. If a file has more extents, then a pointer to an allocation block is written to its file node, which can contain up to 40 pointers to extents or, similar to a directory tree block, to other allocation blocks.

Directory structure and placement

Used to store directories stripe located in the center of the disk.

This strip is called directoryband.

If it is completely full, HPFS starts placing file directories in other stripes.

Placing this information structure in the middle of the disk significantly reduces the average read/write head positioning time.

However, a significantly greater contribution to HPFS performance (compared to placing the Directory Band in the middle of a logical disk) is made by using method balanced binary trees for storing and retrieving information about the location of files.

Recall that in the file system FAT the directory has a linear structure, not ordered in a special way, so when searching for a file you need to look through it sequentially from the very beginning.

In HPFS, the directory structure is a balanced tree with entries arranged in alphabetical order.

Each entry included in the tree contains

· file attributes,

· pointer to the corresponding file node,

information about the time and date the file was created, time and date latest update and appeals,

length of data containing extended attributes,

· file access counter,

file name length

· the name itself,

· and other information.

The HPFS file system looks only at the necessary branches of the binary tree when searching for a file in a directory. This method is many times more efficient than sequentially reading all entries in a directory, which is the case with the FAT system.

The size of each block in terms of which directories are allocated in the current HPFS implementation is 2 KB. The size of the entry describing the file depends on the size of the file name. If a name is 13 bytes (for 8.3 format), then a 2 KB block can hold up to 40 file descriptors. Blocks are connected to each other through a list.

Problems

When renaming files, so-called tree rebalancing may occur. Creating a file, renaming or erasing it may result in cascading directory blocks. In fact, a rename may fail due to lack of disk space, even if the file itself has not grown in size. To avoid this disaster, HPFS maintains a small pool of free blocks that can be used in the event of a disaster. This operation may require allocating additional blocks on a full disk. A pointer to this pool of free blocks is stored in SpareBlock.

Principles for placing files and directories on disk inHPFS:

· information about the location of files is dispersed throughout the disk, with records for each specific file located (if possible) in adjacent sectors and close to the data about their location;

· directories are located in the middle of disk space;

· Directories are stored as a binary balanced tree with entries arranged in alphabetical order.

Reliability of data storage in HPFS

Any file system must have a means of correcting errors that occur when writing information to disk. The HPFS system uses for this emergency replacement mechanism ( hotfix).

If the HPFS file system encounters a problem while writing data to disk, it displays an error message. HPFS then stores the information that should have been written to the defective sector in one of the spare sectors reserved in advance for this eventuality. The list of free spare blocks is stored in the HPFS spare block. If an error is detected while writing data to a normal block, HPFS selects one of the free spare blocks and stores the data there. The file system then updates emergency replacement card in the reserve unit.

This map is simply pairs of double words, each of which is a 32-bit sector number.

The first number indicates the defective sector, and the second indicates the sector among the available spare sectors that was selected to replace it.

After replacing the defective sector with a spare one, the emergency replacement map is written to the disk, and a pop-up window appears on the screen informing the user that a disk write error has occurred. Every time the system writes or reads a disk sector, it looks at the recovery map and replaces all bad sector numbers with spare sector numbers with the corresponding data.

It should be noted that this number translation does not significantly affect system performance, since it is performed only when physically accessing the disk, and not when reading data from the disk cache.

File system NTFS

The NTFS (New Technology File System) file system contains a number of significant improvements and changes that significantly distinguish it from other file systems.

Note that with rare exceptions, with NTFS partitions can only be worked directly fromWindowsN.T. although there are corresponding implementations of file management systems for reading files from NTFS volumes for a number of OSes.

However, there are no full-fledged implementations for working with NTFS outside of Windows NT.

NTFS is not supported on the widely used Windows 98 and Windows Millennium Edition operating systems.

Key FeaturesNT FS

· work on large disks occurs efficiently (much more efficiently than in FAT);

· there are tools to restrict access to files and directories Þ NTFS partitions provide local security both files and directories;

· a transaction mechanism has been introduced in which logging file operations Þ significant increase in reliability;

· many restrictions on the maximum number of disk sectors and/or clusters have been removed;

· a file name in NTFS, unlike the FAT and HPFS file systems, can contain any characters, including the full set of national alphabets, since the data is represented in Unicode - a 16-bit representation that gives 65535 different characters. The maximum length of a file name in NTFS is 255 characters.

· NTFS also has built-in compression capabilities that you can apply to individual files, entire directories, and even volumes (and subsequently undo or assign them as you wish).

Volume structure with the NTFS file system

An NTFS partition is called a volume (volume). Maximum possible sizes volumes (and file sizes) are 16 EB (exabyte 2**64).

Like other systems, NTFS divides a volume's disk space into clusters—blocks of data that are addressed as data units. NTFS supports cluster sizes from 512 bytes to 64 KB; the standard is a cluster of 2 or 4 KB in size.

All disk space in NTFS is divided into two unequal parts.


The first 12% of the disk is allocated to the so-called MFT zone - space that can be occupied by the main service metafile MFT.

It is not possible to write any data to this area. The MFT zone is always kept empty - this is done so that the MFT file, if possible, does not become fragmented as it grows.

The remaining 88% of the volume is regular file storage space.

MFT (masterfiletable - general file table) is essentially a directory of all other files on the disk, including itself. It is designed to determine the location of files.

MFT consists of fixed size records. The MFT record size (minimum 1 KB and maximum 4 KB) is determined when the volume is formatted.

Each entry corresponds to a file.

The first 16 entries are of a service nature and are not available to the operating system - they are called metafiles, and the very first metafile is the MFT itself.

These first 16 MFT elements are the only part of the disk that has a strictly fixed position. A copy of these same 16 entries is kept in the middle of the volume for reliability.

The remaining parts of the MFT file can be located, like any other file, in arbitrary locations on the disk.

Metafiles are of a service nature - each of them is responsible for some aspect of the system's operation. Metafiles are located in the root directory of the NTFS volume. They all begin with the name symbol "$", although it is difficult to obtain any information about them using standard means. In table The main metafiles and their purpose are given.

Metafile name

Purpose of the metafile

$MFT

Master File Table itself

$MFTmirr

A copy of the first 16 MFT entries placed in the middle of the volume

$LogFile

Logging support file

$Volume

Service information - volume label, file system version, etc.

$AttrDef

List of standard file attributes on the volume

Root directory

$Bitmap

Volume free space map

$Boot

Boot sector (if the partition is bootable)

$Quota

A file that records user rights to use disk space (this file only started working in Windows 2000 with NTFS 5.0)

$Upcase

File - a table of correspondence between uppercase and lowercase letters in file names. In NTFS, file names are written in Unicode (which amounts to 65 thousand different symbols) and looking for large and small equivalents in this case is a non-trivial task

The corresponding MFT record stores all information about the file:

· file name,

· size;

· file attributes;

· position on the disk of individual fragments, etc.

If one MFT record is not enough for the information, then several records are used, and not necessarily consecutive ones.

If the file is not very large, then the file data is stored directly in the MFT, in the space remaining from the main data within one MFT record.

A file on an NTFS volume is identified by the so-called file link(File Reference), which is represented as a 64-bit number.

· file number that corresponds to the record number in MFT,

· and sequence numbers. This number is incremented whenever a given number in the MFT is reused, allowing the NTFS file system to internal audits integrity.

Each file in NTFS is represented by streams(streams), that is, it does not have “just data” as such, but there are streams.

One of the streams is the file data.

Most file attributes are also streams.

Thus, it turns out that the file has only one basic entity - the number in the MFT, and everything else, including its streams, is optional.

This approach can be used effectively - for example, you can “attach” another stream to a file by writing any data to it.

Standard attributes for files and directories on an NTFS volume have fixed names and type codes.

Catalog in NTFS is a special file that stores links to other files and directories.

The catalog file is divided into blocks, each containing

· file name,

basic attributes and

The root directory of the disk is no different from regular directories, except for a special link to it from the beginning of the MFT metafile.

The internal directory structure is a binary tree, similar to HPFS.

The number of files in the root and non-root directories is not limited.

The NTFS file system supports the NT security object model: NTFS treats directories and files as different types of objects and maintains separate (albeit overlapping) lists of permissions for each type.

NTFS provides file-level security; this means that access rights to volumes, directories, and files may depend on the user account and the groups to which the user belongs. Every time a user accesses a file system object, his access rights are checked against the permission list of that object. If the user has sufficient rights, his request is granted; otherwise the request is rejected. This security model applies both to local user registration on NT computers and to remote network requests.

The NTFS system also has certain self-healing capabilities. NTFS supports various mechanisms for verifying system integrity, including transaction logging, which allows file write operations to be replayed against a special system log.

At logging file operations, the file management system records the changes that occur in a special service file. At the beginning of an operation related to changing the file structure, a corresponding note is made. If any failure occurs during file operations, the said operation start mark remains indicated as incomplete. When you perform a file system integrity check after rebooting the machine, these pending operations will be canceled and the files will be restored to their original state. If the operation of changing data in files is completed normally, then in this very service logging support file the operation is marked as completed.

The main disadvantage of the file systemNTFS- service data takes up a lot of space (for example, each directory element takes up 2 KB) - for small partitions service data can take up to 25% of the media volume.

Þ NTFS cannot be used to format floppy disks. You should not use it to format partitions smaller than 100 MB.

OS file system UNIX

In the UNIX world there are several different types file systems with their own external memory structure. The most well-known are the traditional UNIX System V (s5) file system and the UNIX BSD family file system (ufs).

Consider s 5.

A file on a UNIX system is a collection of random access characters.

The file has a structure that is imposed on it by the user.

The Unix file system is a hierarchical, multi-user file system.

The file system has a tree structure. Peaks ( intermediate nodes) of the tree are directories with links to other directories or files. The leaves of the tree correspond to files or empty directories.

Comment. In fact, the Unix file system is not tree-based. The fact is that the system has the possibility of violating the hierarchy in the form of a tree, since it is possible to associate multiple names with the same file content.

Disk structure

The disk is divided into blocks. The data block size is determined when formatting the file system with the mkfs command and can be set to 512, 1024, 2048, 4096 or 8192 bytes.

We count 512 bytes (sector size).

Disk space is divided into the following areas (see figure):

· loading block;

· control superblock;

· array of i-nodes;

· area for storing the contents (data) of files;

· a set of free blocks (linked into a list);

Boot block

Superblock

i - node

. . .

i - node

Comment. For the UFS file system - all this is repeated for a group of cylinders (except for the Boot block) + a special area is allocated to describe the group of cylinders

Boot block

The block is located in block #0. (Recall that the placement of this block in system device block zero is determined by the hardware, since the hardware boot loader always accesses system device block zero. This is the last component of the file system that is hardware dependent.)

The boot block contains a promotion program that is used to initially launch the UNIX OS. In S 5 file systems, only the boot block of the root file system is actually used. In additional file systems, this area is present, but not used.

Superblock

It contains operational information about the state of the file system, as well as data about file system configuration parameters.

In particular, the superblock contains the following information

· number of i-nodes (index descriptors);

· partition size???;

· list of free blocks;

· list of free i-nodes;

· and other.

Let's pay attention! The free space on the disk is linked list of free blocks. This list is stored in a superblock.

List elements are arrays of 50 elements (if block = 512 bytes, then element = 16 bits):

· array elements No. 1-48 contain the numbers of free blocks of file block space from 2 to 49.

· element #0 contains a pointer to the continuation of the list, and

· the last element (No. 49) contains a pointer to a free element in the array.

If some process needs a free block to expand a file, then the system selects an array element using a pointer (to a free element), and the block with No. stored in this element is provided to the file. If the file is reduced, the freed numbers are added to the array of free blocks and the pointer to the free element is adjusted.

Since the array size is 50 elements, two critical situations are possible:

1. When we free blocks of files, but they cannot fit in this array. In this case, one free block is selected from the file system and the completely filled array of free blocks is copied into this block, after which the value of the pointer to the free element is reset, and the zero element of the array, which is located in the superblock, contains the number of the block that the system has chosen to copy the contents of the array. At this moment it is created new element list of free blocks (each with 50 elements).

2. When the contents of the elements of the array of free blocks have been exhausted (in this case, the zero element of the array is zero). If this element is not equal to zero, then this means that there is a continuation of the array. This continuation is read into a copy of the superblock in RAM.

Free listi-nodes. This is a buffer consisting of 100 elements. It contains information about 100 numbers of i-nodes that are free at the moment.

The superblock is always in RAM

Þ all operations (releasing and occupying blocks and i-nodes occur in RAM Þ minimizing disk exchanges.

But! If the contents of the superblock are not written to the disk and the power is turned off, problems will arise (a discrepancy between the real state of the file system and the contents of the superblock). But this is already a requirement for the reliability of the system equipment.

Comment. UFS file systems support multiple copies of the superblock (one copy per cylinder group) to improve stability.

Inode area

This is an array of file descriptions called i -nodes (i-node).(64 bytes?)

Each index descriptor (i-node) of a file contains:

· File type (file/directory/special file/fifo/socket)

· Attributes (access rights) - 10

File owner ID

· Group ID of the file owner

· File creation time

File modification time

· Time of last access to the file

· File length

· Number of links to a given i-node from various directories

File block addresses

!note. There is no file name here

Let's take a closer look at how it is organized block addressing, in which the file is located. So, in the address field there are numbers of the first 10 blocks of the file.

If the file exceeds ten blocks, then the following mechanism begins to work: the 11th element of the field contains the block number, which contains 128 (256) links to blocks of this file. If the file is even larger, then the 12th element of the field is used - it contains the block number, which contains 128(256) block numbers, where each block contains 128(256) file system block numbers. And if the file is even larger, then the 13th element is used - where the nesting depth of the list is increased by another one.

This way we can get a file of size (10+128+128 2 +128 3)*512.

This can be represented as follows:

Address of the 1st block of the file

Address of the 2nd block of the file

Address of the 10th block of the file

Indirect addressing block address (block with 256 block addresses)

Address of the 2nd indirect addressing block (block with 256 address blocks with addresses)

Address of the 3rd indirect addressing block (block with addresses of blocks with addresses of blocks with addresses)

File protection

Now let's look at the owner and group IDs and security bits.

In Unix OS it is used three-level user hierarchy:

The first level is all users.

The second level is user groups. (All users are divided into groups.

The third level is a specific user (Groups consist of real users). Due to this three-level organization of users, each file has three attributes:

1) Owner of the file. This attribute is associated with one specific user, who is automatically assigned by the system as the owner of the file. You can become the default owner by creating a file, and there is also a command that allows you to change the owner of a file.

2) File access protection. Access to each file is limited to three categories:

· owner rights (what the owner can do with this file, in the general case - not necessarily everything);

· rights of the group to which the file owner belongs. The owner is not included here (for example, a file could be closed to read by the owner, but all other group members can freely read from the file;

· all other users of the system;

These three categories regulate three actions: reading from a file, writing to a file, and executing a file (in the mnemonic R,W,X systems, respectively). Each file in these three categories defines which user can read, which can write, and who can run it as a process.

Directory organization

From the OS point of view, a directory is a regular file that contains data about all the files that belong to the directory.

A directory element consists of two fields:

1)number of the i-node (ordinal number in the array of i-nodes) and

2)file name:

Each directory contains two special names: ‘.’ - the directory itself; ‘..’ - parent directory.

(For the root directory, the parent refers to the same directory.)

In general, a directory can contain multiple entries referencing the same i-node, but the directory cannot contain entries with same names. That is, an arbitrary number of names can be associated with the contents of the file. It is called tying. A directory entry that refers to a single file is called communication.

Files exist independently of directory entries, and directory links actually point to physical files. A file "disappears" when the last link pointing to it is deleted.

So, to access a file by name, operating system

1. finds this name in the directory containing the file,

2. gets the number of the i-node of the file,

3. by number finds the i-node in the area of ​​i-nodes,

4. from the i-node receives the addresses of the blocks in which the file data is located,

5. reads blocks from the data area using block addresses.

Disk partition structure in EXT2 FS

The entire partition space is divided into blocks. A block can be 1, 2, or 4 kilobytes in size. A block is an addressable unit of disk space.

Blocks in their area are combined into groups of blocks. Groups of blocks in a file system and blocks within a group are numbered sequentially, starting with 1. The first block on a disk is numbered 1 and belongs to group number 1. The total number of blocks on a disk (in a disk partition) is a divisor of the disk's capacity, expressed in sectors. And the number of block groups does not have to divide the number of blocks, because the last block group may not be complete. The beginning of each group of blocks has an address, which can be obtained as ((group number - 1)* (number of blocks in the group)).

Each group of blocks has the same structure. Its structure is presented in the table.

The first element of this structure (superblock) is the same for all groups, and all the rest are individual for each group. The superblock is stored in the first block of each block group (except for group 1, which has a boot record in the first block). Superblock is the starting point of the file system. It is 1024 bytes in size and is always located at offset 1024 bytes from the beginning of the file system. The presence of multiple copies of a superblock is explained by the extreme importance of this element of the file system. Superblock duplicates are used when recovering a file system after failures.

The information stored in the superblock is used to organize access to the rest of the data on the disk. 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, the superblock is read into memory and all changes to the file system are first reflected in a copy of the superblock located in the OS and are written to disk only periodically. This improves system performance because many users and processes are constantly updating files. On the other hand, when the system is turned off, the superblock must be written to disk, which does not allow turning off the computer by simply turning off the power. Otherwise, the next time you boot, the information recorded in the superblock will not correspond to the real state of the file system.

Following the superblock is a description of the group of blocks (Group Descriptors). This description contains:

Address of the block containing the block bitmap of this group;

Address of the block containing the inode bitmap of this group;

Address of the block containing the inode table of this group;

Counter of the number of free blocks in this group;

The number of free inodes in this group;

The number of inodes in a given group that are directories

and other data.

The information stored in the group description is used to locate the block and inode bitmaps, as well as the inode table.

File system Ext 2 is characterized by:

  • hierarchical structure,
  • coordinated processing of data sets,
  • dynamic file extension,
  • protection of information in files,
  • treating peripheral devices (such as terminals and tape devices) as files.

Internal file representation

Each file in the Ext 2 system has a unique index. The index contains the information needed by any process to access the file. Processes access files using a well-defined set of system calls and identifying the file with a string of characters that acts as a qualified file name. Each compound name uniquely identifies a file, so the system kernel converts this name into a file index. The index includes a table of addresses where file information is located on disk. Since each block on a disk is addressed by its own number, this table stores a collection of disk block numbers. To increase flexibility, the kernel appends a file one block at a time, allowing the file's information to be scattered throughout the file system. But this layout complicates the task of searching for data. The address table contains a list of block numbers containing information belonging to the file.

File inodes

Each file on the disk has a corresponding file inode, which is identified by its serial number - the file index. This means that the number of files that can be created on a file system is limited by the number of inodes, which is either explicitly specified when the file system is created or calculated based on the physical size of the disk partition. Inodes exist on disk in static form and the kernel reads them into memory before working with them.

The file inode contains the following information:

- The type and access rights to this file.

File owner identifier (Owner Uid).

File size in bytes.

Time of the last access to the file (Access time).

File creation time.

Time of the last modification of the file.

File deletion time.

Group ID (GID).

Links count.

The number of blocks occupied by the file.

File flags

Reserved for OS

Pointers to blocks in which file data is written (an example of direct and indirect addressing in Fig. 1)

File version (for NFS)

ACL file

Directory ACL

Fragment address

Fragment number

Fragment size

Catalogs

Directories are files.

The kernel stores data in a directory the same way it does in a file regular type, using an index structure and blocks with direct and indirect addressing levels. Processes can read data from directories in the same way they read regular files, however, exclusive write access to the directory is reserved by the kernel, ensuring that the directory structure is correct.)

When a process uses a file path, the kernel looks in the directories for the corresponding inode number. After the file name has been converted to an inode number, the inode is placed in memory and then used in subsequent requests.

Additional features of EXT2 FS

In addition to standard Unix features, EXT2fs provides some additional features not typically supported by Unix file systems.

File attributes allow you to change how the kernel reacts when working with sets of files. You can set attributes on a file or directory. In the second case, files created in this directory inherit these attributes.

During system mounting, some features related to file attributes may be set. The mount option allows the administrator to choose how files are created. In a BSD-specific file system, files are created with the same group ID as the parent directory. The features of System V are somewhat more complex. If a directory has its setgid bit set, then generated files inherit the group ID of that directory, and subdirectories inherit the group ID and setgid bit. Otherwise, files and directories are created with the primary group ID of the calling process.

The EXT2fs system can use synchronous data modification similar to BSD system. The mount option allows the administrator to specify that all data (inodes, bit blocks, indirect blocks, and directory blocks) be written to disk synchronously when they are modified. This can be used to achieve high data recording capacity, but also results in poor performance. In reality, this function is not usually used because, in addition to degrading performance, it can lead to the loss of user data that is not flagged when checking the file system.

EXT2fs allows you to select the logical block size when creating a file system. It can be 1024, 2048 or 4096 bytes in size. Using larger blocks results in faster I/O operations (since fewer disk requests are made), and therefore less head movement. On the other hand, using large blocks leads to wasted disk space. Typically, the last block of a file is not completely used for storing information, so as the block size increases, the amount of wasted disk space increases.

EXT2fs allows you to use accelerated symbolic links. When using such links, file system data blocks are not used. The destination file name is not stored in the data block, but in the inode itself. This structure allows you to save disk space and speed up the processing of symbolic links. Of course, the space reserved for a handle is limited, so not every link can be represented as an accelerated link. The maximum length of a file name in an accelerated link is 60 characters. In the near future it is planned to expand this scheme for small files.

EXT2fs monitors the state of the file system. The kernel uses a separate field in the superblock to indicate the state of the file system. If the file system is mounted in read/write mode, then its state is set to "Not Clean". If it is dismantled or remounted in read-only mode, then its state is set to “Clean”. During system boot and file system status checks, this information is used to determine whether a file system check is necessary. The kernel also places some errors in this field. When the kernel detects a mismatch, the file system is marked as "Erroneous". The file system checker tests this information to check the system, even if its status is actually Clean.

Ignoring file system testing for a long time can sometimes lead to some difficulties, so EXT2fs includes two methods for regularly checking the system. The superblock contains the system mount counter. This counter is incremented each time the system is mounted in read/write mode. If its value reaches the maximum (it is also stored in the superblock), then the file system test program starts checking it, even if its state is "Clean". The last check time and the maximum interval between checks are also stored in the superblock. When the maximum interval between scans is reached, the state of the file system is ignored and its scan is started.

Performance optimization

The EXT2fs system contains many features that optimize its performance, which leads to increased speed of information exchange when reading and writing files.

EXT2fs actively uses the disk buffer. When a block needs to be read, the kernel issues an I/O operation request to several adjacent blocks. Thus, the kernel tries to make sure that the next block to be read has already been loaded into the disk buffer. Such operations are usually performed when reading files sequentially.

The EXT2fs system also contains a large number of optimizations for information placement. Block groups are used to group together corresponding inodes and data blocks. The kernel always tries to place the data blocks of one file in the same group, as well as its descriptor. This is intended to reduce the movement of the drive heads when reading the descriptor and its corresponding data blocks.

When writing data to a file, EXT2fs pre-allocates up to 8 contiguous blocks when allocating a new block. This method allows you to achieve high performance under heavy system load. This also allows files to be placed in contiguous blocks, which speeds up their subsequent reading.

INTRODUCTION

Currently, the most common are personal computers (PCs) based on Pentium processor. Most of these PCs run the operating system (OS) Windows 95 or Windows 98 (Windows 9x or simply Windows). Windows is the de facto standard for 32-bit personal computers. To date, several versions of the system have already been developed.

An operating system (OS) is a set of programs that provide control of computer hardware, planning the efficient use of its resources and solving problems based on user tasks. The OS is loaded into the computer when it is turned on.

Distinctive features modern operating systems, including Windows 9x, are:

Developed user interface, that is, means and methods of interaction with the user;

Multitasking – the ability to ensure the execution of several programs “simultaneously”;

Using all the capabilities provided by modern microprocessors;

Work stability and security.

Windows 9x is the successor and result of the merger of the two Windows systems 3.1x and MS-DOS. The developers had to make a number of compromises to ensure its compatibility with these systems:

Windows 9x starts functioning in real mode, and only then goes into protected mode;

Windows 9x is based on an updated MS-DOS;

Windows 9x has a sufficient number of 16-bit components (modules and device drivers).

Windows 9x is based on an object-oriented approach. Objects include documents, applications, folders, files, shortcuts, drives, etc. Opening an object– one of the main concepts in the system. The actions performed depend on the type of object:

- opening a document is to launch the appropriate application and loading a document into this application to allow it to be viewed, edited and printed. Instead of opening and loading a document, we can talk about opening and loading a file with a document, since all documents are stored in files;

- opening the application- putting it into operation;

- opening a folder consists of displaying its contents on the screen, which allows you to carry out any actions with the objects located in it;

- opening the input/output device allows you to get into the environment of the dispatcher who provides control of this device;

- opening a shortcut in many cases it is tantamount to opening the object for which it was created.

When processing a document, you can use both a procedural and an object-oriented approach. In the first case, you need to know which application should process the document. In another case, double-clicking a document or a shortcut created for it launches the application associated with it. If Windows "doesn't know" which application should handle this document, will offer to associate the document with a specific application.


FILE SYSTEM COMPONENTS

Work on a PC occurs with various types of data. Data means everything that is subject to storage (programs in source or machine code, data for its operation, any text documents and numerical data, coded tabular, graphical and other information).

File is a named set of homogeneous information on external media(for example, on a magnetic disk).

IN file name(Windows 9x) Almost all printable characters can be used, but there are a number of restrictions:

There cannot be spaces at the beginning or end of the file name (they can be specified, but they will be ignored);

The file name cannot begin or end with a dot;

The following characters cannot be used in the file name: /, \, :, ?, '',<, >, |, since they are reserved for other purposes;

The file name length should not exceed (in general) 255 characters.

Such names are called long. For example, Laboratory work No. 1 in the operating systems discipline.

For each Windows file 9x automatically generates a short a name that is formed based on the requirements of the MS-DOS operating system and is used to ensure compatibility of operating systems. It contains no more than 8 characters. In addition to the characters prohibited in long names, it is not allowed to use the symbols;, +, [, ], =, “dot”, “comma”, “space”. A short name begins like a long name, followed by the ~ symbol and a serial number (no more than 8 characters in total). In this case, prohibited characters are omitted, lowercase letters are recoded into uppercase ones. For example, PRIMER~1 can match a long filename beginning with the letters Primer. If there is another such file, then it short name will be PRIMER~2.

The names reserved for I/O devices are prohibited: PRN (printer), CON (console, i.e. keyboard and monitor), NUL (dummy device), LPT1–LPT3 (first–third parallel port), COM1–COM3 ( first – third serial port). Latin characters A:, B:, C:, D:, etc. are called external storage devices.

If there is at least one dot in the file name, then it is considered to have an extension, in accordance with the nature of the stored information. File name extension is the sequence of characters located after the last period specified in the name. The dot is treated as a name and extension separator. The extension is specified either by the user himself or by the program that generates the file. It is better to use standard 1-3 character extensions, as the file type becomes clear, for example:

BAT for command files;

DOC for files containing various documents in Microsoft Word editor format;

PAS for programs written in PASCAL language; -

PCX for files with illustrations in the raster graphics editor Publishers Paintbrush format;

VAK for files with previous version document (backup files);

EXE for files, with a ready-to-execute program

COM for files, with a program ready to be executed only in the MS-DOS environment.

Currently, for programs that are ready to run under the control of an operating system, the term is used application(application), for example, Windows - application

Example file: COMMAND.COM, COMMAND - file name, COM - extension.

In addition to the long and short names, a number of properties are associated with each file. To the number file properties relate:

File attributes;

Date and time of its creation;

Date and time of file modification;

Date of last access to the file (read or write);

Length, or file size (in bytes).

File attributes determine how it can be used and access rights to it. In Windows 9x, attributes play an informational role rather than a protective one, as in the MS-DOS environment. A file can be assigned any combination of the following attributes:

Read-Only [R] (Read Only) - sets the file write protection, the file cannot be deleted, moved or modified without special measures;

Archive [A] (Archive) - sets the archive status for the file, is set automatically when creating or modifying the file, can be removed by archiving or backup tools;

Hidden [H] (Hidden) – hidden files, unless special measures are taken, are not shown in folders.

System [S] (System) – an attribute that is supplied to system files.

With each file in Windows environment 9x is associated with an icon that corresponds to the file type. Pictogram is a small illustration that helps you quickly identify the object with which it is associated.

Often, a filename pattern is used to designate multiple files at once or to shorten file names. Template name is the name in which are used symbols - substitutes"*" And "?". The position where the "?" sign appears. , can contain any character. "*" means that the position in which "*" appears and all subsequent ones can be occupied by any symbols.

*.TXT - all files of TXT type;

A?.* - all files whose names begin with the letter A and consist of one or two letters.

1.2. Folders (directories)

As tasks grow, the number of files on the disk increases greatly and, even with skillfully chosen file names, it becomes difficult to keep track of the order on the disk and navigate through the files. A group of files on one medium, combined according to some criterion, can be stored in folder(folders). MS-DOS used the concept catalog or directories(directory). The analogy between folders and directories is not complete. Each directory can be considered a folder, but not every folder corresponds to a directory on the disk, and if it does, it may be located in a completely different place in the file structure. If a file name is stored in a folder (directory), then the file is said to be located in that directory. Each folder in Windows 9x has an icon and a name just like a file (but usually without an extension).

(Any) folder can be registered in another folder. Therefore, the file structure on disks is hierarchical multi-level or tree-like, at the root of which is main folder, or root directory(ROOT DIRECTORY) There is one such folder on each disk, which is indicated by the "\" symbol. The root directory is created when the disk is formatted and cannot be renamed or deleted. It should be noted that it is not customary to create folders on floppy magnetic disks.

If one folder is directly contained within another, then the first is called a child (subdirectory), and the second is called a parent (superdirectory) in relation to the first folder. MS-DOS uses the ".." character to indicate the parent directory.

MS-DOS supports the concept current drive And current catalogs. Initially, the current drive is the drive from which the system was booted, and accordingly the directory. The catalog with which currently the user running is called the current one. The current drive is determined in the same way. The current directory of the current drive is called workers. Windows also supports this concept, but in a slightly different way. For example, changing the working folder in applications occurs implicitly - when opening and saving documents.

An example of a fragment of a file structure on a disk is shown in Fig. 1.


Rice. 1

In Figure 1, the Documents directory is registered in the My folder directory, so Documents is said to be a subdirectory of My folder, and My folder is a superdirectory, or parent directory, of Documents.

Each folder (but not the main one), in the same way as a file, has a number of properties associated with it. Folders have the Directory (D) attribute set, which distinguishes it from a file, and is also associated with the date and time of creation.

If there is a branched structure of files on the disk, it is not enough to specify only its name to find a file (if you do not use high-level Windows tools). You must specify the route (path) to the file. Route is a sequence of directory names separated by the "\" character that specifies a route from the root (full route) or current directory of the disk to the one in which the desired file is located. Thus, full file name, or file specification has the following form:

[drive:][full_route\]name.type.

Square quotes denote optional parameters.

If the full name uses characters that are not allowed in short names (in an MS-DOS environment), the specification must be enclosed in quotation marks.

An example of a full file name: A:\PROGRAM\PASCAL\LAB.PAS.

For example, the DEMO.EXE file located in the PROGRAM subdirectory can be accessed:

DEMO.EXE, if the current directory is PROGRAM;

PROGRAM\DEMO.EXE, if the current directory is the root directory;

-..\demo.exe if the current directory is PASCAL.

1.3. Shortcuts

Windows tools 9x provides the creation of another file system component on disks - shortcuts. Label(shortcut) is a file containing a pointer (link) to some object in the resource tree - another file, folder or peripheral device. ( File structures all available disks, as well as some input/output devices are combined into resource tree.) One object can correspond to several shortcuts located in different folders. When you delete a shortcut, only the reference to the object is destroyed, which does not change in any way. Double-clicking a document's shortcut will implicitly launch the application that is associated with that document, and load the document into it for processing. Most often, shortcuts are placed on the desktop to facilitate access to constantly used objects. The shortcut is named according to the same rules as the file, but it is assigned the standard extension LNK (from LiNK - connection). The icon of the shortcut matches the icon of the object for which the shortcut was created, but has a curved arrow in the lower left corner.

If the shortcut is created for an MS-DOS application or batch file, then instead of a shortcut a file with the PIF extension is generated. This file in the Windows 95 environment can be considered as a special kind of shortcut that refers to executable file for MS-DOS environment.

1.4. Desktop

After loading the Windows 9x system, the monitor screen shows Desktop(Desktop), (supposedly) the largest folder. The desktop itself is a system object, but unlike objects located on it, it cannot be moved or copied to any of them. Any objects from the resource tree can be placed on the desktop; usually it contains only standard (system) folders and shortcuts for those objects that are accessed most often.

Standard (system) folder is a folder created and maintained by Windows itself. Here are some of the standard folders located on the desktop:

The My computer folder is an image of the computer and allows you to access its resources. Having gained access to an object, you can perform the required operations on it or change its properties;

Folder Recycle Bin. Deleted files and shortcuts go into this folder so that they can be restored if necessary. The size of the basket is adjustable.

These two folders are required, the rest are not. Features of standard folders are (in most) cases the impossibility of deleting them, renaming them, having special properties, the presence of specific commands in context menus. From point of view Windows working table is also a standard (system) folder.

Control questions:

1. What is a file, file name and extension, template?

2. What files are called executable?

3. What is a folder (directory), subdirectory, root and parent directory?

4. Which folders are standard?

5. Define the specification, or the full file name.

6. What is a shortcut?


MS-DOS COMMANDS

Commands are run from the command line after receiving an invitation to work or from a batch file. The prompt is issued when the OS is ready for use.

MS-DOS command format:

command [options] .

Parameters from the command are separated by spaces. If the user does not include any parameters or switches in the commands, the system provides their default values. Key /? Issues help on a command. You can interrupt the execution of a command or program by pressing keys ; pause the display of information on the screen - , continue by pressing any key.

There are two types of MS-DOS commands: built-in (internal) and loadable (external). Built-in commands are the simplest, most frequently used, and are an integral part of command processorсommand.com and are not displayed in the catalog. (For example, DIR, COPY, DEL and others.) To downloadable commands include other commands that are permanently stored in files on disk (for example, FORMAT). Before you run these commands, you must make sure they exist on disk. Let's look at some MS-DOS commands.

3.1 To change the current drive, type the name of the drive that should become the current drive, then the symbol ":".

For example,

The command moves from drive A: to drive C:.

3.2 Changing the current directory

CD (CHDIR) [drive:] path

For example,

CD PROGRAM - transition to the PROGRAM subdirectory;

CD.. - goes to the parent directory.

3.3 Outputting a file to the screen.

TYPE [drive:][route\]name.type.

For example,

TYPE \PROGRAM\PASCAL\lab.txt ;

TYPE AUTOEXEC.BAT .

2.4 Deleting a file or group of files

DEL [drive:][route\]name.type.

This command allows the use of a wildcard.

For example,

DEL*.* - deletes all files in the current directory.

2.5 Browse directory

DIR [drive:][route\][name.type] .

For each file, the command reports its name, type, file size in bytes, creation date, and time the file was created or last updated. At the end, the amount of free space is reported. The ""/P "" key stops entering the contents of the directory as the screen fills; to continue entering, press any key. When using the "/W" key, only file names (and extensions) are displayed on the screen, 5 per line.

2.6 Creating a subdirectory

MD (MKDIR) [drive:] path

2.7 Deleting a subdirectory

RD (RMDIR) [drive:] path

Any subdirectory can be deleted with this command, but it must not contain any files or other subdirectories (to prevent file loss due to accidental erasure). Naturally, the current subdirectory and the main directory cannot be destroyed.

2.8 Renaming files

REN[drive:][route\]old_name new_name.

This command allows you to change the name of the corresponding file without changing its contents. The command allows the use of a template.

2.9 Cleaning the screen

2.10 Displaying the operating system version

When you enter this command, the operating system version number appears on the screen, which depends on the year the version was created. Knowing the version is necessary, since tools are being expanded year by year and commands and programs written for later versions will not work at all or will be executed differently.

2.11 Setting the current time

TIME [hh:mm:cc:dd]

This command sets the current time when loading MS-DOS or at any other time while working on the machine. When you run a command without parameters, the current time is displayed and a new one is requested by pressing the key , we can agree with the current time.

2.12 Setting the current date

DATE [mm:dd:yy]

The command sets the current date in the same way as the TIME command for setting the current time.

2.13 Viewing the subdirectory tree

This command displays a logical list of all subdirectories on the active disk. By adding the F key, you can also get a list of files contained in these subdirectories.

2.14 Copying separate files

The COPY command allows you to copy files from disk to disk, exchange data between peripheral devices, and merge data during the copy process.

COPY [drive:][route\]isf[drive:][route\][inf] ,

where isf is the name of the old file with the extension, inf is the name of the new file with the extension. The /V key allows you to make copies while checking the correctness of the copy. This command allows the use of a wildcard.

When using the COPY command to exchange information between peripheral devices, instead of file names, substitute special names CON, PRN, NIL, etc. into the command, which have the following meanings:

CON - console: keyboard for data entry, video display for displaying results and controlling dialogue;

PRN is the primary printer associated with your system;

NUL - pseudo-device (non-existent) for testing programs.

The COPY command allows you to combine multiple files into one with a "+" sign. With such a union (concatenation) source files do not change, and the current time and date will be written to the new file.

1) COPY PASCAL\*.PAS B: ,

All files with the PAS type are copied from the PASCAL subdirectory to drive B:

2) COPY FILE.EXT PRN ,

Printing the FILE.EXT file.

3) COPY CON FILE.EXT ,

entering data from the keyboard into the file FILE.EXT, with the end of the file generated by a key combination (file creation in MS-DOS).

4) COPY FILE1.EXT+FILE2.EXT+FILE3.EXT BOOK.EXT ,

combining several files into one BOOK.EXT.

2.15 Write protection of files

ATTRIB [+R ¦ -R] [+A ¦-A] [ drive:][route\]filename.

R - sets file write protection;

R - cancels file write protection;

A - sets the file to archive status;

A - cancels the archive status of the file;

ATTRIB +R FILE.EXT - information cannot be written to this file;

ATTRIB FILE.EXT - a request is made about the ability to write data to FILE.EXT. Operating system response:

R_A:\FILE.EXT , i.e. The file is not writable.

2.16. Data forwarding:

> - redirect output data. Data that is always displayed on the screen is redirected to a peripheral device or disk file. In the latter case, the file is created if necessary. If the file exists, then the old data is replaced with new ones.

TYPE FILE.TXT > PRN

ECHO Group meeting tomorrow > PRN

>> - the output is also redirected, but if the file already exists, the data is appended to the old data.

< - переадресовать входные данные. Данные будут приниматься не с клавиатуры, а с peripheral device or from a disk file.

PROGRAM< FILE.TXT

Note: The program whose execution we want to redirect must use standard I/O functions.

2.17. Organization of conveyors.

You can chain commands or programs so that the screen output of the first one is used as keyboard input for the next one A1|A2|A3.

ECHO Y | DEL *.* >NUL - will automatically respond Y (Yes) to the "Are you sure..." prompt when deleting all directory items.

Occurs along (conveyor) | transferring data from one program to another. Much more effective use | (pipeline) with filter and forwarding commands.

2.18.Filters FIND, MORE, SORT.

a) Search for specified data in disk file(phone number, address, any phrase):

FIND “phrase” [path\] file name,

where /C is the detection counter, i.e. how many times a phrase is detected, but the lines themselves are not displayed;

/N – the line number is also displayed (except for the line itself);

/V – displays all lines that do not contain this phrase.

FIND “group” FILE.TXT – displays a line from the file containing the word “group”.

DIR | FIND /V “COM” – displays all files except files with the COM extension.

FIND “car” AB.DAT, B.DAT, C.DAT – car expenses.

b) Page-by-page display

MORE< FILE.TXT

TYPE FILE.EXT | MORE

c) Sorting data.

SORT (default sort by 1 character alphabetically in ascending order),

where /R - sorting in descending order;

/+n – starting from column n, the row will be sorted.

entering information from the keyboard, Ù Z – sign of the end of the entered information.

It is advisable to write this to a file, i.e. SORT< CON >FILE.TXT.

DIR | SORT – directory elements are sorted by file (directory) names.

DIR | SORT /+10 > FILE.EXT -

the list of files will be ordered by extension (WINDOWS 9X).

©2015-2019 site
All rights belong to their authors. This site does not claim authorship, but provides free use.
Page creation date: 2016-08-20

Data structures

File systems

· General. In computer science theory, the following three main types of data structures are defined: linear, tabular, hierarchical. Example book: sequence of sheets - linear structure. Parts, sections, chapters, paragraphs - hierarchy. Table of contents – table – connects – hierarchical with linear. Structured data has a new attribute - Address.

· Linear structures (lists, vectors). Regular lists. The address of each element is uniquely determined by its number. If all elements of the list have equal length– data vector.

· Tabular structures (tables, matrices). The difference between a table and a list - each element - is determined by an address, consisting of not one, but several parameters. The most common example is a matrix - address - two parameters - row number and column number. Multidimensional tables.

· Hierarchical structures. Used to present irregular data. The address is determined by the route - from the top of the tree. File system - computer. (The route can exceed – the amount of data, dichotomy – there are always two branches – left and right).

· Ordering data structures. The main way is sorting. ! When adding a new element to an ordered structure, it is possible to change the address of existing ones. For hierarchical structures – indexing– each element has a unique number – which is then used in sorting and searching.

A historic first step in data storage and management was using file management systems.

A file is a named area of ​​external memory that can be written to and read from. Three parameters:

A sequence of an arbitrary number of bytes,

A unique proper name (actually an address).

Data of one type - file type.

The rules for naming files, how the data stored in a file is accessed, and the structure of that data depend on the particular file management system and possibly on the file type.

The first, in the modern sense, developed file system was developed by IBM for its 360 series (1965-1966). But in current systems it is practically not used. Used list data structures (EC-volume, section, file).

Most of you are familiar with the file systems of modern operating systems. This is primarily MS DOS, Windows, and some with the construction of a file system for various options UNIX.

· File structure. A file represents a collection of data blocks located on external media. To exchange with a magnetic disk at the hardware level, you need to specify the cylinder number, surface number, block number on the corresponding track and the number of bytes that need to be written or read from the beginning of this block. Therefore, in all file systems, it is explicitly or implicitly allocated some basic level, which provides work with files representing a set of directly addressable blocks in the address space.



· Naming files. All modern file systems support multi-level file naming by maintaining in external memory additional files with a special structure - directories. Each directory contains the names of the directories and/or files contained in that directory. Thus, the full filename consists of a list of directory names plus the name of the file in the directory, directly containing this file. The difference between the way files are named on different file systems is where the chain of names begins. (Unix, DOS-Windows)

· File protection. File management systems must provide authorization for access to files. In general, the approach is that in relation to each registered user given computing system for each existing file actions that are allowed or prohibited are indicated to this user. There have been attempts to implement this approach in full. But this caused too much overhead both in storing redundant information and in using this information to control access eligibility. Therefore, most modern file management systems use the file protection approach first implemented in UNIX (1974). In this system, each registered user is associated with a pair of integer identifiers: the identifier of the group to which this user belongs, and his own identifier in the group. Accordingly, for each file, the full identifier of the user who created this file is stored, and it is noted what actions he himself can perform with the file, what actions with the file are available to other users of the same group, and what users of other groups can do with the file. This information is very compact, requires few steps during verification, and this method of access control is satisfactory in most cases.

· Multi-user access mode. If the operating system supports multi-user mode, it is quite possible for two or more users to simultaneously try to work with the same file. If all these users are only going to read the file, nothing bad will happen. But if at least one of them changes the file, mutual synchronization is required for this group to work correctly. Historically, file systems have taken the following approach. In the operation of opening a file (the first and mandatory operation with which a session of working with a file should begin), among other parameters, the operating mode (reading or changing) was indicated. + there are special procedures for synchronizing user actions. Not allowed by records!

Sooner or later, a novice computer user is faced with such a concept as a file system (FS). As a rule, the first acquaintance with this term occurs when formatting a storage medium: logical drives and connected media (flash drives, memory cards, external hard disk).

Before formatting, the Windows operating system prompts you to select the type of file system on the media, cluster size, and formatting method (quick or full). Let's figure out what a file system is and why it is needed?

All information is written to the media in the form, which must be located in a certain order, otherwise the operating system and programs will not be able to operate with the data. This order is organized by the file system using certain algorithms and rules for placing files on the media.

When a program needs a file stored on disk, it does not need to know how or where it is stored. All that is required of the program is to know the file name, its size and attributes in order to transfer this data to the file system, which will provide access to the desired file. The same thing happens when writing data to a medium: the program transfers information about the file (name, size, attributes) to the file system, which saves it according to its own specific rules.

To better understand, imagine a librarian giving a book to a client based on its title. Or in reverse order: the client returns the book he read to the librarian, who places it back into storage. The client does not need to know where and how the book is stored; this is the responsibility of the establishment's employee. The librarian knows the rules of library cataloging and, according to these rules, searches for the publication or places it back, i.e. performs its official functions. IN in this example a library is a storage medium, a librarian is a file system, a client is a program.

Basic File System Functions

The main functions of the file system are:

  • placement and organization on a data carrier in the form of files;
  • determining the maximum supported amount of data on the storage medium;
  • creating, reading and deleting files;
  • assigning and changing file attributes (size, creation and modification time, file owner and creator, read-only, hidden file, temporary file, archived, executable, maximum file name length, etc.);
  • determining the file structure;
  • directory organization for logical organization of files;
  • file protection in case of system failure;
  • protecting files from unauthorized access and changing their contents.

Information recorded on a hard drive or any other medium is placed there on the basis of a cluster organization. A cluster is a kind of cell of a certain size into which the entire file or part of it is placed.

If the file is cluster size, then it only occupies one cluster. If the file size exceeds the cell size, then it is placed in several cluster cells. Moreover, free clusters may not be located next to each other, but may be scattered over the physical surface of the disk. This system allows you to make the most efficient use of space when storing files. The task of the file system is to distribute the file when writing into free clusters in an optimal way, and also to assemble it when reading and give it to the program or operating system.

Types of file systems

During the evolution of computers, storage media, and operating systems, a large number of file systems have come and gone. In the process of such evolutionary selection, today for working with hard drives and external storage devices (flash drives, memory cards, external hard drives, CDs) are mainly used the following types FS:

  1. FAT32
  2. ISO9660

The last two systems are designed to work with CDs. Ext3 and Ext4 file systems work with Linux-based operating systems. NFS Plus is a file system for OS X operating systems used on Apple computers.

The most widely used file systems are NTFS and FAT32, and this is not surprising, because... they are designed for Windows operating systems, which run the vast majority of computers in the world.

Now FAT32 is being actively replaced by the more advanced NTFS system due to its greater reliability in data safety and protection. In addition, the latest versions of Windows OS simply will not allow themselves to be installed if hard section The drive will be formatted in FAT32. The installer will ask you to format the partition to NTFS.

The NTFS file system supports disks with a capacity of hundreds of terabytes and a single file size of up to 16 terabytes.

The FAT32 file system supports disks up to 8 terabytes and a single file size up to 4GB. Most often, this FS is used on flash drives and memory cards. External drives are formatted in FAT32 at the factory.

However, the 4GB file size limitation is already a big disadvantage today, because... Due to the distribution of high-quality video, the file size of the movie will exceed this limit and it will not be possible to record it on the media.

Share.