{"id":7056,"date":"2017-10-11T18:07:55","date_gmt":"2017-10-11T10:07:55","guid":{"rendered":"http:\/\/rmohan.com\/?p=7056"},"modified":"2017-10-11T18:07:55","modified_gmt":"2017-10-11T10:07:55","slug":"linux-file-systems-ext2-vs-ext3-vs-ext4-vs-xfs","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7056","title":{"rendered":"Linux File Systems: Ext2 vs Ext3 vs Ext4  vs Xfs"},"content":{"rendered":"<p>Linux File Systems: Ext2 vs Ext3 vs Ext4 vs Xfs<\/p>\n<p>ext2, ext3 and ext4 are all filesystems created for Linux. This article explains the following:<br \/>\nHigh level difference between these filesystems.<br \/>\nHow to create these filesystems.<br \/>\nHow to convert from one filesystem type to another.<\/p>\n<p>Ext2<br \/>\nExt2 stands for second extended file system.<br \/>\nIt was introduced in 1993. Developed by R\u00e9my Card.<br \/>\nThis was developed to overcome the limitation of the original ext file system.<br \/>\nExt2 does not have journaling feature.<br \/>\nOn flash drives, usb drives, ext2 is recommended, as it doesn\u2019t need to do the over head of journaling.<br \/>\nMaximum individual file size can be from 16 GB to 2 TB<br \/>\nOverall ext2 file system size can be from 2 TB to 32 TB<br \/>\nHow to create an ext2 filesystem<br \/>\n# mke2fs \/dev\/sda1<\/p>\n<p>Ext3<br \/>\nExt3 stands for third extended file system.<br \/>\nIt was introduced in 2001. Developed by Stephen Tweedie.<br \/>\nStarting from Linux Kernel 2.4.15 ext3 was available.<br \/>\nThe main benefit of ext3 is that it allows journaling.<br \/>\nJournaling 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.<br \/>\nMaximum individual file size can be from 16 GB to 2 TB<br \/>\nOverall ext3 file system size can be from 2 TB to 32 TB<br \/>\nThere are three types of journaling available in ext3 file system.<br \/>\nJournal \u2013 Metadata and content are saved in the journal.<br \/>\nOrdered \u2013 Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.<br \/>\nWriteback \u2013 Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.<br \/>\nYou can convert a ext2 file system to ext3 file system directly (without backup\/restore).<\/p>\n<p>How to create ext3 file system :-<br \/>\n# mkfs.ext3 \/dev\/sda1<br \/>\n(or)<br \/>\n# mke2fs \u2013j \/dev\/sda1<br \/>\n( -j for adding journaling capability )<br \/>\nHow to  convert  ext2 to ext3 :-<br \/>\n# umount \/dev\/sda2<br \/>\n# tune2fs -j \/dev\/sda2<br \/>\n# mount \/dev\/sda2  \/var<\/p>\n<p> Ext4<br \/>\nExt4 stands for fourth extended file system.<br \/>\nIt was introduced in 2008.<br \/>\nStarting from Linux Kernel 2.6.19 ext4 was available.<br \/>\nSupports huge individual file size and overall file system size.<br \/>\nMaximum individual file size can be from 16 GB to 16 TB<br \/>\nOverall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).<br \/>\nDirectory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)<br \/>\nYou can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).<br \/>\nSeveral 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.<br \/>\nIn ext4, you also have the option of turning the journaling feature \u201coff\u201d.<\/p>\n<p>Creating ext4 file system :-<br \/>\n# mkfs.ext4 \/dev\/sda1<br \/>\n(or)<br \/>\n# mke2fs -t ext4 \/dev\/sda1<br \/>\nConverting ext3 to ext4<br \/>\n( Warning :- Never try this live or production servers )<br \/>\n# umount \/dev\/sda2<br \/>\n# tune2fs -O extents,uninit_bg,dir_index  \/dev\/sda2<br \/>\n# e2fsck -pf \/dev\/sda2<br \/>\n# mount \/dev\/sda2 \/var<\/p>\n<p>Find your servers filesystem type<br \/>\nWe can find the filesystem type used in our servers using any one of the following commands<br \/>\n# mount<br \/>\n\/dev\/sda3 on \/ type ext3 (rw)<br \/>\nproc on \/proc type proc (rw)<br \/>\n\/dev\/sda1 on \/boot type ext3 (rw)<br \/>\ntmpfs on \/dev\/shm type tmpfs (rw)<br \/>\n# file -sL \/dev\/sda1<br \/>\n\/dev\/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)<br \/>\n# df -T | awk \u2018{print $1,$2,$7}\u2019 | grep \u201c^\/dev\u201d<br \/>\n\/dev\/sda3 ext3 \/<br \/>\n\/dev\/sda1 ext3 \/boot<\/p>\n<p>XFS<\/p>\n<p>XFS is a high-performance file system which was designed by SGI for their IRIX platform. Since XFS was ported to the Linux kernel in 2001, XFS has remained a preferred choice for many enterprise systems especially with massive amount of data, due to its high performance, architectural scalability and robustness. For example, RHEL\/CentOS 7 and Oracle Linux have adopted XFS as their default file system, and SUSE\/openSUSE have long been an avid supporter of XFS.<\/p>\n<p>XFS has a number of unique features that make it stand out among the file system crowd, such as scalable\/parallel I\/O, journaling for metadata operations, online defragmentation, suspend\/resume I\/O, delayed allocation for performance, etc.<\/p>\n<p>If you want to create and mount an XFS file system on your Linux platform, here is how to do it.<\/p>\n<p>XFS is packed full of cool features like guaranteed rate I\/O, online resizing, built-in quota enforcement, and it can theoretically support filesystems up to 8 exabytes in size. It\u2019s been used on Linux since about 2001, and is available as an install option on many popular Linux distributions. With variable block sizes, you can tune your system like a sliding scale to tweak for space efficiency or read performance.<\/p>\n<p>    Best for extremely large file systems, large files, and lots of files<br \/>\n    Journaled (an asymmetric parallel cluster file system version is also available)<br \/>\n    POSIX extended access controls<\/p>\n<p>The XFS file system is Open Source and included in major Linux distributions. It originated from SGI (Irix) and was designed specifically for large files and large volume scalability. Video and multi-media files are best handled by this file system. Scaling to petabyte volumes, it also handles great deals of data. It is one of the few filesystems on Linux which supports Data Migration (SGI contributed the Hierarchical Storage Management interfaces into the Linux Kernel a number of years ago). SGI also offers a closed source cluster parallel version of XFS called cXFS which like cVxFS is an asymmetrical model. It has the unique feature, however, that it\u2019s slave nodes can run on Unix, Linux and Windows, making it a cross platform file system. Its master node must run on SGI hardware.<\/p>\n<p>Recommended Use: If you really like to tweak your system to meet your needs, XFS is a great way to go.<\/p>\n<p>The XFS file system is an extension of the extent file system .XFS is a high performance 64 bit journaling file system .Support of XFS<br \/>\nwas merged into the linux kernel in around 2002 and In 2009 Red Hat Enterprise Linux version 5.4 usage of XFS file system .<br \/>\nNow RHEL 7.0 uses XFS as the default file system .<\/p>\n<p>XFS supports maximum file system size of 8 exbibytes for 64 bit file system .Some comparison of XFS file system is XFS file system cannot be shrunk and poor performance with<br \/>\ndeletions of large numbers of files.<\/p>\n<p>32-bit system 64-bit system<br \/>\nFile size: 16 Terabytes 16 Exabytes<br \/>\nFile system: 16 Terabytes 18 Exabytes<\/p>\n<p> Creating Xfs file system<\/p>\n<p>#fdisk \/dev\/sdb <-create font=\"\" partition=\"\" the=\"\"><br \/>\n#mkfs.xfs -f \/dev\/sdb1<br \/>\n#mount -t xfs \/dev\/sdb1 \/storage<br \/>\n#df -Th \/storage<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux File Systems: Ext2 vs Ext3 vs Ext4 vs Xfs<\/p>\n<p>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.<\/p>\n<p>Ext2 Ext2 stands for second extended file system. It was [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7056"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7056"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7056\/revisions"}],"predecessor-version":[{"id":7057,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7056\/revisions\/7057"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}