{"id":1904,"date":"2022-11-30T15:50:29","date_gmt":"2022-11-30T20:50:29","guid":{"rendered":"https:\/\/blog.lufamily.ca\/kang\/?p=1904"},"modified":"2023-02-03T16:21:04","modified_gmt":"2023-02-03T21:21:04","slug":"media-server-upgrade-2022-part-2","status":"publish","type":"post","link":"https:\/\/blog.lufamily.ca\/kang\/2022\/11\/30\/media-server-upgrade-2022-part-2\/","title":{"rendered":"Media Server Upgrade 2022 (Part 2)"},"content":{"rendered":"\n<p><a href=\"http:\/\/blog.lufamily.ca\/kang\/2022\/11\/27\/media-server-upgrade-2022\/\" data-type=\"URL\" data-id=\"blog.lufamily.ca\/kang\/2022\/11\/27\/media-server-upgrade-2022\/\">Part 1<\/a><\/p>\n\n\n\n<p>In the first part of this post, I talked about making sure all the new hardware that I recently purchased works. Yesterday, upgrading from Ubuntu 20.04 LTS to 22.04 LTS was super simple. Unfortunately, that was the end of the easy part.<\/p>\n\n\n\n<p>I thought I could just image by old boot drive and make a carbon copy of it on my new boot drive. My old boot drive is a simple SATA 512GB SSD, and my new boot drive is an NVMe M.2 1TB SSD plugged directly to the motherboard. The copying was pretty simple, but because the drives differ in size, I had to relayout the partition table with the new drive once the copy is completed. I did this with the <code>parted<\/code> command.<\/p>\n\n\n\n<p>Unfortunately the new boot drive did not want to boot. At this point I had to do some research. The most helpful articles were:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/askubuntu.com\/questions\/62340\/how-to-copy-an-ubuntu-install-from-one-laptop-to-another\" target=\"_blank\" rel=\"noreferrer noopener\">How to copy an Ubuntu install from one laptop to another<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.howtogeek.com\/196655\/how-to-configure-the-grub2-boot-loaders-settings\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Configure the GRUB2 Boot Loader\u2019s Settings<\/a><\/li>\n<\/ul>\n\n\n\n<p>Both of the above articles were an excellent refresher on how GRUB works. I have used GRUB since the beginning, but one gets super rusty when these types of tasks are only performed once every three or six years!<\/p>\n\n\n\n<p>Instead of detailing what went wrong, I will just explain what I should have done. This way if I need it again in the future, it is here for my reference.<\/p>\n\n\n\n<p><strong>Step 1<\/strong>: Perform a backup of the old boot drive from a Live USB in shell mode. This is done on my server on a nightly basis. This method is clearly described on the <a href=\"https:\/\/help.ubuntu.com\/community\/BackupYourSystem\/TAR\" target=\"_blank\" rel=\"noreferrer noopener\">Ubuntu Community Help Wiki<\/a>.<\/p>\n\n\n\n<p>Following this method I will end up with a compressed tar archive for my entire root directory, skipping some runtime and other unwanted directories.<\/p>\n\n\n\n<p><strong>Step 2<\/strong>: After installing a fresh install of the new Ubuntu LTS Server operating system on the new server and boot drive, I proceeded to backup the new boot with the same technique used in Step 1. I stored the backup of the new install on another external SSD drive that I have lying around. Also it is <strong>important<\/strong> that new boot drive partition layout of the new install contains a <em>swap partition<\/em>.<\/p>\n\n\n\n<p><strong>Step 3<\/strong>: I then restore the most recent backup (done in Step 1) of the <em>old<\/em> boot drive to the <em>new<\/em> boot drive. I then replaced the <code>\/boot\/grub<\/code> directory with the new contents from the new install which was backed up in Step 2. The new GRUB is already installed when we performed a brand new installation on the drive. We just want to make sure the boot partition matches the <code>\/boot\/grub<\/code> contents.<\/p>\n\n\n\n<p><strong>Step 4<\/strong>: We also need to fix up the <code>\/etc\/fstab<\/code> file because it contains references to drive devices from the old hardware. Paid special attention the main data partition and the swap partition. It should look something like this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code smallFont\"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# \/etc\/fstab: static file system information.\n#\n# Use &#039;blkid&#039; to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n# &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;\n# \/ was on \/dev\/nvme1n1p2 during curtin installation\nUUID=fc939be4-5292-4252-8120-7ef59b177e5b \/ ext4 defaults 0 1\n\n# \/boot\/efi was on \/dev\/nvme0n1p1 during curtin installation\nUUID=5187-A8C6 \/boot\/efi vfat defaults 0 1\n\n# Swap partition\nUUID=512d611e-6944-4a57-9748-ea68e9ec3fad\tnone\tswap\tsw\t0\t0\n\n# \/dev\/mapper\/airvideovg2-airvideo \/mnt\/airvideo ext4 rw,noatime 0 0\nUUID=9e78425c-c1f3-4285-9fa1-96cac9114c55 \/mnt\/airvideo ext4 rw,noatime 0 0\n\n<\/pre><\/div>\n\n\n<p>Noticed that I also added the LVM logical volume for <code>\/mnt\/airvideo<\/code>, which is my RAID-1 array. The <code>UUID<\/code> can be obtained by the <code>blkid<\/code> command. Below is a sample output:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code smallFont\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n% blkid\n\/dev\/sdf1: UUID=&quot;60024298-9915-3ad8-ae6c-ed7adc98ee62&quot; UUID_SUB=&quot;fe08d23c-8e11-e02b-63f9-1bb806046db7&quot; LABEL=&quot;avs:4&quot; TYPE=&quot;linux_raid_member&quot; PARTLABEL=&quot;primary&quot; PARTUUID=&quot;552bdff7-182f-40f0-a378-844fdb549f07&quot;\n\/dev\/nvme0n1p1: UUID=&quot;r2rLMD-BEnc-wcza-yvro-chkB-1vB6-6Jtzgz&quot; TYPE=&quot;LVM2_member&quot; PARTLABEL=&quot;primary&quot; PARTUUID=&quot;6c85af69-19a0-4720-9588-808bc0d818f7&quot;\n\/dev\/sdd1: UUID=&quot;34c6a19f-98ea-0188-bb3f-a5f5c3be238d&quot; UUID_SUB=&quot;4174d106-cae4-d934-3ed4-5057531acb3c&quot; LABEL=&quot;avs:3&quot; TYPE=&quot;linux_raid_member&quot; PARTLABEL=&quot;primary&quot; PARTUUID=&quot;2fc4e9ad-be4b-48aa-8115-f32472e61005&quot;\n\/dev\/sdb1: UUID=&quot;ac438ac6-344a-656b-387f-017036b0fafa&quot; UUID_SUB=&quot;0924dc67-cd3f-dec5-1814-ab46ebdf2fbe&quot; LABEL=&quot;avs:1&quot; TYPE=&quot;linux_raid_member&quot; PARTUUID=&quot;29e7cfce-9e7b-4067-a0ca-453b39e0bd3d&quot;\n\/dev\/md4: UUID=&quot;gjbtdL-homY-wyRG-rUBw-lFgm-t0vZ-Gi8gSz&quot; TYPE=&quot;LVM2_member&quot;\n\/dev\/md2: UUID=&quot;0Nky5e-52t6-b1uZ-GAIl-4Ior-XWTz-wFpHh1&quot; TYPE=&quot;LVM2_member&quot;\n\/dev\/sdi1: UUID=&quot;5b483ac2-5b7f-4951-84b2-08adc602f705&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot; PARTLABEL=&quot;data&quot; PARTUUID=&quot;e0515517-9fbb-4d8a-88ad-674622f20e00&quot;\n\/dev\/sdg1: UUID=&quot;3d1afb64-8785-74e6-f9be-b68600eebdd5&quot; UUID_SUB=&quot;c146cd05-8ee8-5804-b921-6d87cdd4a092&quot; LABEL=&quot;avs:2&quot; TYPE=&quot;linux_raid_member&quot; PARTLABEL=&quot;lvm&quot; PARTUUID=&quot;2f25ec17-83c4-4c0b-8653-600283d58109&quot;\n\/dev\/sde1: UUID=&quot;34c6a19f-98ea-0188-bb3f-a5f5c3be238d&quot; UUID_SUB=&quot;8aabfe5b-af16-6e07-17c2-3f3ceb1514e3&quot; LABEL=&quot;avs:3&quot; TYPE=&quot;linux_raid_member&quot; PARTLABEL=&quot;primary&quot; PARTUUID=&quot;2fc4e9ad-be4b-48aa-8115-f32472e61005&quot;\n\/dev\/sdc1: UUID=&quot;ac438ac6-344a-656b-387f-017036b0fafa&quot; UUID_SUB=&quot;c188f680-01a8-d5b2-f8bc-9f1cc1fc3598&quot; LABEL=&quot;avs:1&quot; TYPE=&quot;linux_raid_member&quot; PARTUUID=&quot;29e7cfce-9e7b-4067-a0ca-453b39e0bd3d&quot;\n\/dev\/nvme1n1p2: UUID=&quot;fc939be4-5292-4252-8120-7ef59b177e5b&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot; PARTUUID=&quot;912e805d-fe68-48f8-b845-9bba0e3e8c78&quot;\n\/dev\/nvme1n1p3: UUID=&quot;512d611e-6944-4a57-9748-ea68e9ec3fad&quot; TYPE=&quot;swap&quot; PARTLABEL=&quot;swap&quot; PARTUUID=&quot;04ac46ff-74f3-499a-814d-32082f6596d2&quot;\n\/dev\/nvme1n1p1: UUID=&quot;5187-A8C6&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;vfat&quot; PARTUUID=&quot;fe91a6b2-9cd3-46af-813a-b053a181af52&quot;\n\/dev\/sda1: UUID=&quot;3d1afb64-8785-74e6-f9be-b68600eebdd5&quot; UUID_SUB=&quot;87fe80a1-4a79-67f3-273e-949e577dd5ee&quot; LABEL=&quot;avs:2&quot; TYPE=&quot;linux_raid_member&quot; PARTUUID=&quot;c8dce45e-5134-4957-aee9-769fa9d11d1f&quot;\n\/dev\/md3: UUID=&quot;XEJI0m-PEmZ-VFiI-o4h0-bnQc-Y3Be-3QHB9n&quot; TYPE=&quot;LVM2_member&quot;\n\/dev\/md1: UUID=&quot;usz0sA-yO01-tlPL-12j2-2C5r-Ukhc-9RLCaX&quot; TYPE=&quot;LVM2_member&quot;\n\/dev\/mapper\/airvideovg2-airvideo: UUID=&quot;9e78425c-c1f3-4285-9fa1-96cac9114c55&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot;\n\/dev\/sdh1: UUID=&quot;60024298-9915-3ad8-ae6c-ed7adc98ee62&quot; UUID_SUB=&quot;a1291844-6587-78b0-fcd1-65bc367068e5&quot; LABEL=&quot;avs:4&quot; TYPE=&quot;linux_raid_member&quot; PARTLABEL=&quot;primary&quot; PARTUUID=&quot;ed0274b9-21dc-49bf-bdda-566b2727ddc2&quot;\n\n<\/pre><\/div>\n\n\n<p><strong>Step 4B (Potentially)<\/strong>: If the system boots in the &#8220;<code>grub&gt;<\/code>&#8221; prompt, then we will have persuade grub to manually boot by providing the following at the prompt:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>grub&gt; set root=(hd9,gpt2)\ngrub&gt; linux \/boot\/vmlinuz root=\/dev\/nvme1n1p2\ngrub&gt; initrd \/boot\/initrd.img\ngrub&gt; boot<\/code><\/pre>\n\n\n\n<p>To find the <code>root<\/code> value on the first line, you have use the <code>ls<\/code> command which is explained in this <a rel=\"noreferrer noopener\" href=\"https:\/\/www.linuxfoundation.org\/blog\/blog\/classic-sysadmin-how-to-rescue-a-non-booting-grub-2-on-linux\" target=\"_blank\">article<\/a>. The <code>root<\/code> parameter on the <code>linux<\/code> line references the partition which the root directory is mounted. In my case, it was <code>\/dev\/nvme1n1p2<\/code>.<\/p>\n\n\n\n<p>After I rebooted, I reinstalled GRUB with the following as super user:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>grub-install \/dev\/nvme1n1<\/code><\/pre>\n\n\n\n<p>It may also be required to update our <code>initramfs<\/code> using:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>update-initramfs -c -k all<\/code><\/pre>\n\n\n\n<p><strong>Step 5<\/strong>: At this point the system should reboot and all of the old server&#8217;s content should now be on the old hardware. Unfortunately we will need to fix the network interface. <\/p>\n\n\n\n<p>First obtain the MAC address of the network interface using:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><strong>% <\/strong>sudo lshw -C network | grep serial&nbsp;&nbsp; \n&nbsp; &nbsp; <strong>serial<\/strong>: 04:42:1a:05:d3:c4<\/code><\/pre>\n\n\n\n<p>And then we will have to edit the <code>\/etc\/netplan\/00-installer-config.yaml<\/code> file.<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>% cat \/etc\/netplan\/00-installer-config.yaml \n# This is the network config written by 'subiquity'\nnetwork:\n  ethernets:\n    enp6s0:\n      dhcp4: true\n      match:\n        macaddress: 04:42:1a:05:d3:c4\n      set-name: enp6s0\n  version: 2<\/code><\/pre>\n\n\n\n<p>Ensuring the MAC address matches from <code>lshw<\/code> and that the name is the same as the old system. The name in this example is <code>enp6s0<\/code>. We then need to execute the following commands to generate the interface.<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>netplan generate\nnetplan apply<\/code><\/pre>\n\n\n\n<p>We need to ensure the name matches because many services on the server have configurations that references the interface name, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configurations in <code>\/var\/network\/interfaces<\/code><\/li>\n\n\n\n<li>Samba (SMB) (<code>\/etc\/samba\/smb.conf<\/code>)<\/li>\n\n\n\n<li>Pihole (<code>\/etc\/pihole\/setupVars.conf<\/code>)<\/li>\n\n\n\n<li>Homebridge (<code>\/var\/lib\/homebridge\/config.json<\/code>)<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 6<\/strong>: Fix the router provisioning DHCP IP addresses so that the new server has the same fixed IP address as the old server. This is important because there may be firewall rules referencing this IP address directly. The hostname should have been automatically restored when we restored the partition in Step 3.<\/p>\n\n\n\n<p><strong>Step 7<\/strong>: Our final step is to test the various services and ensure they are working properly. These include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mail<\/li>\n\n\n\n<li>Our web site lufamily.ca<\/li>\n\n\n\n<li>Homebridge<\/li>\n\n\n\n<li>Plex<\/li>\n\n\n\n<li>Pihole (DNS server)<\/li>\n\n\n\n<li>SMB (File sharing)<\/li>\n<\/ul>\n\n\n\n<p>Finally the new system is completed!<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-scaled.jpeg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"961\" src=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-1024x961.jpeg\" alt=\"\" class=\"wp-image-1928\" srcset=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-1024x961.jpeg 1024w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-300x282.jpeg 300w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-768x721.jpeg 768w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-1536x1442.jpeg 1536w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/11\/IMG_6913-2048x1922.jpeg 2048w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><figcaption class=\"wp-element-caption\">New system all up and running!<\/figcaption><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Part 1 In the first part of this post, I talked about making sure all the new hardware that I recently purchased works. Yesterday, upgrading from Ubuntu 20.04 LTS to 22.04 LTS was super simple. Unfortunately, that was the end of the easy part. I thought I could just image by old boot drive and &hellip; <a href=\"https:\/\/blog.lufamily.ca\/kang\/2022\/11\/30\/media-server-upgrade-2022-part-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Media Server Upgrade 2022 (Part 2)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"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":[111],"tags":[5,98,28,6],"class_list":["post-1904","post","type-post","status-publish","format-standard","hentry","category-tech","tag-nas","tag-tech","tag-technology","tag-ubuntu"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7V6i8-uI","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/comments?post=1904"}],"version-history":[{"count":23,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1904\/revisions"}],"predecessor-version":[{"id":1974,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1904\/revisions\/1974"}],"wp:attachment":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media?parent=1904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/categories?post=1904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/tags?post=1904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}