{"id":123,"date":"2021-04-05T06:32:52","date_gmt":"2021-04-05T06:32:52","guid":{"rendered":"https:\/\/news.innerfire.net\/?p=123"},"modified":"2021-04-05T06:33:25","modified_gmt":"2021-04-05T06:33:25","slug":"how-to-expand-a-disk-from-the-linux-command-line","status":"publish","type":"post","link":"https:\/\/news.innerfire.net\/?p=123","title":{"rendered":"How to expand a disk from the Linux command line"},"content":{"rendered":"<p>I&#8217;ve been frustrated with the number of instructions that involve deleting a partition and then creating a new partition with the same starting block. Totally unnecessary!\u00a0 <\/p>\n<p>Life has gotten a lot easier thanks to the <em>growpart command. <strong>T<\/strong><\/em>he best part is that with the right filesystem you don&#8217;t even need to unmount.\u00a0 I suggest taking a backup or snapshot first in case something goes wrong.<em><br \/><\/em><\/p>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ngrowpart \/dev\/device_name partition_number\n<\/pre><\/div>\n\n\n<p>You can test it first with &#8211;dry-run:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ngrowpart --dry-run \/dev\/sda 3\n<\/pre><\/div>\n\n\n<p>Once that is done, just run the command for your given filesystem to expand into the rest of the partition.<br><br><strong>For btrfs:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nbtrfs filesystem resize amount mount_point\n<\/pre><\/div>\n\n\n<p>The amount can be something like +50g or max.  To resize the root partition to max simply type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nbtrfs filesystem resize max \/\n<\/pre><\/div>\n\n\n<p><strong>For ext4 it is:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nresize2fs \/dev\/device\n<\/pre><\/div>\n\n\n<p>For example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nresize2fs \/dev\/sda3\n<\/pre><\/div>\n\n\n<p><strong>For XFS:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxfs_growfs \/mount_point\n<\/pre><\/div>\n\n\n<p>for example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxfs_growfs \/\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been frustrated with the number of instructions that involve deleting a partition and then creating a new partition with the same starting block. Totally unnecessary!\u00a0 Life has gotten a lot easier thanks to the growpart command. The best part is that with the right filesystem you don&#8217;t even need to unmount.\u00a0 I suggest taking [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":2,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":125,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions\/125"}],"wp:attachment":[{"href":"https:\/\/news.innerfire.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/news.innerfire.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}