{"id":59,"date":"2009-03-25T09:33:00","date_gmt":"2009-03-25T08:33:00","guid":{"rendered":"http:\/\/www.hauweele.net\/~gawen\/blog\/?p=59"},"modified":"2014-05-12T19:44:57","modified_gmt":"2014-05-12T17:44:57","slug":"about-ext4","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=59","title":{"rendered":"About ext4"},"content":{"rendered":"<p>The ext4 is a journaled file-system, the successor to ext3. In summary the ext4fs greatly improve overall performance, efficiently reduce fragmentation and is fscked much more faster than his predecessor. Actually it has many features which follow :<\/p>\n<ul>\n<li>Large file system with now 16TB files and up to 1EB volume size.<\/li>\n<li>Extents which reduce fragmentation and improve large file performance.<\/li>\n<li>Compatibility with ext2 and ext3.<\/li>\n<li>Preallocation.<\/li>\n<li>Delayed allocation which improve block allocation decisions.<\/li>\n<li>Break 32 000 subdirectory limit with now 64 000 and improved performance using htree by default.<\/li>\n<li>Journal checksumming which improve reliability.<\/li>\n<li>Online defragmentation (didn&#8217;t try yet).<\/li>\n<li>Multiblock allocator which reduce fragmentation.<\/li>\n<li>More precise timestamp and fix the 2038 bug.<\/li>\n<\/ul>\n<p>If you want to create an ext4 file-system first get the <span style=\"font-style: italic;\">linux kernel (>= 2.6.28) <\/span>which contains the first stable version of the filesystem. Then enable <span style=\"font-style: italic;\">CONFIG_EXT4_FS<\/span> as module or built-in. If you want to try the large files and volume feature add <span style=\"font-style: italic;\">CONFIG_LBD<\/span> actually I didn&#8217;t try it since the largest I&#8217;ve got here is about 2TB so in what follows I&#8217;ll assume you won&#8217;t enable this feature. Then install <span style=\"font-style: italic;\">e2fsprogs (>= 1.41)<\/span> and check in <span style=\"font-style: italic;\">\/etc\/mke2fs.conf<\/span> for a line looking like this : <span style=\"font-family:courier new;\"><span style=\"color: rgb(0, 0, 153);font-size:85%;\" ><\/span><\/span><\/p>\n<blockquote><p><span style=\"font-family:courier new;\"><span style=\"color: rgb(0, 0, 153);font-size:85%;\" >ext4 = {<br \/>     features = has_journal, extents, huge_file, flex_bg, uninit_bg, dir_nlink, extra_isize<br \/>     inode_size = 256<br \/>}<\/span> <\/span><\/p><\/blockquote>\n<p>Checks the features and inode size (should be at least 256) and remove the <span style=\"font-style: italic;\">huge_file<\/span> feature since we won&#8217;t use it. Now reboot on your new kernel, create the partition with <span style=\"font-style: italic;\">fdisk<\/span> or any other tools and let <span style=\"font-style: italic;\">\/dev\/sdb2<\/span> be that partition. Just do as root :<\/p>\n<blockquote  style=\"color: rgb(153, 0, 0);font-family:courier new;\"><p><span style=\"font-size:85%;\"># mkfs.ext4 -I <span>256<\/span> -m <span style=\"font-style: italic;\">0<\/span> -L <span style=\"font-style: italic;\">HOME<\/span> <span style=\"font-style: italic;\">\/dev\/sdb2<\/span><br \/><\/span><\/p><\/blockquote>\n<p>This will create an ext4fs on <span style=\"font-style: italic;\">\/dev\/sdb2 <\/span>with <span style=\"font-style: italic;\">0%<\/span> of reserved blocks for root labelled as <span style=\"font-style: italic;\">HOME<\/span> (always label your file-systems it makes it easier to manage your partitions) and enable every features found in <span style=\"font-style: italic;\">\/etc\/mke2fs.conf <\/span>on it. Give it a try and <span style=\"font-style: italic;\">mount<\/span> it on <span style=\"font-style: italic;\">\/mnt<\/span> try putting some file on it :<\/p>\n<blockquote style=\"color: rgb(153, 0, 0);\"><p><span style=\"color: rgb(153, 0, 0);font-size:85%;\" ><span style=\"font-family:courier new;\"># mount -t ext4 \/dev\/sdb2 \/mnt<\/span><\/span><\/p><\/blockquote>\n<p><span style=\"color: rgb(102, 0, 0);font-size:85%;\" ><span style=\"font-family:courier new;\"><\/span><\/span>Now in order to transfer your files to the newly created file-system just do :<span style=\"font-size:85%;\"> <span style=\"color: rgb(153, 0, 0);\"><br \/><span style=\"font-family:courier new;\"><\/span><\/span><\/span><\/p>\n<blockquote><p><span style=\"font-size:85%;\"><span style=\"color: rgb(153, 0, 0);\"><span style=\"font-family:courier new;\"># mount -t ext4 \/dev\/sdb2 \/mnt &amp;&amp; cp -aRv \/home\/* \/mnt\/ &amp;&amp; rm -rf \/home\/* &amp;&amp; umount \/mnt &amp;&amp; mount -t ext4 \/dev\/sdb2 \/home<\/span><\/span><\/span><\/p><\/blockquote>\n<p>Your home directories should now be mounted on the new ext4 file-system. <span style=\"font-weight: bold;\">Be sure you didn&#8217;t misstyped the last command since it will delete files on the old file-system<\/span>. Then just add a line for it in <span style=\"font-style: italic;\">\/etc\/fstab <\/span>in order to mount it automatically on each boot :<br \/><span style=\"color: rgb(0, 0, 153);font-family:courier new;font-size:85%;\"  ><\/p>\n<blockquote><p>\/dev\/sdb2 \/home ext4 noatime 0 2<\/p><\/blockquote>\n<p><\/span>Now your home directory will be mounted automatically. Repeat that step for each partition and it&#8217;s done.<\/p>\n<p>The ext4 file-system is not shown in the <span style=\"font-style: italic;\">squeeze&#8217;s debian installer<\/span> so there are three solutions to take advantages of ext4 on the current stable :<\/p>\n<ol>\n<li>Using an ext3 partition and then mount it as ext4 using backward compatibility. I don&#8217;t use it since I heard that some features won&#8217;t be enabled that way especially the extents feature won&#8217;t if the inode size of the ext3 file-system is not at least 256.<\/li>\n<li>Using multiple ext4 partitions on top of an ext3 root instead of a single partition. This is the simplest solution which I&#8217;m using on my laptop right now.<\/li>\n<li>Tweaking the debian installer to install the system on a manually created ext4 file-system. This is the most boring solution since if it fails somewhere you have to restart the installation process from the beginning.<\/li>\n<\/ol>\n<p>I&#8217;ll just describe briefly the second solution here since I don&#8217;t like the first one neither do I remember every step of the third one. When installing debian create two partition one for <span style=\"font-style: italic;\">\/boot<\/span> (~200MB) and another for the <span style=\"font-style: italic;\">root<\/span>, I mean &#8220;<span style=\"font-style: italic;\">\/<\/span>&#8221;  (~1GB) flagged for use as ext3 or reiserfs (actually I&#8217;m using reiserfs). Then  install <span style=\"font-style: italic;\">only<\/span> the <span style=\"font-style: italic;\">base-system<\/span>. Rebuild a new kernel with ext4 enabled in it, create partitions for <span style=\"font-style: italic;\">\/var<\/span>, <span style=\"font-style: italic;\">\/usr<\/span>, <span style=\"font-style: italic;\">\/tmp<\/span>, <span style=\"font-style: italic;\">\/home<\/span> and transfer documents as described above. Now continue the installation using <span style=\"font-style: italic;\">aptitude<\/span> and that&#8217;s it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ext4 is a journaled file-system, the successor to ext3. In summary the ext4fs greatly improve overall performance, efficiently reduce fragmentation and is fscked much more faster than his predecessor. Actually it has many features which follow : Large file &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=59\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[7,242,6],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-debian","tag-ext4","tag-linux"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}