Difference between Ext2,Ext3 and Ext4 File Systems

Overview :-

1) Difference between file systems
2) How to create file system
3) How to convert a file system to other
4) How to find the file system type of your server
5) I/O performance comparison using chart.

(Warning :-  Never try the filesystem conversion commands in your live or production servers )

 

Ext2

  • stands for second extended file system and it was introduced by Remy card in 1993.
  • Maximum individual file size can be from 16 GB to 2 TB and overall ext2 file system size can be from 2 TB to 32 TB

How to create an ext2 filesystem
# mke2fs /dev/sda1

 

Ext3

  • stands for third extended file system and it was introduced  by Stephen Tweedie in 2001
  • The main difference between ext2 and ext2 is , ext3 will allow journaling . (journaling is a type of log file , which will track all the file system changes)
  • Maximum individual file size can be from 16 GB to 2 TB and overall ext3 file system size can be from 2 TB to 32 TB
  • We can convert ext2 to ext3 directly

How to create ext3 file system :-
# mkfs.ext3 /dev/sda1
(or)
# mke2fs –j /dev/sda1
( -j for adding journaling capability )

How to  convert  ext2 to ext3 :-
# umount /dev/sda2
# tune2fs -j /dev/sda2
# mount /dev/sda2  /var

 

Ext4

  • stands for fourth extended file system and it was introduced in 2008 with Linux Kernel 2.6.19 .
  • Ext4 will support huge individual file systems also it can handle huge overall file system.
  • Maximum individual file size can be from 16 GB to 16 TB
  • Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • In ext3 the number of sub directories that a directory can contain is limited to 32,000. This limit has been raised to 64,000 in ext4,
  • Extents replace the traditional block mapping scheme used by ext2/3 filesystems. An extent is a range of contiguous physical blocks, improving large file performance and reducing fragmentation.
  • In ext4, unallocated block groups and sections of the inode table are marked as such. This enables e2fsck to skip them entirely on a check and greatly reduces the time it takes to check a file system . This feature is implemented in version 2.6.24 of the Linux kernel.

Creating ext4 file system :-
# mkfs.ext4 /dev/sda1
(or)
# mke2fs -t ext4 /dev/sda1

Converting ext3 to ext4
( Warning :- Never try this live or production servers )
# umount /dev/sda2
# tune2fs -O extents,uninit_bg,dir_index  /dev/sda2
# e2fsck -pf /dev/sda2
# mount /dev/sda2 /var

 

Find your servers filesystem type
We can find the filesystem type used in our servers using any one of the following commands
# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)

# file -sL /dev/sda1
/dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)

# df -T | awk ‘{print $1,$2,$7}’ | grep “^/dev”
/dev/sda3 ext3 /
/dev/sda1 ext3 /boot

 

Read/Write Performance chart of  ext2,ext3 and ext4.

Reference : http://www.delltechcenter.com/page/A+Comparison+of+Ext2,+Ext3+and+Ext4+Performance