{"id":549,"date":"2014-06-16T23:15:04","date_gmt":"2014-06-17T03:15:04","guid":{"rendered":"http:\/\/blog.fritzhardy.com\/?p=549"},"modified":"2014-06-22T12:50:41","modified_gmt":"2014-06-22T16:50:41","slug":"fedora-linux-hardware-migration","status":"publish","type":"post","link":"https:\/\/blog.fritzhardy.com\/?p=549","title":{"rendered":"Fedora Linux Migration Part 1: Hardware Migration"},"content":{"rendered":"<p>My ten year <a href=\"https:\/\/blog.fritzhardy.com\/?p=27\">Fedora upgrade streak<\/a>, now at 20, is still running on hardware that is nearly as old and I thought it time to move the install to a (slightly) newer laptop that I am using more frequently.  This will involve a number of storage operations and system re-configuration, new concerns such as encryption, and more to come.  Cloning an install and re-fashioning it in such a way will indeed be more work than a fresh install and copy, but imposes some interesting obstacles to work around, and remains within the spirit of maintaining a legacy install.<\/p>\n<p>Here in part one, we concentrate on merely getting the system onto a new drive, and booting the new hardware.  This will merge the data from two drives in its current desktop environment, to a single new laptop drive.  What follows assumes that cloning, partitioning, and LVM operations are conducted with the old and new storage accessed from a Linux system in an offline manner.  Single or rescue mode are not required as long as we can access the block devices, perhaps connected as secondary PATA\/SATA or USB drives.  In no case should they be mounted anywhere.<\/p>\n<p><strong>Dump the Drive Images<\/strong><\/p>\n<p>There are certainly more exotic tools for disk cloning, but let us stick to the good old UNIX standby &#8216;dd.&#8217;  We can be tricky and dd over a network pipe directly to a destination drive, but with storage available (in this case external USB mounted at \/storage), we get a safe offline copy\/backup of the original drives:<\/p>\n<pre>\r\ndd if=\/dev\/sda of=\/storage\/fritzdesk_sda\r\ndd if=\/dev\/sdb of=\/storage\/fritzdesk_sdb\r\n<\/pre>\n<p>The partition info on sda, revealing our \/boot and \/ partitions:<\/p>\n<pre>\r\nfdisk -l fritzdesk_sda\r\n\r\nDisk fritzdesk_sda: 37.3 GiB, 40037760000 bytes, 78198750 sectors\r\nUnits: sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0xa5cba5cb\r\n\r\nDevice Boot Start End Blocks Id System\r\nfritzdesk_sda1 * 63 619919 309928+ 83 Linux\r\nfritzdesk_sda2 619920 78185519 38782800 83 Linux\r\n<\/pre>\n<p>The partition info on sdb, revealing our LVM partition containing logical volumes for home and swap:<\/p>\n<pre>\r\nfdisk -l fritzdesk_sdb\r\n\r\nDisk fritzdesk_sdb: 74.5 GiB, 80026361856 bytes, 156301488 sectors\r\nUnits: sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0x59d50c69\r\n\r\nDevice Boot Start End Blocks Id System\r\nfritzdesk_sdb1 * 63 156296384 78148161 8e Linux LVM\r\n<\/pre>\n<p>Ultimately, we have this from our source system:<\/p>\n<pre>\r\n\/dev\/sda (40GB)\r\n     sda1: ext3 \/boot (300MB)\r\n     sda2: ext3 \/ (38GB)\r\n\/dev\/sdb (72GB)\r\n     sdb1: lvm Volume00 (72GB)\r\n          Volume00-home: ext3 \/home (70GB)\r\n          Volume00-swap: swap (2GB)\r\n<\/pre>\n<p><strong>Clone to the New Drive<\/strong><\/p>\n<p>We will combine the partitions from these two source drives into the new 150GB laptop drive.  No matter how the new drive is connected (direct PATA\/SATA or USB), we will assume the new drive is \/dev\/sdc for clarity.<\/p>\n<p>First a clone of sda, as that contains our MBR, boot, and root:<\/p>\n<pre>\r\ndd if=\/storage\/fritzdesk_sda of=\/dev\/sdc\r\n<\/pre>\n<p>Check partitions on the new drive:<\/p>\n<pre>\r\nfdisk -l \/dev\/sdc\r\nDisk \/dev\/sdc: 149.1 GiB, 160041885696 bytes, 312581808 sectors\r\nUnits: sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0xa5cba5cb\r\n\r\nDevice Boot Start End Blocks Id System\r\n\/dev\/sdc1 * 63 619919 309928+ 83 Linux\r\n\/dev\/sdc2 619920 78185519 38782800 83 Linux\r\n<\/pre>\n<p>We now need to create an LVM partition to hold the contents of sdb:<\/p>\n<pre>\r\nfdisk \/dev\/sdc\r\n<strong>n<\/strong>ew, <strong>p<\/strong>rimary, partition number <strong>3<\/strong>, first sector <strong>default<\/strong>, last sector <strong>default<\/strong>\r\n<strong>t<\/strong>ype, partition number <strong>3<\/strong>, <strong>8e<\/strong>\r\n<strong>w<\/strong>rite\r\n<\/pre>\n<p>Check partitions on the new drive:<\/p>\n<pre>\r\nfdisk -l \/dev\/sdc\r\n\r\nDisk \/dev\/sdc: 149.1 GiB, 160041885696 bytes, 312581808 sectors\r\nUnits: sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0xa5cba5cb\r\n\r\nDevice Boot Start End Blocks Id System\r\n\/dev\/sdc1 * 63 619919 309928+ 83 Linux\r\n\/dev\/sdc2 619920 78185519 38782800 83 Linux\r\n\/dev\/sdc3 78186496 312581807 117197656 8e Linux LVM\r\n<\/pre>\n<p>We are interested in the one LVM partition inside the fritzdesk_sdb image rather than the entire drive.  We must expose it with kpartx:<\/p>\n<pre>\r\nkpartx -av \/storage\/fritzdesk_sdb\r\nadd map loop0p1 (253:3): 0 156296322 linear \/dev\/loop0 63\r\n<\/pre>\n<p>Scan for the new LVM physical volume just exposed to ensure everything was found:<\/p>\n<pre>\r\npvscan\r\n  PV \/dev\/mapper\/loop0p1 VG Volume00 lvm2 [74.52 GiB \/ 3.52 GiB free]\r\n<\/pre>\n<p>NOTE: It is good practice to ensure unique VG names when doing system installs, lest a generic name like Volume00 collide with another, such as when used in this way on another system.  Luck is on our side.<\/p>\n<p>Clone the exposed source LVM partition to the new LVM partition, physical volume to physical volume:<\/p>\n<pre>\r\ndd if=\/dev\/mapper\/loop0p1 of=\/dev\/sdc3\r\n<\/pre>\n<p><strong>Claim New LVM PV Space<\/strong><\/p>\n<p>This last clone was of a smaller LVM partition image into a much larger LVM partition on the new drive.  We will want to claim that space for future LVM use.  The pvresize command will claim all space up to the partition or block device boundary (now further out) unless otherwise specified:<\/p>\n<pre>\r\npvresize \/dev\/sdc3\r\npvs\r\n  PV         VG       Fmt  Attr PSize   PFree\r\n  \/dev\/sdc3  Volume00 lvm2 a--  111.76g 40.76g\r\nvgs\r\n  VG       #PV #LV #SN Attr   VSize   VFree\r\n  Volume00   1   2   0 wz--n- 111.76g 40.76g\r\n<\/pre>\n<p>NOTE: This may need to be prefaced with a pvscan to find the physical volume.<\/p>\n<p>Now we have an additional 40.76GB in the LVM volume group to grow or create new logical volumes.<\/p>\n<p><strong>Boot the New Machine<\/strong><\/p>\n<p>At this point, we have directly cloned the system to a new drive with the fewest changes possible.  With that drive physically installed as the sole drive in the new system, we boot to ensure all pieces are present, troubleshooting any startup issues and checking things before introducing any more complexity.  For example, there is trouble starting X11, and a boot to single mode and check of the X11 logs indicates that there is a need to install xorg-x11-drv-intel.  Other minor issues involve installation of xorg-x11-drv-synaptics for full touchpad functionality.  Things of this nature are not surprising given a move to new hardware.<\/p>\n<p>We are left with this on the destination drive (now \/dev\/sda in-use in the new system):<\/p>\n<pre>\r\n\/dev\/sda (150GB)\r\n     sda1: ext3 \/boot (300MB)\r\n     sda2: ext3 \/ (38GB)\r\n     sda3: lvm Volume00 (112GB)\r\n          Volume00-home: ext3 \/home (70GB)\r\n          Volume00-swap: swap (2GB)\r\n          unallocated: (40GB)\r\n<\/pre>\n<p>Ultimately, a simple, successful clone of fritzdesk to fritzlap.  We have left some room to maneuver, which we will soon need.  In <a href=\"https:\/\/blog.fritzhardy.com\/?p=584\">part 2<\/a>, we will worry about encryption.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My ten year Fedora upgrade streak, now at 20, is still running on hardware that is nearly as old and I thought it time to move the install to a (slightly) newer laptop that I am using more frequently. This will involve a number of storage operations and system re-configuration, new concerns such as encryption, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-549","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/posts\/549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=549"}],"version-history":[{"count":48,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":630,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions\/630"}],"wp:attachment":[{"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fritzhardy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}