{"id":1140,"date":"2024-11-10T21:12:36","date_gmt":"2024-11-10T20:12:36","guid":{"rendered":"https:\/\/www.homeserver.lu\/?p=1140"},"modified":"2024-11-10T21:12:36","modified_gmt":"2024-11-10T20:12:36","slug":"increase-size-of-disk-partition-in-ubuntu","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=1140","title":{"rendered":"Increase size of disk partition in Ubuntu"},"content":{"rendered":"\n<p>If you try to upgrade your system and you lack disk space, here is a solution that might help.<\/p>\n\n\n\n<p>Run &#8220;df -h&#8221; to check how much space your system is using.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>df -h<\/code><\/pre><\/div>\n\n\n\n<p> If it is at 100%, check if the partition still has some spare space left to be used.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>lsblk<\/code><\/pre><\/div>\n\n\n\n<p>If the size of the partition your Ubuntu system is living on (f.ex. sda3) is bigger thant the allocated space for &#8220;ubuntu&#8211;vg-ubuntu&#8211;lv&#8221;, then you can add space to the system partition.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"926\" height=\"194\" src=\"https:\/\/www.homeserver.lu\/wp-content\/uploads\/2024\/11\/partition.png\" alt=\"\" class=\"wp-image-1141\" srcset=\"https:\/\/www.homeserver.lu\/wp-content\/uploads\/2024\/11\/partition.png 926w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2024\/11\/partition-300x63.png 300w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2024\/11\/partition-768x161.png 768w, https:\/\/www.homeserver.lu\/wp-content\/uploads\/2024\/11\/partition-624x131.png 624w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><figcaption class=\"wp-element-caption\">Result of lsblk (15GB remaining to be added)<\/figcaption><\/figure>\n\n\n\n<p>You need to extend the logical volume to the maximum free space available:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>sudo lvextend -l +100%FREE \/dev\/mapper\/ubuntu--vg-ubuntu--lv<\/code><\/pre><\/div>\n\n\n\n<p>Then you need to expand the filesystem:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>sudo resize2fs \/dev\/mapper\/ubuntu--vg-ubuntu--lv<\/code><\/pre><\/div>\n\n\n\n<p>Check with df -h ig the additional space has been allocated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you try to upgrade your system and you lack disk space, here is a solution that might help. Run &#8220;df -h&#8221; to check how much space your system is using. If it is at 100%, check if the partition still has some spare space left to be used. If the size of the partition [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-1140","post","type-post","status-publish","format-standard","hentry","category-cli"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1140"}],"version-history":[{"count":1,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1140\/revisions"}],"predecessor-version":[{"id":1142,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1140\/revisions\/1142"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}