SlideShare a Scribd company logo
1 of 33
The ext filesystem
A four generation retrospective
Presented by –
Neha Kulkarni (5202)
ME Computer
Pune Institute of Computer Technology
Outline
• Linux file system
• Virtual file system
• Ext file system
• Ext2 file system
• Ext3 file system
• Ext4 file system
• Comparison
• Conclusion
• References
Linux filesystem
• A file system is an abstraction that supports the
creation, deletion, and modification of files, and
organization of files into directories.
• Linux uses the File System Hierarchy (FSH)
standard.
• Modern UNIX systems allow disks to be
partitioned into two or more separate physical
entities, each containing a distinct file system.
• Modern UNIX file systems are virtual file systems,
designed to handle many different types of
underlying physical file systems.
In the FHS, all files and directories appear under the
root directory /, even if they are stored on different
physical or virtual devices
• The superblock contains all of the information
about how the file system is configured, such
as block size, block address range, and mount
status.
• The i-nodes contain the file attributes and a
map indicating where the blocks of the file are
located on the disk. They are of 128 bytes.
• The data blocks are where file contents are
stored.
• i-node in position 2 of the table usually points
to the entry for the root directory file in the
file system.
inode pointer structure
Linux virtual file system
ext filesystem
• Implemented in April 1992 as the first file system
specifically for the Linux kernel
• It was the first implementation that used the
virtual file system, for which support was added
in the Linux kernel in version 0.96c, and it could
handle file systems up to 2GB in size.
• Filenames were allowed up to 255 characters.
• Only one timestamp, no data modification
timestamps
• Use of linked-list for free space- caused
fragmentation
Inode description for ext
ext2 filesystem
• Designed by Remy Card in January 1993
• Designed and implemented to fix some problems
present in the first extended file system.
• Maximal file size 2GB, can be extended up to 4TB
• Provides long file names up to 255 characters
• Reserves around 5% of the blocks for super-user
• User can set attributes on files or directories
• Allows the administrator to choose the logical
block size when creating the file system (1024B,
2048B, 4096B)
• Implements fast symbolic links (upto 60
characters)
• Keeps track of the file system state
• Immutable files can only be read. Nobody can
write or delete them.
• Directories are managed as linked lists of
variable length entries
• Data modification timestamps were available
• ext2 partitions can be converted to ext3 and vice-
versa without any need for backing up the data
and repartitioning
Bitmaps
• The superblock is defined in struct ext2_super_block, line 339
of include/linux/ext2_fs.h
• A group descriptor is defined by ext2_group_descr structure,
line 148 of ext2_fs.h
• Block number of the first block of inode table is stored in the
bg_inode_table field of the group descriptor.
• i_mode determines the type and access rights of a file. They
are present in sys/stat.h
Directory inode
Directory entries in the inode table require special attention. To test if an inode refers
to a directory file we can use the S_ISDIR(mode) macro:
if (S_ISDIR(inode.i_mode))
In the case of directory entries, the data blocks pointed by i_block[] contain a list of
the files in the directory and their respective inode numbers.
Locating a file
int fd = open("/home/ealtieri/hello.txt", O_RDONLY);
The desired file is hello.txt, while its path is /home/ealtieri/hello.txt.
Once the inode of the file is known, the data blocks belonging to the hello.txt are specified
by the inode.block[] array.
ext3 filesystem
• ext3, or third extended filesystem, is a
journalled filesystem.
• The filesystem was merged with the mainline
Linux kernel in November 2001 from 2.4.15
onward.
• Its main advantage over ext2 is journaling,
which improves reliability and eliminates the
need to check the file system after an unclean
shutdown.
• ext3 adds the following features to ext2:
- A journal
- Online file system growth
- HTree indexing for larger directories – 32
bit
• Maximum file size is 16GB-2TB
• Maximum file system size is 2TB-32TB
• The max number of blocks for ext3 is 232
• Journalling levels:
– Journal (Lowest risk) -
Both metadata and file contents are written to the
journal before being committed to the main file
system.
– Ordered (medium risk) -
Only metadata is journalled, file contents are written
to the disk before associated metadata is marked as
committed in the journal.
– Writeback (highest risk) -
Only metadata is journalled, file contents are not.
Contents might be written before or after the journal
I is updated.
Block allocator
• When allocating a block for a file, the Ext3 block
allocator always starts from the block group
where the i-node structure is stored to keep the
meta-data and data blocks close to each other
• In case of multiple files allocating blocks
concurrently, the Ext3 block allocator uses block
reservation to make sure that subsequent
requests for blocks for a particular file get served
before it is interleaved with other files.
• Ext3 still uses the bitmap to search for the free
blocks to reserve
Disadvantages of ext3
• Ext3 lacks recent features such as extents, dynamic
allocation of inodes, block sub-allocation.
• A directory can have at the most 31998 subdirectories.
• No online defragmentation tool
• Does not support the recovery of deleted files
• Does not have native support for snapshots
• No check-summing while writing the journal
• Ext3 stores dates as Unix time using four bytes in the
file header. 32 bits does not give enough scope to
continue processing files beyond January 18, 2038.
ext4 filesystem
• It supports 48-bit block addressing, so it will
have 1 EB of maximum filesystem size and 16
TB of maximum file size.
• 1 EB = 1,048,576 TB (1 EB = 1024 PB, 1 PB =
1024 TB, 1 TB = 1024 GB)
• Ext4 allows an unlimited number of sub
directories
Extents
• Extent mapping is used in Ext4 to represent new files, rather
than the double, triple indirect block mapping used in Ext2/3.
Ext4 block allocator
• Main goal is to provide better allocation for
small and large files
• Ext4 uses a "multiblock allocator" (mballoc).
• Persistent pre-allocation :
Applications tell the filesystem to preallocate
the space.
• The feature is available via the
libc posix_fallocate() interface
Delayed Allocation
• Delayed allocation defers block allocations from
write() operation time to page flush time.
• It increases the opportunity to combine many
block allocation requests into a single request
reducing fragmentation
• Saves CPU cycles, and avoids unnecessary block
allocation for short-lived files
• The current Ext4 delayed allocation only supports
data=writeback journalling mode.
Inode features
• Larger inodes: Ext4 will default to 256 bytes. This is needed
to accommodate some extra fields (like nanosecond
timestamps or inode versioning), and the remaining space
of the inode will be used to store extend attributes that are
small enough to fit it that space. This will make the access
to those attributes much faster, and improves the
performance of applications that use extend attributes by a
factor of 3-7 times.
• Inode reservation consists in reserving several inodes when
a directory is created, expecting that they will be used in
the future.
• Nanoseconds timestamps means that inode fields like
"modified time" will be able to use nanosecond resolution
instead of the second resolution of Ext3.
Journalling
• Ext4 checksums the journal data to know if
the journal blocks are failing or corrupted.
• In Ext4 the journaling feature can be disabled,
which provides a small performance
improvement.
Other features
• Ext4 supports online defragmentation
• There's a e4defrag tool which can defragment
individual files or the whole filesystem
• Fsck- In Ext4, at the end of each group's inode
table will be stored a list of unused inodes
(with a checksum, for safety), so fsck will not
check those inodes. The result is that total fsck
time improves from 2 to 20 times, depending
on the number of used inodes.
Difference between ext versions
Point ext2 ext3 ext4
Maximum
individual file size
16GB – 2TB 16GB – 2TB 16GB – 16TB
Maximum file
system size
2TB – 32TB 2TB – 32TB 1EB
Journalling Not available Available Available and can
be turned “off” too
Number of
directories
31998 31998 Unlimited
Journal checksum No No Yes
Multi-block
allocation and
delayed allocation
No No Yes
Conclusion
• Linux file system follows the FSH standard
• Ext, ext2, ext3, ext4 are the versions of the ext
file system
• Ext is no longer supported by Linux kernel
• Ext4 filesystem supports 48-bit block
addressing, multi-block allocation, extents,
persistent pre-allocation, delayed allocation,
unlimited number of subdirectories, journal
checksumming and improved timestamps.
References
[1] ”Design and Implementation of the Seconded Extended
Filesystem”, Remy Card, Proceedings of the First Dutch
International Symposium on Linux, ISBN 9036703859
[2] Ext4 Linux Kernal Newbies – Online Documentation
[3] Introduction to Linux : Chapter 3 – General Overview of the
Linux Filesystem
[4] ”Ext4 block and inode allocator improvements”, Aneesh
Kumar et al, Proceesings of the Linux Symposium, 2008
[5] Linux Filesystem Hierarchy, Binh Nguyen
[6] www.tldp.org_LDP_tlk_fs_filesystem
[7] www.wikipedia.org – ext2, ext3, ext4
Ext filesystem4

More Related Content

What's hot

Presentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) BasicsPresentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) Basics
Kuber Chandra
 
Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
 

What's hot (20)

RAID LEVELS
RAID LEVELSRAID LEVELS
RAID LEVELS
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
Presentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) BasicsPresentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) Basics
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
 
Linux File System
Linux File SystemLinux File System
Linux File System
 
NTFS vs FAT
NTFS vs FATNTFS vs FAT
NTFS vs FAT
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management
 
NTFS file system
NTFS file systemNTFS file system
NTFS file system
 
Fat 32 file system
Fat 32 file systemFat 32 file system
Fat 32 file system
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
Operating Systems: Device Management
Operating Systems: Device ManagementOperating Systems: Device Management
Operating Systems: Device Management
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
FAT vs NTFS
FAT vs NTFSFAT vs NTFS
FAT vs NTFS
 
Windows File Systems
Windows File SystemsWindows File Systems
Windows File Systems
 
File system
File systemFile system
File system
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 

Similar to Ext filesystem4

TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
Shu-Yu Fu
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
Terry Wang
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
Zubair Nabi
 
Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)
Rudhramoorthi Andiappan
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
BUSHRASHAIKH804312
 

Similar to Ext filesystem4 (20)

Osdc2011.ext4btrfs.talk
Osdc2011.ext4btrfs.talkOsdc2011.ext4btrfs.talk
Osdc2011.ext4btrfs.talk
 
Poking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And ProfitPoking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And Profit
 
Root file system
Root file systemRoot file system
Root file system
 
Os
OsOs
Os
 
Windowsforensics
WindowsforensicsWindowsforensics
Windowsforensics
 
OSDC 2011 | Enterprise Linux Server Filesystems by Remo Rickli
OSDC 2011 | Enterprise Linux Server Filesystems by Remo RickliOSDC 2011 | Enterprise Linux Server Filesystems by Remo Rickli
OSDC 2011 | Enterprise Linux Server Filesystems by Remo Rickli
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
Operating system
Operating systemOperating system
Operating system
 
Os
OsOs
Os
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
 
Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)
 
linux file sysytem& input and output
linux file sysytem& input and outputlinux file sysytem& input and output
linux file sysytem& input and output
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Ext filesystem4

  • 1. The ext filesystem A four generation retrospective Presented by – Neha Kulkarni (5202) ME Computer Pune Institute of Computer Technology
  • 2. Outline • Linux file system • Virtual file system • Ext file system • Ext2 file system • Ext3 file system • Ext4 file system • Comparison • Conclusion • References
  • 3. Linux filesystem • A file system is an abstraction that supports the creation, deletion, and modification of files, and organization of files into directories. • Linux uses the File System Hierarchy (FSH) standard. • Modern UNIX systems allow disks to be partitioned into two or more separate physical entities, each containing a distinct file system. • Modern UNIX file systems are virtual file systems, designed to handle many different types of underlying physical file systems.
  • 4. In the FHS, all files and directories appear under the root directory /, even if they are stored on different physical or virtual devices
  • 5.
  • 6. • The superblock contains all of the information about how the file system is configured, such as block size, block address range, and mount status. • The i-nodes contain the file attributes and a map indicating where the blocks of the file are located on the disk. They are of 128 bytes. • The data blocks are where file contents are stored. • i-node in position 2 of the table usually points to the entry for the root directory file in the file system.
  • 9. ext filesystem • Implemented in April 1992 as the first file system specifically for the Linux kernel • It was the first implementation that used the virtual file system, for which support was added in the Linux kernel in version 0.96c, and it could handle file systems up to 2GB in size. • Filenames were allowed up to 255 characters. • Only one timestamp, no data modification timestamps • Use of linked-list for free space- caused fragmentation
  • 11. ext2 filesystem • Designed by Remy Card in January 1993 • Designed and implemented to fix some problems present in the first extended file system. • Maximal file size 2GB, can be extended up to 4TB • Provides long file names up to 255 characters • Reserves around 5% of the blocks for super-user • User can set attributes on files or directories • Allows the administrator to choose the logical block size when creating the file system (1024B, 2048B, 4096B)
  • 12. • Implements fast symbolic links (upto 60 characters) • Keeps track of the file system state • Immutable files can only be read. Nobody can write or delete them. • Directories are managed as linked lists of variable length entries • Data modification timestamps were available • ext2 partitions can be converted to ext3 and vice- versa without any need for backing up the data and repartitioning
  • 13.
  • 15. • The superblock is defined in struct ext2_super_block, line 339 of include/linux/ext2_fs.h • A group descriptor is defined by ext2_group_descr structure, line 148 of ext2_fs.h • Block number of the first block of inode table is stored in the bg_inode_table field of the group descriptor. • i_mode determines the type and access rights of a file. They are present in sys/stat.h
  • 16. Directory inode Directory entries in the inode table require special attention. To test if an inode refers to a directory file we can use the S_ISDIR(mode) macro: if (S_ISDIR(inode.i_mode)) In the case of directory entries, the data blocks pointed by i_block[] contain a list of the files in the directory and their respective inode numbers.
  • 17. Locating a file int fd = open("/home/ealtieri/hello.txt", O_RDONLY); The desired file is hello.txt, while its path is /home/ealtieri/hello.txt. Once the inode of the file is known, the data blocks belonging to the hello.txt are specified by the inode.block[] array.
  • 18. ext3 filesystem • ext3, or third extended filesystem, is a journalled filesystem. • The filesystem was merged with the mainline Linux kernel in November 2001 from 2.4.15 onward. • Its main advantage over ext2 is journaling, which improves reliability and eliminates the need to check the file system after an unclean shutdown.
  • 19. • ext3 adds the following features to ext2: - A journal - Online file system growth - HTree indexing for larger directories – 32 bit • Maximum file size is 16GB-2TB • Maximum file system size is 2TB-32TB • The max number of blocks for ext3 is 232
  • 20. • Journalling levels: – Journal (Lowest risk) - Both metadata and file contents are written to the journal before being committed to the main file system. – Ordered (medium risk) - Only metadata is journalled, file contents are written to the disk before associated metadata is marked as committed in the journal. – Writeback (highest risk) - Only metadata is journalled, file contents are not. Contents might be written before or after the journal I is updated.
  • 21. Block allocator • When allocating a block for a file, the Ext3 block allocator always starts from the block group where the i-node structure is stored to keep the meta-data and data blocks close to each other • In case of multiple files allocating blocks concurrently, the Ext3 block allocator uses block reservation to make sure that subsequent requests for blocks for a particular file get served before it is interleaved with other files. • Ext3 still uses the bitmap to search for the free blocks to reserve
  • 22. Disadvantages of ext3 • Ext3 lacks recent features such as extents, dynamic allocation of inodes, block sub-allocation. • A directory can have at the most 31998 subdirectories. • No online defragmentation tool • Does not support the recovery of deleted files • Does not have native support for snapshots • No check-summing while writing the journal • Ext3 stores dates as Unix time using four bytes in the file header. 32 bits does not give enough scope to continue processing files beyond January 18, 2038.
  • 23. ext4 filesystem • It supports 48-bit block addressing, so it will have 1 EB of maximum filesystem size and 16 TB of maximum file size. • 1 EB = 1,048,576 TB (1 EB = 1024 PB, 1 PB = 1024 TB, 1 TB = 1024 GB) • Ext4 allows an unlimited number of sub directories
  • 24. Extents • Extent mapping is used in Ext4 to represent new files, rather than the double, triple indirect block mapping used in Ext2/3.
  • 25. Ext4 block allocator • Main goal is to provide better allocation for small and large files • Ext4 uses a "multiblock allocator" (mballoc). • Persistent pre-allocation : Applications tell the filesystem to preallocate the space. • The feature is available via the libc posix_fallocate() interface
  • 26. Delayed Allocation • Delayed allocation defers block allocations from write() operation time to page flush time. • It increases the opportunity to combine many block allocation requests into a single request reducing fragmentation • Saves CPU cycles, and avoids unnecessary block allocation for short-lived files • The current Ext4 delayed allocation only supports data=writeback journalling mode.
  • 27. Inode features • Larger inodes: Ext4 will default to 256 bytes. This is needed to accommodate some extra fields (like nanosecond timestamps or inode versioning), and the remaining space of the inode will be used to store extend attributes that are small enough to fit it that space. This will make the access to those attributes much faster, and improves the performance of applications that use extend attributes by a factor of 3-7 times. • Inode reservation consists in reserving several inodes when a directory is created, expecting that they will be used in the future. • Nanoseconds timestamps means that inode fields like "modified time" will be able to use nanosecond resolution instead of the second resolution of Ext3.
  • 28. Journalling • Ext4 checksums the journal data to know if the journal blocks are failing or corrupted. • In Ext4 the journaling feature can be disabled, which provides a small performance improvement.
  • 29. Other features • Ext4 supports online defragmentation • There's a e4defrag tool which can defragment individual files or the whole filesystem • Fsck- In Ext4, at the end of each group's inode table will be stored a list of unused inodes (with a checksum, for safety), so fsck will not check those inodes. The result is that total fsck time improves from 2 to 20 times, depending on the number of used inodes.
  • 30. Difference between ext versions Point ext2 ext3 ext4 Maximum individual file size 16GB – 2TB 16GB – 2TB 16GB – 16TB Maximum file system size 2TB – 32TB 2TB – 32TB 1EB Journalling Not available Available Available and can be turned “off” too Number of directories 31998 31998 Unlimited Journal checksum No No Yes Multi-block allocation and delayed allocation No No Yes
  • 31. Conclusion • Linux file system follows the FSH standard • Ext, ext2, ext3, ext4 are the versions of the ext file system • Ext is no longer supported by Linux kernel • Ext4 filesystem supports 48-bit block addressing, multi-block allocation, extents, persistent pre-allocation, delayed allocation, unlimited number of subdirectories, journal checksumming and improved timestamps.
  • 32. References [1] ”Design and Implementation of the Seconded Extended Filesystem”, Remy Card, Proceedings of the First Dutch International Symposium on Linux, ISBN 9036703859 [2] Ext4 Linux Kernal Newbies – Online Documentation [3] Introduction to Linux : Chapter 3 – General Overview of the Linux Filesystem [4] ”Ext4 block and inode allocator improvements”, Aneesh Kumar et al, Proceesings of the Linux Symposium, 2008 [5] Linux Filesystem Hierarchy, Binh Nguyen [6] www.tldp.org_LDP_tlk_fs_filesystem [7] www.wikipedia.org – ext2, ext3, ext4