{"id":460,"date":"2013-12-13T08:01:36","date_gmt":"2013-12-13T08:01:36","guid":{"rendered":"http:\/\/www.jontrinder.com\/blog\/?p=460"},"modified":"2013-12-13T08:01:36","modified_gmt":"2013-12-13T08:01:36","slug":"the-perils-of-swapping-swap-late-at-night","status":"publish","type":"post","link":"https:\/\/www.jontrinder.com\/blog\/?p=460","title":{"rendered":"The Perils of Swapping Swap Late at Night"},"content":{"rendered":"<p>I recount this as a)A cautionary tale b)A reminder to myself how to get out of this mess.<\/p>\n<p>Following a recent system upgrade and more memory, it was time to increase swap space for my LMDE Linux install.<\/p>\n<p>It was midnight, I&#8217;d been writing Android JAVA code all day and tired what could possibly go wrong&#8230;.<\/p>\n<p>My swap partition was on \/dev\/sda5 and there was insufficient room either side to increase it. But there was a spare chunk of unallocated disk further up. &#8220;Hey&#8221; I thought, I&#8217;ll just move swap to \/dev\/sda12 and delete the old one that will only take a few minutes.<\/p>\n<p>Ahh I&#8217;d better \u00a0change the uuid of swap in fstab . Oh \u00a0and change \/etc\/initramfs-tools\/conf.d\/resume to point at the newly selected swap partition. So I did, and rebooted. Miserably failure number 1, forgot to update-initrams. Doh!<\/p>\n<p>(<strong>why oh why didnt I just change the uuid of the new swap to be the same as the old one<\/strong> that would have saved so much misery and the typing of this blog entry)<\/p>\n<p>The change did indeed only take a few minutes, I rebooted the system and the boot hung at the resume stage.<\/p>\n<p>At this point I thought, &#8220;Oh Belgium!&#8221; and went to sleep. (if &#8220;Oh Belgium&#8221;\u00a0doesn&#8217;t\u00a0make sense you need to read more books or listen to the correct radio comedy, does 42 mean\u00a0anything\u00a0to you?)<\/p>\n<p>Thus next morning the following steps were taken.<\/p>\n<p>Fortunately I have my systems configured with a couple of Linux Installs and Clonezilla partition(which makes doing whole system backups a lot more convenient).<\/p>\n<p>At this point the plans were:<\/p>\n<p>Plan A<\/p>\n<ul>\n<li>Restart System<\/li>\n<li>Move swap back to where it was on \/dev\/sda5<\/li>\n<li>Give the new dev\/sda5 swap the same uuid as the old one<\/li>\n<\/ul>\n<p>As I wrote that down, my asleep brain realised actually an easier way would be<\/p>\n<p>Plan B<\/p>\n<ul>\n<li>Give the new swap the UUID of the old one<\/li>\n<li>Put the old uuid back into \/etc\/fstab<\/li>\n<li>Put the old one back into the resume file sometime as well<\/li>\n<\/ul>\n<p>Plan C<\/p>\n<ul>\n<li>Some hacking to do initramfs on the non bootable system<\/li>\n<\/ul>\n<p>Plan C too fiddly for my patience so A and B \u00a0looked the most straightforward \u00a0but both needed me to know the UUID of the old version of swap.<\/p>\n<p>Thats OK I thought it will be in my backup of fstab.<\/p>\n<p>More misery followed involving, encrypted backups, downloading the wrong version of the encryption tools and finding my Centos boot didnt have the commands I wanted.<\/p>\n<p>Anyway to change the swap uuid\u00a0, the usual way of changing disk uuid using tune2fs was a non starter as it doesnt like swap partitions.<\/p>\n<p>So the way to do it is<\/p>\n<p>mkswap \/dev\/sda5\u00a0-U theuuid<\/p>\n<p>System now rebooted and back to the fun of Andriod and JAVA.<\/p>\n<p>Next time I must just change the new swaps UUID instead, much easier.<\/p>\n<p>::sigh::<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recount this as a)A cautionary tale b)A reminder to myself how to get out of this mess. Following a recent system upgrade and more memory, it was time to increase swap space for my LMDE Linux install. It was &hellip; <a href=\"https:\/\/www.jontrinder.com\/blog\/?p=460\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[81,80,79,35],"tags":[29,3,4],"class_list":["post-460","post","type-post","status-publish","format-standard","hentry","category-coding","category-computing","category-linux","category-linuxmint","tag-coding","tag-computing","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=460"}],"version-history":[{"count":1,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/460\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/460\/revisions\/461"}],"wp:attachment":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}