{"id":561,"date":"2012-12-04T10:31:12","date_gmt":"2012-12-04T08:31:12","guid":{"rendered":"https:\/\/www.npcglib.org\/~stathis\/blog\/?p=561"},"modified":"2013-10-01T05:50:46","modified_gmt":"2013-10-01T03:50:46","slug":"linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely","status":"publish","type":"post","link":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/","title":{"rendered":"linux task: Upgrade an ext3 to ext4 root \/ filesystem (remotely)"},"content":{"rendered":"<p><strong>[ATTENTION: These instructions are a personal reminder and you may follow them at your own risk!! I cannot be held responsible if you lose your data or your system becomes inaccessible.]<\/strong><\/p>\n<p>Sometimes it is not possible to physically access a linux server and go into single user mode to perform the conversion of a root filesystem from ext3 to an ext4 one. The strategy I follow is to disable just about everything on it, block access to incoming users, perform the changes on the filesystem and reboot.<\/p>\n<p>First, alter the filesystem of your root partition (\/) in \/etc\/fstab to ext4. The root filesystem is the partition with mount point \/. For example, my fstab line looks like this:<\/p>\n<pre>\r\n\/dev\/sda1    \/    <font style=\"color: red;\">ext3<\/font>    defaults        0       0\r\n<\/pre>\n<p>I changed it to read:<\/p>\n<pre>\r\n\/dev\/sda1    \/    <font style=\"color: blue;\">ext4<\/font>    defaults        0       0\r\n<\/pre>\n<p>Next determine which processes or services are writing on the root partition and stop them so you can perform the conversion. You would want to stop just about any services, except probably from sshd; that includes apache, mysql, samba, to name a few. As it may not be obvious what is writing on disk consider running the following command:<\/p>\n<pre>\r\n# fuser -v -m \/\r\n\r\n                     USER        PID <font style=\"color: blue;\">ACCESS<\/font> COMMAND\r\n\/:                   root     kernel mount \/\r\n                     root          1 .rce. init\r\n                     root          2 .rc.. kthreadd\r\n                     root          3 .rc.. ksoftirqd\/0\r\n                     root          5 .rc.. kworker\/0:0H\r\n                     ...\r\n                     ...\r\n                     ...\r\n                     root       1854 .rc.. scsi_eh_3\r\n                     root       2041 .rce. udevd\r\n                     root       2042 .rce. udevd\r\n                     root       2423 .rc.. flush-3:0\r\n                     <font style=\"color: red;\">root       2429 Frce. dhclient<\/font>\r\n                     root       2587 .rce. syslog-ng\r\n                     <font style=\"color: red;\">root       2588 Fr.e. syslog-ng<\/font>\r\n                     root       2619 .rce. sshd\r\n                     root       3102 .rce. cron\r\n                     root       3116 .rce. agetty\r\n                     root       3117 .rce. agetty\r\n                     root       3118 .rce. agetty\r\n                     root       3119 .rce. agetty\r\n                     root       3120 .rce. agetty\r\n                     root       3121 .rce. agetty\r\n                     root      15174 .rce. sshd\r\n                     root      15179 .rce. bash\r\n                     root      15194 .rc.. kworker\/0:0\r\n<\/pre>\n<p>Scan the long list of processes fuser will give you for processes with <font style=\"color: blue;\">ACCESS<\/font> containing <strong>F<\/strong> and <strong>f<\/strong>, which denote open files. Stop the respective processes. In my case it is the <font style=\"color: red;\">dhclient<\/font> process and the <font style=\"color: red;\">syslog-ng<\/font> service that have to be stopped. The syslog-ng can be stopped on Gentoo using:<\/p>\n<pre>\r\n\/etc\/init.d\/syslog-ng stop\r\n<\/pre>\n<p>while the dhclient can just be killed using its PID, with:<\/p>\n<pre>\r\nkill -9 2429\r\n<\/pre>\n<p>Double-check with fuser again that nothing is accessing the filesystem and now remount the root filesystem read-only:<\/p>\n<pre>\r\n# mount -o remount,ro \/\r\n<\/pre>\n<p>Enable the ext4 features on the existing ext3 filesystem of the root filesystem:<\/p>\n<pre>\r\n# tune2fs -O extents,uninit_bg,dir_index \/dev\/sda1\r\ntune2fs 1.42 (29-Nov-2011)\r\n<\/pre>\n<p>Then run fsck on the filesystem to fix up some on-disk structures that tune2fs has modified:<\/p>\n<pre>\r\n# e2fsck -fDC0 \/dev\/sda1 \r\ne2fsck 1.42 (29-Nov-2011)\r\nPass 1: Checking inodes, blocks, and sizes\r\nPass 2: Checking directory structure                                           \r\nPass 3: Checking directory connectivity                                        \r\nPass 3A: Optimizing directories                                                \r\nPass 4: Checking reference counts                                              \r\nPass 5: Checking group summary information                                     \r\n                                                                               \r\n\/dev\/sa1: ***** FILE SYSTEM WAS MODIFIED *****\r\n\/dev\/sda1: ***** REBOOT LINUX *****\r\n\/dev\/sda1: 608861\/4825088 files (5.5% non-contiguous), 13559414\/19277992 blocks\r\n<\/pre>\n<p>If everything goes according to plan, just reboot the machine and your system will come up using ext4 as the filesystem of your root partition. You can try <code>sync<\/code> instead of rebooting your machine, but this may or may not work.<\/p>\n<p>You can follow the same instructions to convert a non-root filesystem too, only this will be much easier, as you can just umount such partitions and perform the conversion steps.<\/p>\n<hr\/>\n<h3>References<\/h3>\n<ul>\n<li><a href=\"https:\/\/ext4.wiki.kernel.org\/index.php\/Ext4_Howto#Converting_an_ext3_filesystem_to_ext4\" title=\"Converting ext3 to ext4\" target=\"_blank\">Ext4 HowTo &#8211; Converting an ext3 filesystem to ext4<\/a>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>[ATTENTION: These instructions are a personal reminder and you may follow them at your own risk!! I cannot be held responsible if you lose your data or your system becomes inaccessible.] Sometimes it is not possible to physically access a linux server and go into single user mode to perform the conversion of a root [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[30,31,32,29,6],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"description\" content=\"Read how to convert a linux ext3 to ext4 filesystem, even on a remote system.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"stathis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\",\"name\":\"sigmoid\",\"description\":\"..oo..oo..oo..oo..oo..oo..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#webpage\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/\",\"name\":\"linux task: Upgrade an ext3 to ext4 root \/ filesystem (remotely) - sigmoid\",\"isPartOf\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\"},\"datePublished\":\"2012-12-04T08:31:12+00:00\",\"dateModified\":\"2013-10-01T03:50:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\"},\"description\":\"Read how to convert a linux ext3 to ext4 filesystem, even on a remote system.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"linux task: Upgrade an ext3 to ext4 root \/ filesystem (remotely)\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\",\"name\":\"stathis\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"caption\":\"stathis\"},\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"description":"Read how to convert a linux ext3 to ext4 filesystem, even on a remote system.","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:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/","twitter_misc":{"Written by":"stathis","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/","name":"sigmoid","description":"..oo..oo..oo..oo..oo..oo..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#webpage","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/","name":"linux task: Upgrade an ext3 to ext4 root \/ filesystem (remotely) - sigmoid","isPartOf":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website"},"datePublished":"2012-12-04T08:31:12+00:00","dateModified":"2013-10-01T03:50:46+00:00","author":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41"},"description":"Read how to convert a linux ext3 to ext4 filesystem, even on a remote system.","breadcrumb":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/12\/04\/linux-task-upgrade-an-ext3-to-ext4-root-filesystem-remotely\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.npcglib.org\/~stathis\/blog\/"},{"@type":"ListItem","position":2,"name":"linux task: Upgrade an ext3 to ext4 root \/ filesystem (remotely)"}]},{"@type":"Person","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41","name":"stathis","image":{"@type":"ImageObject","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo","inLanguage":"en-US","url":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","caption":"stathis"},"url":"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/561"}],"collection":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":17,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":1211,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions\/1211"}],"wp:attachment":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}