{"id":736,"date":"2012-03-06T18:08:14","date_gmt":"2012-03-06T18:08:14","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=736"},"modified":"2014-03-19T09:13:55","modified_gmt":"2014-03-19T09:13:55","slug":"how-ext4-file-system-works","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/","title":{"rendered":"How ext4 file system works"},"content":{"rendered":"<h2>How ext4 file system works<\/h2>\n<p><strong>How it reduce fragmentation?<\/strong><br \/>\nIt consists of delaying block allocation until the data is going to be written to the disk, unlike some other file systems, which may allocate the necessary blocks before that step. This improves performance and reduces fragmentation by improving block allocation decisions based on the actual file size.<\/p>\n<p><strong>How does it manage read\/write on disk?<\/strong><br \/>\nThere are two common ways of replacing the contents of a file on Unix systems:<\/p>\n<p>Either truncate a file and start write it, we can call it \u201cw\u201d or \u201cw+\u201d mode for common understanding<\/p>\n<p>fd=open(&#8220;file&#8221;, O_TRUNC); write(fd, data); close(fd);<\/p>\n<p>the other one is to create a file and then rename it, then move the updated data chunk in that renamed file as:<\/p>\n<p>fd=open(&#8220;file.new&#8221;); write(fd, data); close(fd); rename(&#8220;file.new&#8221;, &#8220;file&#8221;);<\/p>\n<p>A new temporary file (&#8220;file.new&#8221;) is created, which initially contains the new contents. Then the new file is renamed over the old one. Replacing files by the &#8220;rename&#8221; call is guaranteed to be atomic by POSIX standards \u2013 i.e. either the old file remains, or it&#8217;s overwritten with the new one. Because the ext3 default &#8220;ordered&#8221; journaling mode guarantees file data is written out on disk before metadata, this technique guarantees that either the old or the new file contents will persist on disk. ext4&#8217;s delayed allocation breaks this expectation, because the file write can be delayed for a long time, and the rename is usually carried out before new file contents reach the disk.<\/p>\n<p>(Taken from http:\/\/www.linux-mag.com\/id\/7271\/3\/)<\/p>\n<p>It is a good thing that overall results of ext4 are very good without the mount options, it shows that its better than the previous version for sure.<\/p>\n<p><strong>Operating Systems Perspective:<\/strong><br \/>\nExt4 does not yet have as much support as ext2 and ext3 on non-linux operating systems. Ext2 and ext3 have stable drivers such as Ext2IFS, which are not yet available for ext4. It is possible to create compatible ext4 filesystems for use in Windows by disabling the extents feature, and sometimes specifying an Inode size. Viewing and copying files from ext4 to Windows, even with extents enabled, is also possible with the Ext2Read software. However, there are no available drivers that provide full read and write compatibility with Windows. Current Macintosh drivers are also read-only. Another option for using ext4 in Windows is to use Ext2Fsd freeware that recently has added support of writing in ext4 under Windows.<\/p>\n<p><strong>Checksumming Technique:<\/strong><br \/>\nThe technique of journal checksumming, which is available in ext4 as a good feature, was inspired by a research paper from the University of Wisconsin titled IRON File Systems (specifically, section 6, called &#8220;transaction checksums&#8221;) with modifications within the implementation of compound transactions performed by the IRON file system (originally proposed by Sam Naghshineh in the RedHat summit).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How ext4 file system works How it reduce fragmentation? It consists of delaying block allocation until the data is going to be written to the disk, unlike some other file systems, which may allocate the necessary blocks before that step. This improves performance and reduces fragmentation by improving block allocation decisions based on the actual [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[57],"tags":[],"class_list":["post-736","post","type-post","status-publish","format-standard","hentry","category-system-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How ext4 file system works<\/title>\n<meta name=\"description\" content=\"How ext4 file system works\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How ext4 file system works\" \/>\n<meta property=\"og:description\" content=\"How ext4 file system works\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2012-03-06T18:08:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-19T09:13:55+00:00\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"How ext4 file system works\",\"datePublished\":\"2012-03-06T18:08:14+00:00\",\"dateModified\":\"2014-03-19T09:13:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\"},\"wordCount\":486,\"articleSection\":[\"System Programming\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\",\"name\":\"How ext4 file system works\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"datePublished\":\"2012-03-06T18:08:14+00:00\",\"dateModified\":\"2014-03-19T09:13:55+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"description\":\"How ext4 file system works\",\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Software Engineering Perspective\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/software-engineering-perspective\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"System Programming\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/software-engineering-perspective\/system-programming\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"How ext4 file system works\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How ext4 file system works","description":"How ext4 file system works","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/","og_locale":"en_US","og_type":"article","og_title":"How ext4 file system works","og_description":"How ext4 file system works","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2012-03-06T18:08:14+00:00","article_modified_time":"2014-03-19T09:13:55+00:00","author":"Fahad","twitter_misc":{"Written by":"Fahad","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"How ext4 file system works","datePublished":"2012-03-06T18:08:14+00:00","dateModified":"2014-03-19T09:13:55+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/"},"wordCount":486,"articleSection":["System Programming"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/","name":"How ext4 file system works","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"datePublished":"2012-03-06T18:08:14+00:00","dateModified":"2014-03-19T09:13:55+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"description":"How ext4 file system works","breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/software-engineering-perspective\/system-programming\/how-ext4-file-system-works\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"Software Engineering Perspective","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/software-engineering-perspective\/"},{"@type":"ListItem","position":4,"name":"System Programming","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/software-engineering-perspective\/system-programming\/"},{"@type":"ListItem","position":5,"name":"How ext4 file system works"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":962,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=736"}],"version-history":[{"count":2,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/736\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/736\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}