博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ext2 vs Ext3 vs Ext4
阅读量:4031 次
发布时间:2019-05-24

本文共 3792 字,大约阅读时间需要 12 分钟。

Linux File Systems: Ext2 vs Ext3 vs 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 .

Warning: Don’t execute any of the commands given below, if you don’t know what you are doing. You will lose your data!

Creating an ext2, or ext3, or ext4 filesystem

Once you’ve partitioned your hard disk using , 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/sda2tune2fs -j /dev/sda2mount /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/sda2tune2fs -O extents,uninit_bg,dir_index /dev/sda2e2fsck -pf /dev/sda2mount /dev/sda2 /home

Again, try all of the above commands only on a test system, where you can afford to lose all your data.

转载地址:http://vehbi.baihongyu.com/

你可能感兴趣的文章
前端干货,超实用的JQuery小技巧
查看>>
Spring Boot 几个常见的核心注解
查看>>
程序员需要懂的一些Linux基本命令
查看>>
程序员需要掌握的一些网络协议汇总
查看>>
搞定Windows下的Hadoop环境安装
查看>>
设计模式之单例模式的五种写法
查看>>
Nginx开启Gzip压缩,使你的网页急速加载
查看>>
一文看清HBase的使用场景
查看>>
除了负载均衡,Nginx还可以做很多,限流、缓存、黑白名单
查看>>
解析zookeeper的工作流程
查看>>
搞定Java面试中的数据结构问题
查看>>
深入理解Apache Flink核心技术
查看>>
SpringCloud 各组件原理图,面试必备
查看>>
面试题总结:可能是全网最好的MySQL重要知识点
查看>>
MySQL面试之数据库索引
查看>>
完整的项目管理流程,看清PMP42个过程的执行顺序
查看>>
设计模式,面试速记手册1
查看>>
设计模式,面试速记手册2
查看>>
备受面试官青睐的 Java NIO,到底和传统 IO 有啥不一样
查看>>
各大公司Java面试题超详细总结
查看>>