Misplaced Pages

ext2

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

ext2 , or second extended file system , is a file system for the Linux kernel . It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed according to the same principles as the Berkeley Fast File System from BSD , it was the first commercial-grade filesystem for Linux.

#2997

50-584: The canonical implementation of ext2 is the "ext2fs" filesystem driver in the Linux kernel. Other implementations (of varying quality and completeness) exist in GNU Hurd , MINIX 3 , some BSD kernels, in MiNT , Haiku and as third-party Microsoft Windows and macOS (via FUSE ) drivers. This driver was deprecated in Linux version 6.9 in favor of the ext4 driver, as the ext4 driver works with ext2 filesystems. ext2

100-427: A block , sometimes called a physical record , is a sequence of bytes or bits , usually containing some whole number of records , having a maximum length; a block size . Data thus structured are said to be blocked . The process of putting data into blocks is called blocking , while deblocking is the process of extracting data from blocks. Blocked data is normally stored in a data buffer , and read or written

150-676: A block device , which is a level of abstraction for the hardware responsible for storing and retrieving specified blocks of data, though the block size in file systems may be a multiple of the physical block size. This leads to space inefficiency due to internal fragmentation , since file lengths are often not integer multiples of block size, and thus the last block of a file may remain partially empty. This will create slack space . Some newer file systems, such as Btrfs and FreeBSD UFS2 , attempt to solve this through techniques called block suballocation and tail merging . Other file systems such as ZFS support variable block sizes. Block storage

200-502: A bug in one module would not crash the entire system. Hurd provides a concept of translators , a framework of modules used to extend a file system functionality. From early on, the Hurd was developed to use GNU Mach as the microkernel. This was a technical decision made by Richard Stallman , who thought it would speed up the work by saving a large part of it. He has admitted that he was wrong about that. Other Unix-like systems working on

250-433: A correct login password. Regarding the file system , a suitable program can be designated as a translator for a single file or a whole directory hierarchy. Every access to the translated file, or files below a hierarchy in the second case, is in fact handled by the program. For example, a file translator may simply redirect read and write operations to another file, like a Unix symbolic link . The effect of Unix mounting

300-417: A doubly indirect block, and pointer 15 points to a triply indirect block. Each directory is a list of directory entries. Each directory entry associates one file name with one inode number, and consists of the inode number, the length of the file name, and the actual text of the file name. To find a file, the directory is searched front-to-back for the associated filename. For reasonable directory sizes, this

350-560: A limited number of write cycles. Since 2009, the Linux kernel supports a journal-less mode of ext4 which provides benefits not found with ext2, such as larger file and volume sizes. The early development of the Linux kernel was made as a cross-development under the MINIX operating system. The MINIX file system was used as Linux's first file system. The Minix file system was mostly free of bugs , but used 16-bit offsets internally and thus had

400-640: A lot of deep problems", but added that "finishing it is not crucial" for the GNU system because a free kernel already existed ( Linux ), and completing Hurd would not address the main remaining problem for a free operating system: device support. The Debian project, among others, have worked on the Hurd project to produce binary distributions of Hurd-based GNU operating systems for IBM PC compatible systems. After years of stagnation, development picked up again in 2015 and 2016, with four releases during these two years, but no more since then. On August 20, 2015, amid

450-453: A maximum size limit of only 64 megabytes , and there was also a filename length limit of 14 characters. Because of these limitations, work began on a replacement native file system for Linux. To ease the addition of new file systems and provide a generic file API , VFS , a virtual file system layer, was added to the Linux kernel. The extended file system ( ext ), was released in April 1992 as

500-535: A pair of mutually recursive acronyms. As both hurd and hird are homophones of the English word herd , the full name GNU Hurd is also a play on the words herd of gnus , reflecting how the kernel works. The logo is called the Hurd boxes and it also reflects on architecture. The logo is a graph where nodes represent the Hurd kernel's servers and directed edges are IPC messages. Richard Stallman founded

550-424: A part of the interface. For instance, the various filesystem servers each implement the filesystem calls. The storage server will work as a wrapping layer, similar to the block layer of Linux. The equivalent of VFS of Linux is achieved by libdiskfs and libpager libraries. Hurd-based GNU distributions include: Block (data storage) In computing (specifically data transmission and data storage ),

SECTION 10

#1732766181003

600-516: A set of protocols and server processes (or daemons , in Unix terminology) that run on the GNU Mach microkernel. The Hurd aims to surpass the Unix kernel in functionality, security, and stability, while remaining largely compatible with it. The GNU Project chose the multiserver microkernel for the operating system, due to perceived advantages over the traditional Unix monolithic kernel architecture,

650-570: A solution for these problems, two new filesystems were developed in January 1993 for Linux kernel 0.99: xiafs and the second extended file system ( ext2 ), which was an overhaul of the extended file system incorporating many ideas from the Berkeley Fast File System . ext2 was also designed with extensibility in mind, with space left in many of its on-disk data structures for use by future versions. Since then, ext2 has been

700-486: A testbed for many of the new extensions to the VFS API. Features such as the withdrawn POSIX draft ACL proposal and the withdrawn extended attribute proposal were generally implemented first on ext2 because it was relatively simple to extend and its internals were well understood. On Linux kernels prior to 2.6.17, restrictions in the block driver mean that ext2 filesystems have a maximum file size of 2 TiB. ext2

750-521: A user to unify multiple directories into one; thus listing the unified directory reveals the contents of all the directories. The Hurd requires a multiboot -compliant boot loader , such as GRUB . According to the Debian documentation, there are 24 servers (18 core servers and 6 file system servers) named as follows: The servers collectively implement the POSIX API , with each server implementing

800-409: A view that had been advocated by some developers in the 1980s. In December 1991 the primary architect of the Hurd described the name as a mutually recursive acronym : It's time [to] explain the meaning of "Hurd". "Hurd" stands for "Hird of Unix-Replacing Daemons". And, then, "Hird" stands for "Hurd of Interfaces Representing Depth". We have here, to my knowledge, the first software to be named by

850-463: A whole block at a time. Blocking reduces the overhead and speeds up the handling of the data stream . For some devices, such as magnetic tape and CKD disk devices , blocking reduces the amount of external storage required for the data. Blocking is almost universally employed when storing data to 9-track magnetic tape , NAND flash memory , and rotating media such as floppy disks , hard disks , and optical discs . Most file systems are based on

900-421: Is achieved by setting up a filesystem translator (using the "settrans" command). Translators can also be used to provide services to the user. For example, the ftpfs translator allows a user to encapsulate remote FTP sites within a directory. Then, standard tools such as ls , cp , and rm can be used to manipulate files on the remote system. Even more powerful translators are ones such as UnionFS , which allows

950-406: Is fine. But for very large directories this is inefficient, and ext3 offers a second way of storing directories ( HTree ) that is more efficient than just a list of filenames. The root directory is always stored in inode number two, so that the file system code can find it at mount time. Subdirectories are implemented by storing the name of the subdirectory in the name field, and the inode number of

1000-431: Is limited by the architecture page size . There are also some userspace programs that cannot handle files larger than 2 GiB . If b is the block size, the maximal file size is limited to min( (( b /4) + ( b /4) + b /4 + 12) × b , (2 − 1) × 512 ) due to the i_block structure (an array of direct/indirect EXT2_N_BLOCKS) and i_blocks (32-bit integer value) representing the number of 1024 byte (1 kilobyte) "blocks" in

1050-472: Is normally abstracted by a file system or database management system (DBMS) for use by applications and end users. The physical or logical volumes accessed via block I/O may be devices internal to a server, directly attached via SCSI or Fibre Channel , or distant devices accessed via a storage area network (SAN) using a protocol such as iSCSI , or AoE . DBMSes often use their own block I/O for improved performance and recoverability as compared to layering

SECTION 20

#1732766181003

1100-427: Is provided for read and write operations. The compression algorithm and cluster size is specified on a per-file basis. Directories can also be marked for compression, in which case every newly created file in the directory will be automatically compressed with the same cluster size and the same algorithm that was specified for the directory. e2compr is not a new file system. It is only a patch to ext2 made to support

1150-425: Is still recommended over journaling file systems on bootable USB flash drives and other solid-state drives . ext2 performs fewer writes than ext3 because there is no journaling. As the major aging factor of a flash chip is the number of erase cycles, and as erase cycles happen frequently on writes, decreasing writes increases the life span of the solid-state device. Another good practice for filesystems on flash devices

1200-421: Is the use of the no atime mount option, for the same reason. Beginning with Linux kernel 6.9, the ext2fs driver was deprecated and is no longer enabled in the default configuration. The central reason was that it did not support dates past 2038 . Users are recommended to upgrade to ext4. The space in ext2 is split up into blocks . These blocks are grouped into block groups, analogous to cylinder groups in

1250-757: The GNU Mach microkernel. It has been under development since 1990 by the GNU Project of the Free Software Foundation , designed as a replacement for the Unix kernel, and released as free software under the GNU General Public License . When the Linux kernel proved to be a viable solution, development of GNU Hurd slowed, at times alternating between stasis and renewed activity and interest. The Hurd's design consists of

1300-669: The GNU Project in September 1983 with an aim to create a free GNU operating system. Initially the components required for kernel development were written: editors , shell , compiler , debugger etc. By 1989, the GPL came into being and the only major component missing was the kernel. Development on the Hurd began in 1990 after an abandoned kernel attempt in 1986, based on the research TRIX operating system developed by Professor Steve Ward and his group at MIT's Laboratory for Computer Science (LCS). According to Thomas Bushnell ,

1350-622: The Google Summer of Code , it was announced that GNU Guix had been ported to GNU Hurd. Unlike most Unix-like kernels, the Hurd uses a server–client architecture , built on a microkernel that is responsible for providing the most basic kernel services – coordinating access to the hardware : the CPU (through process management and scheduling ), RAM (via memory management ), and other various input/output devices (via I/O scheduling ) for sound, graphics, mass storage, etc. In theory,

1400-462: The Mach microkernel include OSF/1 , Lites , and MkLinux . macOS and NeXTSTEP use hybrid kernels based on Mach. From 2004 onward, various efforts were launched to port the Hurd to more modern microkernels. The L4 microkernel was the original choice in 2004, but progress slowed to a halt. Nevertheless, during 2005, Hurd developer Neal Walfield finished the initial memory management framework for

1450-521: The Unix File System . There are typically thousands of blocks on a large file system. Data for any given file is typically contained within a single block group where possible. This is done to minimize the number of disk seeks when reading large amounts of contiguous data. Each block group contains a copy of the superblock and block group descriptor table, and all block groups contain a block bitmap, an inode bitmap, an inode table, and finally

1500-608: The Coyotos Operating System) to aid in and discuss the use of the Coyotos kernel for GNU/Hurd. In further discussion HURD developers realised that Coyotos (as well as other similar kernels) are not suitable for HURD. In 2007, Hurd developers Neal Walfield and Marcus Brinkmann gave a critique of the Hurd architecture, known as "the critique", and a proposal for how a future system may be designed, known as "the position paper". In 2008, Neal Walfield began working on

1550-551: The EXT2_COMPR_FL flag. It does not require user to make a new partition, and will continue to read or write existing ext2 file systems. One can consider it as simply a way for the read and write routines to access files that could have been created by a simple utility similar to gzip or compress. Compressed and uncompressed files coexist nicely on ext2 partitions. The latest e2compr-branch is available for current releases of Linux 2.4, 2.6, and 3.0. The latest patch for Linux 3.0

ext2 - Misplaced Pages Continue

1600-520: The Hurd is still not considered suitable for production environments. Development in general has not met expectations, and there are still a significant number of bugs and missing features. This has resulted in a poorer product than many, including Stallman, had expected. In 2010, after twenty years under development, Stallman said that he was "not very optimistic about the GNU Hurd. It makes some progress, but to be really superior it would require solving

1650-468: The L4/Hurd port, and Marcus Brinkmann ported essential parts of glibc ; namely, getting the process startup code working, allowing programs to run, thus allowing the first user programs (trivial ones such as the hello world program ) in C to run. Since 2005, Brinkmann and Walfield started researching Coyotos as a new kernel for HURD. In 2006, Brinkmann met with Jonathan Shapiro (a primary architect of

1700-461: The Linux kernel documentation for ext2: There are pointers to the first 12 blocks which contain the file's data in the inode. There is a pointer to an indirect block (which contains pointers to the next set of blocks), a pointer to a doubly indirect block and a pointer to a trebly indirect block. Thus, there is a structure in ext2 that has 15 pointers. Pointers 1 to 12 point to direct blocks, pointer 13 points to an indirect block, pointer 14 points to

1750-472: The Mach code under a suitable license. With the release of the Linux kernel in 1991, the primary user of GNU's userland components soon became operating systems based on the Linux kernel ( Linux distributions ), prompting the coining of the term GNU/Linux . Development of the Hurd has proceeded slowly. Despite an optimistic announcement by Stallman in 2002 predicting a release of GNU/Hurd later that year,

1800-460: The Viengoos microkernel as a modern native kernel for HURD. As of 2009 , development on Viengoos is paused due to Walfield lacking time to work on it. In the meantime, others have continued working on the Mach variant of Hurd. A number of traditional Unix concepts are replaced or extended in the Hurd. Under Unix, every running program has an associated user id , which normally corresponds to

1850-408: The actual data blocks. The superblock contains important information that is crucial to the booting of the operating system . Thus backup copies are made in multiple block groups in the file system. However, typically only the first copy of it, which is found at the first block of the file system, is used in the booting. The group descriptor stores the location of the block bitmap, inode bitmap, and

1900-403: The data allocation bitmap. Any needed space in the inode table can be found by looking in the inode allocation bitmap. The reason for some limits of ext2 are the file format of the data and the operating system's kernel. Mostly these factors will be determined once when the file system is built. They depend on the block size and the ratio of the number of blocks and inodes. In Linux the block size

1950-445: The file. The maximal number of sublevel-directories is 31998, due to the link-count limit. Directory indexing is not available in ext2, so there are performance issues for directories with a large number of files (>10,000). The theoretical limit on the number of files in a directory is 1.3 × 10, although this is not relevant for practical situations. Note: In Linux 2.4 and earlier, block devices were limited to 2 TiB, limiting

2000-494: The first file system using the VFS API and was included in Linux version 0.96c. The ext file system solved the two major problems in the Minix file system (maximum partition size and filename length limitation to 14 characters), and allowed 2 gigabytes of data and filenames of up to 255 characters. But it still had problems: there was no support of separate timestamps for file access, inode modification, and data modification. As

2050-464: The group containing its parent directory, on the theory that accesses to parent and children directories are likely to be closely related. ext2 also attempts to place files in the same group as their directory entries, because directory accesses often lead to file accesses. However, if the group is full, then the new file or new directory is placed in some other non-full group. The data blocks needed to store directories and files can be found by looking in

ext2 - Misplaced Pages Continue

2100-450: The initial Hurd architect, their early plan was to adapt the 4.4BSD -Lite kernel and, in hindsight, "It is now perfectly obvious to me that this would have succeeded splendidly and the world would be a very different place today." In 1987 Richard Stallman proposed using the Mach microkernel developed by Richard Rashid at Carnegie Mellon University . Work on this was delayed for three years due to uncertainty over whether CMU would release

2150-471: The inode field. The only special treatment these two entries receive is that they are automatically created when any new directory is made, and they cannot be deleted. When a new file or directory is created, ext2 must decide where to store the data. If the disk is mostly empty, then data can be stored almost anywhere. However, clustering the data with related data will minimize seek times and maximize performance. ext2 attempts to allocate each new directory in

2200-470: The maximal size of a partition, regardless of block size. e2compr is a modification to the ext2 driver in the Linux kernel to support compression and decompression of files by the file system, without any support by user applications. e2compr is a small patch against ext2. e2compr compresses only regular files; the administrative data (superblock, inodes, directory files , etc.) are not compressed (mainly for safety reasons). Access to compressed blocks

2250-404: The microkernel design would allow for all device drivers to be built as servers working in user space , but today most drivers of this kind are still contained in the GNU Mach kernel space . According to Hurd developers, the main advantage of microkernel-based design is the ability to extend the system: developing a new module would not require in depth knowledge of the rest of the kernel, and

2300-408: The start of the inode table for every block group. These, in turn, are stored in a group descriptor table. Every file or directory is represented by an inode . The term "inode" comes from "index node" (over time, it became i-node and then inode). The inode includes data about the size, permission, ownership, and location on disk of the file or directory. Example of ext2 inode structure: Quote from

2350-431: The subdirectory in the inode field. Hard links are implemented by storing the same inode number with more than one file name. Accessing the file by either name results in the same inode number, and therefore the same data. The special directories "." (current directory) and ".." (parent directory) are implemented by storing the names "." and ".." in the directory, and the inode number of the current and parent directories in

2400-430: The user that started the process . This id largely dictates the actions permitted to the program. No outside process can change the user id of a running program. A Hurd process, on the other hand, runs under a set of user ids, which can contain multiple ids, one, or none. A sufficiently privileged process can add and remove ids to another process. For example, there is a password server that will hand out ids in return for

2450-520: Was released in August 2011 and provides multicore and High memory support. There are also branches for Linux 2.0 and 2.2. Access to ext2 partitions under Microsoft Windows is possible through an Installable File System , such as ext2ifs or ext2Fsd . Filesystem in Userspace can be used on macOS. GNU Hurd GNU Hurd is a collection of microkernel servers written as part of GNU , for

2500-443: Was the default filesystem in several Linux distributions , including Debian and Red Hat Linux , until supplanted by ext3 , which is almost completely compatible with ext2 and is a journaling file system . ext2 is still the filesystem of choice for flash -based storage media (such as SD cards and USB flash drives ) because its lack of a journal increases performance and minimizes the number of writes, and flash devices can endure

#2997