{"id":1538,"date":"2020-10-13T20:03:13","date_gmt":"2020-10-14T00:03:13","guid":{"rendered":"https:\/\/enterpriseadmins.org\/blog\/?p=1538"},"modified":"2020-10-14T10:35:03","modified_gmt":"2020-10-14T14:35:03","slug":"photon-os-3-0-grow-filesystem","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/virtualization\/photon-os-3-0-grow-filesystem\/","title":{"rendered":"Photon OS 3.0 Grow Filesystem"},"content":{"rendered":"\n<p>I recently had a need to grow the root filesystem on a Photon OS 3.0 virtual machine.  This is something I&#8217;ve done before with Ubuntu Linux (<a href=\"https:\/\/enterpriseadmins.org\/blog\/virtualization\/ubuntu-18-04-grow-filesystem\/\">blog post here<\/a>), but Photon OS does not include the <code>growpart<\/code> command out of the box, so that process did not work.  <\/p>\n\n\n\n<p>After resizing the virtual machine disk, I rescaned from within the running OS (I could have also rebooted, but who wants to do that) by running this command:<\/p>\n\n\n\n<p><code>echo 1 &gt; \/sys\/class\/block\/sda\/device\/rescan<\/code><\/p>\n\n\n\n<p>I then installed the parted utility with the command <code>tdnf install parted<\/code> and started by typing <code>parted<\/code> at the shell prompt.  Once at the parted menu, I typed <code>print<\/code> to show the disk information.  A warning appeared letting me know there was extra space available for use and asking if I wanted to fix the GPT to use all the space, which I entered <code>Fix<\/code> to accept.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"888\" height=\"482\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-1.png\" alt=\"\" class=\"wp-image-1540\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-1.png 888w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-1-300x163.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-1-768x417.png 768w\" sizes=\"auto, (max-width: 888px) 100vw, 888px\" \/><\/figure>\n\n\n\n<p>From here you can see that Disk \/dev\/sda has a size of 26.8GB, but the last partition #3 ends at 21.5GB.  It happens that the last partition is the one I want to grow, so I type <code>resizepart 3<\/code> .  I&#8217;m notified that the partition is being used and I confirm with <code>Yes<\/code>.  To answer the new question for where I want the partition to end, I entered <code>26.8GB<\/code> which was the value previously returned by the <code>print<\/code> command.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"863\" height=\"157\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-2.png\" alt=\"\" class=\"wp-image-1541\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-2.png 863w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-2-300x55.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2020\/10\/image-2-768x140.png 768w\" sizes=\"auto, (max-width: 863px) 100vw, 863px\" \/><\/figure>\n\n\n\n<p>With the partition table issues resolved, I entered <code>quit<\/code> to exit the parted utility.<\/p>\n\n\n\n<p>Back at the shell, I ran <code>resize2fs \/dev\/sda3<\/code> to resize the filesystem to consume all of the space.  I can now confirm that my filesystem has the extra free space with the command <code>df -h<\/code> .<\/p>\n\n\n\n<p>After testing this out, I realized the environment where I really needed to make the change did not have internet access, even through a proxy.  Because of this I was unable to install parted with tdnf.  Not to worry, we have two different workarounds for that.<\/p>\n\n\n\n<p>First, we can install the parted RPM manually without tdnf.  To do this we browse to the Photon repo here: <a href=\"https:\/\/dl.bintray.com\/vmware\/photon_release_3.0_x86_64\/x86_64\/\">https:\/\/dl.bintray.com\/vmware\/photon_release_3.0_x86_64\/x86_64\/<\/a>.  Looking through the list of packages, we find the one starting parted-*, in this case parted-3.2-7.ph3.x86_64.rpm.  We download the file and copied it to the Photon VM (using WinSCP or the like).  From our shell prompt we then run <code>rpm --install \/tmp\/parted-3.2-7.ph3.x86_64.rpm<\/code> to install the manually downloaded RPM.  We can then run the rest of the steps as outlined previously.<\/p>\n\n\n\n<p>Alternatively, if we don&#8217;t want to install parted in the guest and are okay with a brief outage, we could use a bootable CD image which contains partition management tools.  One such tool that I&#8217;ve had good luck with is gparted.  You can download the image here: <a href=\"https:\/\/gparted.org\/download.php\">https:\/\/gparted.org\/download.php<\/a>. This tool takes care of all the steps, both growing the partition and extending the filesystem.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had a need to grow the root filesystem on a Photon OS 3.0 virtual machine. This is something I&#8217;ve done before with Ubuntu Linux (blog post here), but Photon OS does not include the growpart command out of &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/virtualization\/photon-os-3-0-grow-filesystem\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1538","post","type-post","status-publish","format-standard","hentry","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=1538"}],"version-history":[{"count":4,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1538\/revisions"}],"predecessor-version":[{"id":1554,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1538\/revisions\/1554"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=1538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=1538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=1538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}