What Is a File System?
A file system is a method and data structure used by the operating system to specify files on a storage device (commonly disks, and NAND Flash-based solid-state drives) or partitions; that is, a method of organizing files on a storage device. The software organization in the operating system responsible for managing and storing file information is called a file management system, or file system for short. The file system consists of three parts: the interface of the file system, the software collection for manipulating and managing objects, objects and attributes. From a system perspective, a file system is a system that organizes and allocates space on file storage devices, is responsible for file storage, and protects and retrieves stored files. Specifically, it is responsible for creating files for users, storing, reading, modifying, and dumping files, controlling access to files, and revoking files when users no longer use them.
- main.cpp
- In a computer, a file system is a system of logical storage and recovery of named files and placed files. DOS, Windows, OS / 2, Macintosh, and UNIX-based operating systems all have file systems in which files are placed somewhere in a hierarchical (tree-like) structure. Files are placed in directories (folders in Windows) or subdirectories, in the desired location in the tree structure.
- The file system specifies rules for naming files. These rules include the maximum number of characters in a file name, which characters can be used, and how long the file name suffix can be on some systems. The file system also includes a format for finding a specified path to a file through a directory structure. [1]
- The following is the file system code. According to this code, we can better understand the working process of the file system.
#include "blockinodesuperblock.h" // ----------------------- intmain () { control.open ("control.txt", ios :: in | ios :: out | ios :: nocreate); inti; control >> i; control.close (); if (i! = 0) // Initialize if not 0 { initial (); } control.open ("control.txt", ios :: in | ios :: out | ios :: nocreate); control.seekp (0); control << 0; // The default is to continue on the last basis without initializing control.close (); strcpy (curname, "root"); // The current directory file name is root road [0] = 0; // The current directory path (stores the node number from the root directory to here) num = 1; // The last digit road [num-1] is the node number cout of the current directory file c < while (! login ()) // cout << "wrong !!! \ n"; cout << "loginsuccess" << endl; cout << "****** Welcome" << auser << "******"; readsuper (); getcommand (); // Command parsing function writesuper (); return0; }
- blockinodesuperblock.h
intialloc () // apply for an i node and return the node number, otherwise return -1 { if (superblock.fiptr> 0) { inttemp = superblock.fistack [80-superblock.fiptr]; // Currently available superblock.fistack [80-superblock.fiptr] =-1; superblock.fiptr--; returntemp; } return-1; } // ---------------------- voidifree (intindex) // Specify a node number, recycle an i node { disk.open ("disk.txt", ios :: in | ios :: out | ios :: nocreate); // Empty the node disk.seekp (514 + 64 * index + 2 * (index / 8)); disk << setw (64) << ''; disk.close (); for (inti = 80-superblock.fiptr; i <80; i ++) // Find the appropriate position of the node number and insert a free node number stack if (superblock.fistack <index) // forward one bit less than it { superblock.fistack [i-1] = superblock.fistack; } else // before the first node number greater than it { superblock.fistack [i-1] = index; break; } } superblock.fiptr ++; } // ---------------------- / * Group linking method * / intballoc () // Apply for a block and return the block number, otherwise return -1 { inttemp = superblock.fbstack [10-superblock.fbptr]; if (superblock.fbptr == 1) // It is the bottom of the stack ==>; it is a record disk block { // is the last record disk block number 0 (reserved as the bottom of the stack unsuccessful) if (temp == 0) { return-1; } suprblock.fbstack [10-superblock.fbptr] =-1; superblock.fbptr = 0; // Read the contents of the disk into the stack for (inti = 0; i <10; i ++) { intid, num = 0; disk.open ("disk.txt", ios :: in | ios :: out | ios :: nocreate); // First calculate the number of disk blocks num (up to 10), the last disk block may be less than 10 disk.seekg (514 * temp); for (inti = 0; i <10; i ++) { disk >> id; num ++; if (id == 0) break; } disk.seekg (514 * temp); // disk block contents are read into the stack { disk >> id; superblock.fbstack [j] = id; } superblock.fbptr = num; disk.close (); } disk.open ("disk.txt", ios :: in | ios :: out | ios :: nocreate); // Empty the recovered disk block disk.seekp (514 * temp); disk << setw (512) << ''; disk.close (); // Disc use returntemp; } else // Not recording disc block ==>; disc block uses { superblock.fbstack [10-superblock.fbptr] =-1; superblock.fbptr--; returntemp; } } // ----------------------
- Under Win 9X, the partition supported by FAT16 is up to 2GB. We know that computers store information in areas called "clusters" on their hard drives. The smaller the clusters used, the more efficiently information can be saved. In the case of FAT16, the larger the partition, the larger the cluster and the lower the storage efficiency, which will inevitably cause a waste of storage space. And with
- CDFS is the file system of most discs, and only a small number of discs use other file systems. These file systems can only be read on CD-R or CD-RW.
- (Full name Extended File Allocation Table File System, extended FAT, that is, extended
- A RAW file system is a file system that is generated by an unprocessed or unformatted disk. Generally speaking, there are several types that may cause a normal file system to become a RAW file system:
- No formatting.
- Cancel operation during formatting.
- The hard disk appears
- Btrfs (usually pronounced Butter FS ) is
- ZFS is derived from
- In 1998, Apple Computer released HFS +, which improved HFS's inefficient location of disk space addresses and added other improvements.
- Characteristics of HFS + file system compared to HFS file system
1. 32-bit record allocation block number HFS and HFS + file system are used to allocate disk volumes in blocks, and a volume is divided into equal-sized allocation blocks. The HFS file system uses 16 bits to record the number of allocation blocks, and can only describe up to 216 allocation blocks. For HFS + file system, 32bit is used to record the number of allocation blocks, and up to 232 allocation blocks can be described. For non-empty data on Mac systems, an integer number of allocation blocks must be occupied, that is, even if a data has only one byte, an allocation block is also required. The HFS + file system increases the number of allocation blocks per volume, which can make the unit space of allocation blocks smaller, thereby reducing the waste of storage space.
Directory tree node size increased to 4KB
The directory tree node size of the HFS file system is 512 bytes. Since the HFS + file system directory tree index node needs to store two key values of additional pointers and node descriptors, the directory tree node size of the HFS + file system is increased to 4KB.
3. The single file size has been increased. The single file size limit of the HFS file system is 2 ^ 31bit, while the single file size of the HFS + file system can reach 2 ^ 63bit.
4. Support for long file names The HFS file system supports file names up to 31 characters in length, while HFS + file system uses Unicode encoding for file names up to 255 characters.
- ReiserFS is a file system format. The author is Hans Reiser and his team Namesys. On July 23, 1997, he published the ReiserFS file system on the Internet.
- JFS (JOURNAL FILE SYSTEM), a byte-level journaling file system, borrowed from
- VMware Virtual Machine File System (VMFS) is a high-performance cluster file system that enables [6]
- XFS is a file system developed by Silicon Graphics, Inc. in the early 1990s. It is still used today as a SGI IRIX-based product (from
- UFS file system: The traditional UNIX file system based on the BSD high-speed file system is the default file system of Solaris. UFS logging is enabled by default. In earlier Solaris releases, UFS logging was only enabled manually. Solaris 10 is running 64-bit Solaris
- VeritasFileSystem (VxFS) is the first commercial journaling file system. With logging, metadata changes are first written to the log and then to disk. Because changes do not need to be written in multiple places, and metadata is written asynchronously, throughput is faster. VxFS is also an intent-based logging file system based on extents. VxFS is designed for operating environments that require high performance and high availability and can handle large amounts of data.
- ReFS (Resilient File System) is a new file system introduced in Windows 8.1 and Server® 2012. ReFS is mostly compatible with NTFS. Its main purpose is to maintain high stability. It can automatically verify whether the data is damaged and try to recover the data.
- The key features of ReFS are:
- Metadata integrity with checksum
- Provides an integrity flow with optional user data integrity.
- Reliable disk updates (also known as copy-on-write) by distributing the transaction model on write
- Supports very large volumes, files and directories
- Storage pools and virtualization make file systems buildable and easy to manage
- Improve performance through data striping (bandwidth manageability) and fault tolerance through backup
- Prevent potential disk errors with ScanDisk
- Damage recovery with Data Salvage to maximize volume availability in any situation
- · Share storage pools across computers to provide additional fault tolerance and load balancing
- The full name of PFS is Playstation File System. As the name suggests, it is a file system developed by Sony for its PS2 hard drive for home use. Only PFS Explorer and Winhiip can read it on the computer. The rest of the information is unknown.