• What structure does the file system have? File system. What is this

    File systems. Types file systems. File operations. Catalogs. Operations with directories.

    File is a named area of ​​external memory that can be written to and read from.

    Main purposes of using the file.

      Long-term and reliable storage of information . Durability is achieved through the use of power-independent storage devices, and high reliability is determined by file access protection and overall organization program code An OS in which hardware failures most often do not destroy the information stored in files.

      Sharing information . The files provide natural and easy way separation of information between applications and users due to the presence of a human-readable symbolic name and the constancy of the stored information 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 that includes:

      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;

      complex of system software, implementing various operations on files, such as creating, destroying, reading, writing, naming and searching files.

    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 following file systems are widely known:

      file system operating system MS - DOS , which is based on file allocation table - FAT ( File Allocation Table ).

    The table contains information about the location of all files (each file is divided into clusters Clusters of the same file are not necessarily located next to each other, depending on the availability of disk space). The MS-DOS file system has significant limitations and disadvantages, for example, under Name The file is allocated 12 bytes; working with a large hard drive leads to significant file fragmentation;

    The main functions in such a FS are aimed at solving the following tasks:

      file naming;

      application programming interface;

      display logical model file system on the physical organization of data storage;

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

      OS /2 , called HPFS ( High - Performance File System - fast file system).

    Provides the ability to have a file name of up to 254 characters. Files written to disk have minimal fragmentation. Can work with files written in MS DOS;

    A new task is added to the tasks listed above 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.

      operating system file system Windows 95

    It has a level structure, which allows you to support several file systems simultaneously. The old MS-DOS file system is directly supported, but file systems not developed by the company Microsoft, are supported using special modules. It is possible to use long (up to 254 characters) file names.

      operating system file systems Unix

    They provide a unified way to access I/O file systems.

    File permissions practically determine access rights to the system (the owner of the file is the user who created it).

    File types

    File systems support several functionalities various types files, which typically 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, program source codes, etc. Text files can be read on the screen and printed on a printer. Binary files do not use character codes, they often have a complex internal structure, such as executable program code or 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 file that contains system background information about a set of files grouped by users according to some informal criterion (for example, files containing documents of the same agreement, 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.

    Hierarchical file system structure

    Users access files by symbolic names. However, human memory limits the number of object names that a user can refer to 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 making the directory more low level may be included in a higher-level directory (Fig. 7.3).

    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 (Fig. 7.3, b), and a network - if the file can be included in several directories at once (Fig. 7.3, 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. Catalog itself top level called root directory, or root ( 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 his files is localized in his 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 (Fig. 7.3, a).

    File names

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

    A simple, or short, symbolic name identifies a file within a single 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, on the NTFS and FAT32 file systems included with the Windows NT operating system, a file name can contain up to 255 characters.

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

    The 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 one in which simple names separated from each other by the separator adopted 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 Fig. 7.3, 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 between a file and its full name there is a one-to-one correspondence “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.

    A file can also be identified by a relative name. The relative file name is determined 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 such a unique file name is an inode number on a UNIX system.

    File attributes

    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, etc.);

      file owner;

      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 size file;

      read-only sign;

      “hidden file” sign;

      sign “system file”;

      sign “archive file”;

      "binary/character" attribute;

      attribute “temporary” (remove after process completion);

      blocking sign;

      file record length;

      pointer to the key field in the record;

      key length.

    The set of file attributes is determined by the specifics of the file system: different types of file systems may use different sets of attributes 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 cannot change the creation date or current size of the file.

    File attribute values ​​can be directly contained in directories, as is done in file-based MS-DOS system(Fig. 7.6, a). 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.

    Rice. 7.6. 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 record 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 (Fig. 7.6, 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.

    File Operations

    Most modern operating systems treat a file as an unstructured sequence of variable-length bytes. Standard POSIX The following operations are defined on the file:

      int open ( char * fname , int flags , mode _ t mode )

    This operation ``opens'' a file, establishing a connection between the program and the file. In this case the program receives file descriptor- an integer identifying this connection. In fact, this is an index in the system table of open files for a given task. All other operations use this index to reference the file.

    The char * fname parameter specifies the file name. int flags is a bit mask that determines the file's opening mode. The file can be opened read-only, write-only, or read-write; in addition, you can open an existing file, or you can try to create new file zero length. The optional third parameter mode is used only when creating a file and specifies the attributes of that file.

      off _ t lseek ( int handle , off _ t offset , int whence )

    This operation moves the read/write pointer in the file. The offset parameter specifies the number of bytes by which to offset the pointer, and the whence parameter specifies where to start the offset from. It is assumed that the offset can be counted from the beginning of the file (SEEK_SET), from its end (SEEK_END), and from current pointer position (SEEK_CUR). The operation returns the pointer position measured from the beginning of the file. Thus, calling lseek(handle, 0, SEEK_CUR) will return the current position of the pointer without moving it.

      int read(int handle, char * where, size_t how_much)

    Read operation from a file. The where pointer specifies the buffer where the read data should be placed; the third parameter specifies how much data to read. The system reads the required number of bytes from the file, starting at the read/write pointer to that file, and moves the pointer to the end of the read sequence. If the file ends early, as much data is read as was left until its end. The operation returns the number of bytes read. If the file was opened for writing only, calling read will return an error.

      int write(int handle, char * what, size_t how_much)

    A write operation to a file. The what pointer specifies the beginning of the data buffer; the third parameter specifies how much data to write. The system writes the required number of bytes to the file, starting at the read/write pointer to that file, replacing the data stored at that location, and moving the pointer to the end of the written block. If the file ends earlier, its length increases. The operation returns the number of bytes written.

    If the file was opened read-only, calling write will return an error.

      int ioctl(int handle, int cmd, ...) ; int fcntl ( int handle , int cmd , ...)

    Additional operations on the file. Initially, it seems that ioctl was intended to be operations on the file itself, and fcntl was intended to be operations on an open file handle, but then historical developments have somewhat mixed up the functions of these system calls. Standard POSIX defines some operations both on the handle, for example duplication (as a result of this operation we get two handles associated with the same file), and on the file itself, for example, the truncate operation - trim the file to a given length. In most versions Unix The truncate operation can also be used to cut data from the middle of a file. When reading data from such a cut area, zeros are read, and this area itself does not take up physical space on the disk.

    An important operation is to block sections of the file.Standard POSIX offers a library function for this purpose, but in systems of the family Unix This function is implemented through the fcntl call.

    Most implementations of the standard POSIX offers its own additional operations. So, in Unix SVR4 With these operations you can set synchronous or delayed recording, etc.

      caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int handle, off_t offset)

    Mapping a section of a file into the virtual address space of the process. The prot parameter specifies access rights to the mapped section: read, write, and execute. The mapping can occur to a specified virtual address, or the system can select the address to map itself.

    Two more operations are performed not on the file, but on its name: these are the operations of renaming and deleting the file. In some systems, for example in systems of the family Unix, a file can have multiple names, and there is only a system call to delete a name. The file is deleted when the last name is deleted.

    It can be seen that the set of operations on a file in this standard is very similar to the set of operations on external device. Both are considered as an unstructured byte stream. To complete the picture, it should be said that the main means of interprocess communication in systems of the family Unix (pipe) is also an unstructured data stream. The idea that most data transfers can be reduced to a byte stream is quite old, but Unix was one of the first systems where this idea was brought to its logical conclusion.

    Approximately the same model of working with files is adopted in C.P./ M, and a set of file system calls MS DOS actually copied from calls Unix v7 . In turn, OS/2 And Windows NT inherited the principles of working with files directly from MS DOS.

    On the contrary, in systems without Unix in a pedigree, a slightly different interpretation of the concept of a file may be used. Most often, a file is treated as a set of records. Typically, the system supports both constant-length and variable-length records. For example, a text file is interpreted as a file with variable length records, and each line of text corresponds to one record. This is the model for working with files in VMS and in OS line OS/360 -MVS from IBM.

    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 data size, 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 external memory, into which data can be written to and from which data can be read. 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.

    First, in modern understanding, an advanced 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 file system construction for various UNIX variants.

    · File structure. A file represents a collection of data blocks located on external media. To exchange with 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 view the approach is that in relation to 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, in most modern systems File Management uses an approach to file protection 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; when checking, you do not need to large number actions, 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, for correct operation this group requires mutual synchronization. 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. + available special procedures synchronization of user actions. Not allowed by records!

    One of the OS components is the file system - the main storage of system and user information. All modern operating systems work with one or more file systems, for example, FAT (File Allocation Table), NTFS (NT File System), HPFS (High Performance File System), NFS (Network File System), AFS (Andrew File System), Internet File System.

    A file system is a part of the operating system whose purpose is to provide the user with user-friendly interface when working with data stored in external memory, and ensure sharing files by multiple users and processes.

    In a broad sense, the concept of "file system" includes:

    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 file management, in particular: creation, destruction, reading, writing, naming, searching and other operations on files.

    The file system is usually used both when loading the OS after turning on the computer, and during operation. The file system performs the following main functions:

    Defines possible ways organizing files and file structure on the media;

    Implements methods for accessing the contents of files and provides tools for working with files and file structure. In this case, access to data can be organized by the file system both by name and by address (number of sector, surface and track of the media);

    Tracks free space on the media.

    When application program accesses a file, it has no idea how the information in a particular file is located, as well as what physical type of media (CD, hard drive or flash memory unit) it is recorded on. All the program knows is the file name, its size and attributes. It receives this data from the file system driver. It is the file system that determines where and how the file will be written to physical media(for example, a hard drive).

    From the operating system's point of view, the entire disk is a set of clusters (memory areas) ranging in size from 512 bytes or larger. File system drivers organize clusters into files and directories (which are actually files containing a list of files in that directory). These same drivers keep track of which clusters are currently in use, which are free, and which are marked as faulty. To clearly understand how data is stored on disks and how the OS provides access to them, it is necessary to understand, at least in general terms, the logical structure of the disk.


    3.1.5 Disk logical structure

    In order for a computer to store, read and write hard information The disk must first be partitioned. Partitions are created on it using appropriate programs - this is called “partitioning the hard drive”. Without this partitioning, it will not be possible to install the operating system on the hard drive (although Windows XP and 2000 can be installed on an unpartitioned disk, they do this partitioning themselves during the installation process).

    Hard drive can be divided into several sections, each of which will be used independently. What is this for? One disk can contain several different operating systems located on different partitions. The internal structure of a partition allocated to any OS is completely determined by that operating system.

    In addition, there are other reasons for partitioning a disk, for example:

    Possibility of using disks with a capacity greater than MS DOS
    32 MB;

    If a disk is damaged, only the information that was on that disk is lost;

    Reorganizing and unloading a small disk is easier and faster than a large one;

    Each user can have their own logical drive.

    The operation of preparing a disk for use is called formatting, or initialization. Everything is available disk space is divided into sides, tracks and sectors, with tracks and sides numbered from zero, and sectors from one. The collection of tracks located on same distance from the axis of the disk or disk package is called a cylinder. Thus, the physical address of the sector is determined by the following coordinates: track number (cylinder - C), disk side number (head - H), sector number - R, i.e. CHR.

    In the very first sector hard drive(C=0, H=0, R=1) contains the master boot record Master Boot Record. This entry does not occupy the entire sector, but only its initial part. The Master Boot Record is a non-system boot loader program.

    At the end of the first hard sector disk contains the disk partition table - Partition Table. This table contains four rows describing a maximum of four partitions. Each row in the table describes one section:

    1) active section or not;

    2) the number of the sector corresponding to the beginning of the section;

    3) the number of the sector corresponding to the end of the section;

    4) partition size in sectors;

    5) operating system code, i.e. what OS does this partition belong to?

    A partition is called active if it contains the operating system boot program. The first byte in the section element is the section activity flag (0 – inactive, 128 (80H) – active). It is used to determine whether the partition is system (bootable) and whether the operating system needs to be loaded from it when the computer starts. Only one section can be active. Small programs, called boot managers, can be located in the first sectors of the disk. They interactively ask the user which partition to boot from and adjust the partition activity flags accordingly. Since the Partition Table has four rows, there can be up to four different operating systems on the disk, therefore, the disk can contain several primary partitions belonging to different operating systems.

    An example of the logical structure of a hard disk consisting of three partitions, two of which belong to DOS and one belongs to UNIX, is shown in Figure 3.2a.

    Each active section has its own boot entry– a program that loads this OS.

    In practice, the disk is most often divided into two partitions. The sizes of partitions, whether they are declared active or not, are set by the user during the process training hard disk to work. This is done using special programs. In DOS this program is called FDISK, in Windows-XX versions it is called Diskadministrator.

    In DOS, the primary partition is Primary Partition, this is the section that contains the operating system loader and the OS itself. Thus, the primary partition is the active partition, used as a logical drive named C:.

    The WINDOWS operating system (namely WINDOWS 2000) has changed the terminology: the active partition is called the system partition, and the boot partition is the logical disk that contains the system WINDOWS files. The boot logical drive may be the same as system partition, but may be on a different partition of the same hard drive or on a different hard drive.

    Advanced section Extended Partition can be divided into several logical drives with names from D: to Z:.

    Figure 3.2b shows the logical structure of a hard drive, which has only two partitions and four logical drives.

    A file system is a way of organizing data storage on storage media. The file system also determines the length of file names, the maximum file and partition size, and file attributes. In this article we will talk about what file systems are.

    Tasks that the file system must solve:

    • file naming.
    • software interface for running user programs.
    • Protecting data from power failures and hardware and software errors.
    • storing file parameters.

    Modern file systems can be divided into several groups, according to their purpose:

    • File systems for random access storage media (for flash drives): FAT32, HPFS, ext2 and many others.
    • File systems for sequential access media (magnetic tape): QIC, etc.
    • File systems for optical disks: ISO9660, HFS, UDF, etc.
    • Virtual file systems: AEFS, etc.
    • Network file systems: NFS, SSHFS, CIFS, GmailFS, etc.
    • File systems designed exclusively for: YAFFS, exFAT, ExtremeFFS.

    Popular file systems:

    FAT- a file system developed by Bill Gates and Mark McDonald in the 70s of the last century. Due to its simplicity, it is still used in flash drives. There are three versions of the FAT file system: FAT12, FAT16 and FAT32. These versions of the FAT file system differ in the bit depth of the records (the number of bits that are allocated for storing the cluster number). That is, the larger the bit depth, the larger the disk space with which the FAT file system can work. So, for FAT32 the maximum disk size is 127 gigabytes.

    NTFS– a new generation file system from Microsoft. This file system is used for all operating systems Microsoft systems Windows NT. NTFS was first released in 1993, along with the Windows NT 3.1 operating system. Compared to FAT, file NTFS system received a large number of improvements. Thus, the limitation on the maximum file and disk size has practically disappeared. In addition, there is support for hard links, encryption and compression.

    ext– a file system designed specifically for operating systems based on Linux kernel. The development was first presented in 1992. Now there are several versions of this file system: ext, ext2, ext3, ext3cow and ext4. File system ext4 on at the moment is the newest and current version ext, this is the version used by most modern Linux distributions.

    Files and file system

    All programs and data are stored in the long-term (external) memory of the computer in the form of files.

    File- this is a certain amount of information (program or data) that has a name and is stored in long-term (external) memory.

    File name. The file name consists of two parts, separated by a dot: the actual file name and the extension that determines its type (program, data, and so on). The actual name of the file is given by the user, and the file type is usually set automatically by the program when it is created (Table 4.2).

    There are different operating systems various formats file names. In the MS-DOS operating system, the file name itself must contain no more than 8 letters of the Latin alphabet, numbers and some special characters, and the extension consists of three Latin letters, for example: proba.txt

    In the operating system Windows name the file can be up to 255 characters long, and you can use the Russian alphabet, for example: Units of information.doc


    File system. On each storage medium (flexible, rigid or laserdisc) a large number of files can be stored. The order in which files are stored on disk is determined by the file system used.

    Each disk is divided into two areas: a file storage area and a directory. The directory contains the name of the file and an indication of where it begins on disk. If we draw an analogy between a disk and a book, the file storage area corresponds to its contents, and the directory corresponds to the table of contents. Moreover, a book consists of pages, and a disk consists of sectors.

    For disks with a small number of files (up to several dozen) can be used single-level file system, when the directory (disk table of contents) is a linear sequence of file names (Table 4.3). Such a catalog can be compared to the table of contents of a children's book, which contains only the titles of individual stories.

    If hundreds and thousands of files are stored on the disk, then for ease of searching, use multi-level hierarchical file system, which has a tree structure. Such a hierarchical system can be compared, for example, with the table of contents of a given textbook, which is a hierarchical system of sections, chapters, paragraphs and points.

    The initial, root directory contains subdirectories of the 1st level, in turn, each of the latter can contain subdirectories of the 2nd level, and so on. It should be noted that files can be stored in directories of all levels.

    For example, the root directory may contain two 1st level subdirectories (Directory_1, Directory_2) and one file (File_1). In turn, in the 1st level directory (Directory_1) there are two subdirectories of the second level (Directory_1.1 and Directory_1.2) and one file (File_1.1) - fig. 4.21.

    File system is a file storage and directory organization system.

    Consider a hierarchical file system on specific example. Each disk has a logical name (A:, B: - floppy disks, C:, D:, E: and so on - hard and laser disks).

    Let the root directory of drive C: have two 1st level directories (GAMES, TEXT), and the GAMES directory have one 2nd level directory (CHESS). At the same time, in the TEXT directory there is a file proba.txt, and in the CHESS directory there is a file chess.exe (Fig. 4.22).

    Path to the file. How to find existing files (chess.exe, proba.txt) in a given hierarchical file system? To do this, you need to specify the path to the file. The path to the file includes the logical name of the disk, written through the "\" separator, and a sequence of names of nested directories, the last of which contains required file. Paths to the above files can be written as follows:

    The path to the file along with the file name is sometimes called full file name.

    Example of a full file name:

    With \GAMES\CHESS\chess.exe

    Presentation of the file system using a graphical interface. The MS-DOS hierarchical file system containing directories and files is presented in the operating system Windows system using a graphical interface in the form of a hierarchical system of folders and documents. A folder in Windows is analogous to an MS-DOS directory

    However, the hierarchical structure of these systems is somewhat different. In the MS-DOS hierarchical file system, the top of the object hierarchy is the root directory of the disk, which can be compared to the trunk of a tree on which branches (subdirectories) grow, and on the branches are leaves (files).

    In Windows, at the top of the folder hierarchy is the folder Desk. The next level is represented by folders My computer, Trash And Network environment(if the computer is connected to local network) - rice. 4.23.

    2. By selecting one of the menu items View (Large Icons, Small Icons, List, Table), you can customize the presentation form of the folder contents.

    Folder Network environment contains the folders of all computers currently connected to the local network.

    Folder Basket temporarily contains everything deleted folders and files. If necessary, removed and stored in Cart folders and documents can be restored.

    3. To permanently delete files, you must enter the [File-Empty Trash] command.

    Operations on files. While working on a computer, the following operations are most often performed on files:

    • copying (a copy of the file is placed in another directory);
    • moving (the file itself is moved to another directory);
    • deletion (the file entry is deleted from the directory);
    • renaming (file name changes).

    The Windows graphical interface allows you to perform operations on files using the mouse using the Drag&Drop method (drag and drop). There are also specialized applications for working with files, the so-called file managers : Norton Commander, Windows Commander, Explorer, etc.

    In some cases it becomes necessary to work with the interface command line. Windows provides a mode for working with the MS-DOS command line interface.

    Command Line Interface

    1. Enter the command [Programs-MS-DOS Session]. The application window will appear MS-DOS session.

    When prompted by the system, you can enter MS-DOS commands from the keyboard, including:

    • commands for working with files (copy, del, rename, etc.);
    • commands for working with directories (dir, mkdir, chdir, etc.);
    • commands for working with disks (format, defrag, etc.).

    2. There are dozens of MS-DOS commands, and each command has its own format and parameters, which are quite difficult to remember. In order to get help information on a command, you must enter the /? key after the command name.

    For example, to get help on format command in response to the system prompt, you must enter: C:\WINDOWS>format/?


    Questions to Consider

    1. Which element is the top of the hierarchy in the MS-DOS file system? IN graphical interface Windows?

    Practical tasks

    4.11. Copy files using the command line interface and file manager.

    4.12. View the capacity of your computer's disks, as well as the amount of used and free space.

    4.13. Familiarize yourself with the format of the dir command. View the root directory of drive C.