Linux File Systems

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Linux File Systems: Ext2 vs Ext3 vs Ext4

https://www.thegeekstuff.com/2011/05/ext2-ext3-ext4/

ext2, ext3 and ext4 are all filesystems created for Linux. This article explains the following:

 High level difference between these filesystems.


 How to create these filesystems.
 How to convert from one filesystem type to another.
Ext2
 Ext2 stands for second extended file system.
 It was introduced in 1993. Developed by Rémy Card.
 This was developed to overcome the limitation of the original ext file system.
 Ext2 does not have journaling feature.
 On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
 Maximum individual file size can be from 16 GB to 2 TB
 Overall ext2 file system size can be from 2 TB to 32 TB
Ext3
 Ext3 stands for third extended file system.
 It was introduced in 2001. Developed by Stephen Tweedie.
 Starting from Linux Kernel 2.4.15 ext3 was available.
 The main benefit of ext3 is that it allows journaling.
 Journaling has a dedicated area in the file system, where all the changes are tracked. When the system
crashes, the possibility of file system corruption is less because of journaling.
 Maximum individual file size can be from 16 GB to 2 TB
 Overall ext3 file system size can be from 2 TB to 32 TB
 There are three types of journaling available in ext3 file system.
 Journal – Metadata and content are saved in the journal.
 Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the
content to disk. This is the default.
 Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or
after the content is written to the disk.
 You can convert a ext2 file system to ext3 file system directly (without backup/restore).
Ext4
 Ext4 stands for fourth extended file system.
 It was introduced in 2008.
 Starting from Linux Kernel 2.6.19 ext4 was available.
 Supports huge individual file size and overall file system size.
 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).
 Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
 You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
 Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal
checksum. fast fsck, etc. All you need to know is that these new features have improved the performance
and reliability of the filesystem when compared to ext3.
 In ext4, you also have the option of turning the journaling feature “off”.
Use the method we discussed earlier to identify whether you have ext2 or ext3 or ext4 file system.

Creating an ext2, or ext3, or ext4 filesystem


Once you’ve partitioned your hard disk using fdisk command, use mke2fs to create either ext2, ext3,
or ext4 file system.
Create an ext2 file system:
mke2fs /dev/sda1

Create an ext3 file system:

mkfs.ext3 /dev/sda1
(or)
mke2fs –j /dev/sda1

Create an ext4 file system:

mkfs.ext4 /dev/sda1
(or)
mke2fs -t ext4 /dev/sda1

Converting ext2 to ext3


For example, if you are upgrading /dev/sda2 that is mounted as /home, from ext2 to ext3, do the
following.

umount /dev/sda2
tune2fs -j /dev/sda2
mount /dev/sda2 /home

Note: You really don’t need to umount and mount it, as ext2 to ext3 conversion can happen on a live
file system. But, I feel better doing the conversion offline.

Converting ext3 to ext4


If you are upgrading /dev/sda2 that is mounted as /home, from ext3 to ext4, do the following.

umount /dev/sda2
tune2fs -O extents,uninit_bg,dir_index /dev/sda2
e2fsck -pf /dev/sda2
mount /dev/sda2 /home

Again, try all of the above commands only on a test system, where you can afford to lose all your data.
What Is A File System?
A file system is a set of rules used to decide how data is stored and fetched in
a storage device, be it a hard drive, flash drive, or something else. You can compare
the conventional way of storing data in our offices in different files to the file systems
deployed in computing.

A defined set of data called a ‘File’ is stored at a specified location in a storage device.
If the file system is kicked out of the computing world, all we will be left with is a
large chunk of unrecognizable data in our storage media.

There are many types of files systems available for different storage options like the
Disk File System, Flash File System, Tape File System, and so on. But for now, I’ll be
restricting myself with the three Disk File Systems FAT32, NTFS, and exFAT.

What is the allocation unit size?


Another term that gets mentioned often while discussing different file systems is the
allocation unit size (also called cluster size). It’s basically the smallest space that a
file can occupy on a partition. While formatting any drive, often the allocation unit
size is set to default. However, it varies from 4096 to 2048K. What does these values
mean? While formatting, if a partition is created with a 4096 allocation unit, then the
files will be stored into 4096 pieces.

What Is FAT32 File System?


An acronym for File Allocation Table, it’s the oldest and the most experienced file
system in the history of computing. The story started in 1977 with the original 8-bit
FAT file system intended as an antecedent to Microsoft’s Standalone Disk Basic-
80 which was launched for Intel’s 8080-based NCR 7200 in 1977/1978 — a data entry
terminal with 8-inch floppy disks. It was coded by Microsoft’s first salaried employee
Marc McDonald following discussions with Microsoft’s co-founder Bill Gates.
Further utilization of the FAT File System, or FAT Structure, as it was called earlier,
was done in Microsoft’s 8080/Z80 platform-based operating system MDOS/MIDAS
written by Marc McDonald.

FAT32: Limits and compatibility


In the subsequent years, the FAT file system advanced to FAT12, FAT16, and finally,
FAT32 that has been synonymous with the word file system when we have to deal
external storage media like removable drives.

FAT32 surmounted the limited volume size offered by the FAT16 file system. The 32-
bit File Allocation Table was released in August 1995, with the launch of the
Windows 95 operating system. FAT32 allows you to store files of size up to 4GB and
the maximum disk size can go up to 16TB.

So, the fatty file system can’t be used to install heavy apps or store large files, that’s
why the modern Windows uses a new file system known as NTFS, for which we don’t
have to worry about the file size and disk size limits.

Almost all versions of Windows, Mac, and Linux are compatible with FAT32
filesystem.

When to choose FAT32?


The FAT32 file system is perfect for storage devices like flash drives but you’ll have to
make sure you don’t have an individual file larger than 4GB. It has been widely
implemented beyond the realm of computers, like gaming consoles, HDTVs, DVD &
Blu-Ray players, and practically any device with a USB port.

What Is NTFS File System?


Another Microsoft proprietary file system called NTFS (New Technology File
System) was introduced in 1993 with their Windows NT 3.1 operating system
coming into existence.
NTFS file system offers inexhaustible file size limits. As of now, it would be next to
impossible for us to even reach somewhere near the boundary. The development of
NTFS file system started in the mid-1980s as the result of an association between
Microsoft and IBM to develop a new age operating system with better performance
in terms of graphics.

However, their friendship didn’t last long and the two parted their ways,
consequently developing their own version of the new file system. In 1989, IBM
made HPFS which was used in the OS/2 operating system while the partnership was
still going on. Microsoft launched NTFS v1.0 and released it with Windows NT 3.1 in
1993.

NTFS: Limits and features


The NTFS file system offers a theoretical file size of 16 EB – 1 KB, which
is 18,446,744,073,709,550,592 bytes. Well, your files aren’t that much huge, I guess.
Its development team included Tom Miller, Garry Kimura, Brian Andrew, and David
Goebel.

NTFS v3.1 was launched with Microsoft’s Windows XP and it hasn’t been changed
much since then, although, numerous additions like partition shrinking, self-healing,
and NTFS Symbolic links have been added. Also, the implemented capacity of NTFS
file system is only 256 TB out the whopping 16 EB – 1 KB which was done with the
launch of Windows 8.

Other notable features include reparse points, sparse file support, disk usage
quotas, distributed link tracking, and file-level encryption. The NTFS file system
supports backward compatibility with the previous versions.

It’s a journaling file system which proves to be an important aspect when it comes to


reviving a corrupt file system. It maintains a Journal, a data structure which keeps
track of any potential modifications to the file system and is used to recover the file
system.

The NTFS file system is supported by Windows XP and later versions. Apple’s Mac
OSX provides read-only support for an NTFS-formatted drive and only a few Linux
variants are able to provide write support for NTFS.

What Is exFAT File System?


The exFAT (Extended FAT) is another Microsoft proprietary file system which finds
its use in ball games where the FAT32 feels out of breath. Most of the modern digital
cameras use exFAT. High capacity SDXC memory cards are now pre-formatted with
the exFAT file system, as it is lighter in contrast to NTFS and supports file of sizes,
more than 4GB. So, if you have an exFAT SD card, you shall face no issues while
copying full-length HD movies on it which is not the case with FAT32.

exFAT: Limits and features


High capacity SDXC memory cards are now pre-formatted with the exFAT, as it is
lightweight in contrast to NTFS and supports file size more of than 4 GB. So, if you
have an exFAT SD card you will have no issues while copying full-length HD movies
on it which is not the case with FAT32.

Currently, Microsoft holds the US Patent 8321439 for Quick File Name Lookup using
Name hash. It is a method which escalates file search speed. They’ve not released a
complete specification set for the exFAT file system, for which the vendors have to
obtain a restricted license from Microsoft.

Most of the countries recognize the US Patent Law and thus, any implementation of
the exFAT file system is not possible for the vendors which intend it to be a part of an
open-source operating system or commercial software.

A FUSE-based version of the exFAT file system, named exfat-fuse, provides read/write


operations for many Linux distributions and FreeBSD. A kernel-based
implementation made by Samsung was accidentally leaked on GitHub but was later
published officially.

Launched in 2006, exFAT file system has the same 16 EB file size limit as NTFS, but it
is way lighter as it doesn’t contain many of the extra features that the latter has.
Talking about the compatibility, full read and write support is provided by Mac,
Android, and Windows operating systems. But for Linux distributions, the
appropriate software facilitates the support.

Update: Microsoft has now announced that it will make its exFAT patents available to
Linux and open source via the Open Invention Network.

NTFS vs FAT32 vs exFAT: Comparison


FAT32 NTFS exFAT

Windows XP Windows, Mac


and later (Read-only), Windows XP and
versions, Mac Linux (read-only later versions, Mac
Compatibilit
OSX 10.6.5 and for some OSX 10.6.5 and
y
above, Linux distributions), above, Linux (using
(using FUSE), Microsoft Xbox FUSE), Android
Android One.

Behaves as a fusion
between FAT32 and
Cross-platform Inexhaustible
NTFS by providing
Pros compatibility, limits for file and
practically unlimited
lightweight. partition size
file size and partition
size.

Limited file size


Limited cross- Microsoft restricts its
(up to 4GB) and
Cons platform usage by license
partition size
compatibility obligations.
(up to 16TB)

Usage Removable Best for internal Use with external


hard drives or flash
hard drives. Use
drives if you want to
it for Windows
transfer files larger
system drive and
storage than 4 GB. Always
any other system
devices. prefer exFAT over
partition which
FAT32, if the
may be used to
operating
install software.
system supports it.

Did you find this comparison of NTFS, FAT32, and exFAT file systems helpful? Drop
your thoughts and feedback.

You might also like