Extended File System
• Originally written by Chris Provenzano
• Extensively rewritten by Linux Torvalds
• Initially released in 1992
• Removed the two big limitations in minix
• Used 32-bit file-pointers (filesizes to 2GB)
• Allowed long filenames (up to 255 chars)
• Question: How to integrate ext into Linux?
The Virtual File System idea
• Multiple file systems need to coexist
• But filesystems share a core of common concepts and high-level operations
• So can create a filesystem abstraction
• Applications interact with this VFS
• Kernel translates abstract-to-actual
Limitations in Ext
• Some problems with the Ext filesystem
– Lacked support for 3 timestamps
• Accessed, Inode Modified, Data Modified
– Used linked-lists to track free blocks/inodes
• Poor performance over time
• Lists became unsorted
• Files became fragmented
– Did not provide room for future extensibility
Xia and Ext2 filesystems
• Two new filesystems introduced in 1993
• Both tried to overcome Ext’s limitations
• Xia was based on existing minix code
• Ext2 was based on Torvalds’ Ext code
• Xia was initially more stable (smaller)
• But flaws in Ext2 were eventually fixed
• Ext2 soon became a ‘de facto’ standard
Filesystem Comparison
Filesystem
Comparison
Minix Ext Xia Ext2
Maximal FS size 64MB 2GB 2GB 4TB
Maximal filesize 64MB 2GB 64MB 2GB
Maximal filename 14/30 chars 255 chars 248 chars 255 chars
3 timestamps no no yes yes
Extensible? no no no yes
Can vary block size? no no no yes
Code is maintained? yes no ? yes
Common concepts
• Files are represented by inodes
• Directories are special files (dentries)
• Devices accessed by I/O on special files
• UNIX filesystems can implement ‘links’
Inodes
• A structure that contains file’s description:
– Type
– Access rights
– Owners
– Timestamps
– Size
– Pointers to data blocks
– Kernel keeps the inode in memory (open)
Directories
• These are structured in a tree hierarchy
• Each can contain both files and directories
• A directory is just a special type of file
• Special user-functions for directory access
• Each dentry contains filename + inode-no
• Kernel searches the direrctory tree
• translates a pathname to an inode-number
EXT2 File System
Originally used MINIX file system.Serious limitations like partition size,file name size etc.Proposed ext file
system which was even worse.Led to excessive fragmentation.Remy Card et’al propose ext2fs which is the
LINUX file system.
Influenced by BSD FFS.Every partition is divided into a number of block groups,corresponding to the cylinder
groups of FFS,with each block group holding a copy of superblock,inode and data blocks.
STRUCTURE OF EXT2FS
What is the basic idea of block groups ?
The physical superblock contains information on the number of inodes,blocks per block groups,time of last
mount,last write to sb,mount counter,maximum mount operations.Padded to a size of 1k bytes.
Block group descriptors:Information on block groups.Each block group is described by a 32 byte
desc.Contains block numbers in the inode bitmap,block bitmap and inode table,number of free
inodes,number of free blocks,number of directories in this block group.
Number of directories is made use by allocator to spread files evenly.
Block size=1024bytes => 8192 blocks per block group.
Inode size=128 Bytes.
Virtual File System
z VFS is designed to present a consistent view of data as stored on hardware
z Almost all hardware devices are represented using a generic interface
z VFS goes further, allowing the sysadmin to mount any of a set of logical file systems on any physical device
z Logical file systems promote compatibility with other operating system standards permitting developers to
implement file systems with different policies
z VFS abstracts details of physical device and logical file system allowing processes to access files using a
common interface, without knowing what physical or logical system the file resides on
FEATURES OF UNIX FILE SYSTEMS
Boot Block : Will it always be present?
SuperBlock:Information for managing file systems
InodeBlocks:inode structures for the file system.
DataBlocks:blocks for files,directories..etc
Mounting,Unmounting file systems
Representation of File systems
Management structures for file systems is similar to logical structure of UNIX file system.
VFS responsible for calling file-system specific implementations. How does VFS know which filesystems are
configured?
Void register_filesystem(struct file_system_type *);
Configured at boot-time and possibly loaded as modules as well.
struct file_system_type {
– Const char *name;
– Int fs_flags;
– Struct super_block *(*read_super)(struct super_block*,void *,int);
– #ifdef VERSION > 2.4
– Struct module *owner;
– Struct vfsmount *kern_mnt;
– #endif
– Struct file_system_type *next;
– };
Mounting
Any file system in UNIX must be mounted before it can be accessed,either through mount() or mount_root().
What is mount_root() ?
Representation of a mounted file system : struct super_block.Limited to NR_SUPER.
It is initialized by the function “read_super” in the VFS.It interrogates floppy disks,CD-ROM for a change of
media,tests if superblock is present and if so returns it.else it calls the fs-specific function to create a
superblock.
File system specific Read_super() reads its data from the block device using the LINUX cache
functions,bread,brw_page.Processes may be put to sleep when reading/writing or mounting file systems.
PROC FILE SYSTEM
Every process has a directory in /proc/pid which contains files relevant to the process.
VFS function read_super( ) is called by do_mount( ) and in turn calls proc_read_super( ) for the proc file
system.
Some of the invariable entries in the root dircetory entry are
. , .. , loadavg,uptime,meminfo,kmsg,version,pci,cpuinfo,self,ioports,profile.