{"id":1239,"date":"2021-04-14T20:49:42","date_gmt":"2021-04-15T01:49:42","guid":{"rendered":"https:\/\/yourLinuxGuy.com\/?p=1239"},"modified":"2021-04-14T20:49:44","modified_gmt":"2021-04-15T01:49:44","slug":"boot-partition-isnt-big-enough-anymore","status":"publish","type":"post","link":"https:\/\/yourLinuxGuy.com\/?p=1239","title":{"rendered":"Boot Partition Isn&#8217;t Big Enough Anymore&#8230;"},"content":{"rendered":"<p>I&#8217;ve had some of my OpenSuse servers for a loooong time, through a lot of upgrades.\u00a0 When they were originally built, a 150 MB \/boot partition was plenty large&#8230; but it sure isn&#8217;t anymore.\u00a0 In fact, if you analyze it and try to modify it with Yast, it tells you as much, and won&#8217;t let you make it too small.\u00a0 Which would be fine if I were building new, but now I&#8217;m trying to modify my partitions just to give me breathing room, and as a result, Yast won&#8217;t help me because I&#8217;m not giving enough.<\/p>\n<p>The premise is this:\u00a0 On a few servers, I have the following partition setup from the old days:<\/p>\n<ul>\n<li>\/boot = \/dev\/sda1 = 150 MB<\/li>\n<li>swap = \/dev\/sda2 = 550 MB<\/li>\n<li>\/ = \/dev\/sda3 = 10 (or more) GB<\/li>\n<\/ul>\n<p>But the problem is that the \/boot slice can&#8217;t be extended with that swap partition in the way (because it must be contiguous)&#8230;\u00a0 So let&#8217;s move it around!\u00a0 I&#8217;m going to do a &#8220;shell game&#8221; by creating some space a the end, relocate swap to the new end place, and and push the \/boot into the space vacated by the old swap location.\u00a0 The only real tricks here are that, like I mentioned, Yast won&#8217;t help me because the size is too small (go ahead and try it yourself), and resizing the boot can be tricky, so I&#8217;m going to use gparted-live, because it&#8217;s so doggone easy.\u00a0 Let&#8217;s get to it!<\/p>\n<p>First, download gparted.\u00a0 Put the ISO somewhere where you can mount it to your VM cdrom drive.\u00a0 I useded gparted-live-1.2.0-1-amd64.iso<\/p>\n<p>Make a full export of the VM.\u00a0 I&#8217;m using Hyper-V in this scenario, so I use the built-in export feature to have a standby copy in case I mess it up.\u00a0 And, I like to make sure there&#8217;s no snapshots before making an export, so it is clean.<\/p>\n<p>Add space by extending the disk.\u00a0 In Hyper-V, for a gen1 VM, you shut down the VM, edit the virtual hard disk in the settings, and add like a GB or something.\u00a0 Remember, in my case, whatever I add is only going to be used by swap, so the minimum 1 GB is fine.<\/p>\n<p>Now swap the swap.\u00a0 Now boot up, and let&#8217;s shut down the existing swap:<\/p>\n<p>swapoff \/dev\/sda2<\/p>\n<p>&#8230;and make a new one:<\/p>\n<p>fdisk \/dev\/sda<\/p>\n<p>(follow the steps to create a swap partition: p to print tables, n to add new partition in empty space, in my case p for primary, default partition 4, default size, t to change type, 4 to select, set to type 82 (swap), and w to write to the disk.)<\/p>\n<p>&#8230;now, create the swap and turn it on:<\/p>\n<p>mkswap \/dev\/sda4<\/p>\n<p>swapon \/dev\/sda4<\/p>\n<p>&#8230;and of course edit your fstab to change the swap entry from sda2 to sda4:<\/p>\n<p>vi \/etc\/fstab<\/p>\n<p>init 6<\/p>\n<p>At this point you just want to make sure that the system boots up with the new swap without any problems.\u00a0 So reboot and as long as it boots okay, we now know we have a good new swap space, and the old swap to kick to the curb.<\/p>\n<p>Next, shut down the VM, attach the gparted-live CD, and boot into it.\u00a0 Just hit enter on the default options (3 times) until you are in the GUI tool.\u00a0 Next, we want to select and delete the old \/dev\/sda2 swap partition, and select &amp; &#8220;Resize\/Move&#8221; (expand) the \/dev\/sda1 partition (by dragging the end boundary in the GUI) to fill the space.\u00a0 Click Apply, Quit, Exit.<\/p>\n<p>Then, reboot and everything should be fine.<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve had some of my OpenSuse servers for a loooong time, through a lot of upgrades.\u00a0 When they were originally built, a 150 MB \/boot partition was plenty large&#8230; but it sure isn&#8217;t anymore.\u00a0 In fact, if you analyze it&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/yourLinuxGuy.com\/?p=1239\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12,166,167,47,15],"tags":[],"class_list":["post-1239","post","type-post","status-publish","format-standard","hentry","category-advanced","category-fdisk","category-gparted","category-linuxgeneral","category-suse"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnjn1-jZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/1239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1239"}],"version-history":[{"count":6,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions"}],"predecessor-version":[{"id":1245,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions\/1245"}],"wp:attachment":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}