{"id":256,"date":"2019-06-08T11:57:16","date_gmt":"2019-06-07T23:57:16","guid":{"rendered":"https:\/\/fishy.fisher.net.nz\/wordpress\/?page_id=256"},"modified":"2020-04-21T10:48:25","modified_gmt":"2020-04-20T22:48:25","slug":"copy-linux-hdd-to-ssd","status":"publish","type":"page","link":"https:\/\/fishy.fisher.net.nz\/?page_id=256","title":{"rendered":"Copy Linux HDD to SSD"},"content":{"rendered":"\n<p>This is how I did it:-<\/p>\n\n\n\n<p><strong>Note 1:<\/strong> If the PC is SFF you may not be able to have both HDD and SSD connected at the same time, in which case you need to first copy to a USB HDD then connect the new drive then copy to it.<\/p>\n\n\n\n<p><strong>Note 2: <\/strong>The target SSD needs to be partioned and formatted similar to the old HDD<\/p>\n\n\n\n<p>Boot with a Live CD or Live USB drive then<\/p>\n\n\n\n<p><code>sudo mkdir -p \/mnt\/{root1,root2,home1,home2}<\/code>     # Create the directories<br> or<br> <code>sudo mkdir -p \/mnt\/{root1,root2}<\/code>     # if no separate home partions<\/p>\n\n\n\n<p><code>sudo mount \/dev\/sda1 \/mnt\/root1\/ # mount the root partitions<br>sudo mount \/dev\/sdb1 \/mnt\/root2\/<\/code><\/p>\n\n\n\n<p><code>sudo mount \/dev\/sda2 \/mnt\/home1\/ # mount the home partitions<br>sudo mount \/dev\/sdb2 \/mnt\/home2\/<\/code><\/p>\n\n\n\n<p><code>sudo cp -a \/mnt\/root1\/. \/mnt\/root2\/<br>sudo cp -a \/mnt\/home1\/. \/mnt\/home2\/<\/code><\/p>\n\n\n\n<p>The copying process will take about 10 minutes or so to complete, depending on the size of it&#8217;s contents.<\/p>\n\n\n\n<p><strong>Install GRUB bootloader on the SSD<\/strong><\/p>\n\n\n\n<p><code>sudo mount -o bind \/dev\/ \/mnt\/root1\/dev\/<br>sudo mount -o bind \/dev\/pts\/ \/mnt\/root1\/dev\/pts\/ <br>sudo mount -o bind \/sys\/ \/mnt\/root1\/sys\/<br>sudo mount -o bind \/proc\/ \/mnt\/root1\/proc\/<\/code><\/p>\n\n\n\n<p><code>sudo chroot \/mnt\/root1\/<\/code><\/p>\n\n\n\n<p>After successfully chrooting to the SSD&#8217;s root partition, install GRUB.<br>(Make sure you select the correct drive &#8211; \/dev\/sdx)<br><code>grub-install \/dev\/sdb --boot-directory=\/boot\/ --target=i386-pc<\/code><\/p>\n\n\n\n<p>If GRUB is installed without any problem, then update the configuration file.<br> <code>update-grub<\/code><\/p>\n\n\n\n<p>These two commands above are to be run inside the chroot, and  don&#8217;t exit from the chroot now. <\/p>\n\n\n\n<p><strong>Update the fstab entry<\/strong><\/p>\n\n\n\n<p>Use the blkid command to know the proper UUID of the partitions.<\/p>\n\n\n\n<p>sudo nano \/etc\/fstab<\/p>\n\n\n\n<p><strong>Done. You should be able to shutdown then boot to the new SSD.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is how I did it:- Note 1: If the PC is SFF you may not be able to have both HDD and SSD connected at the same time, in which case you need to first copy to a USB HDD then connect the new drive then copy to it. Note 2: The target SSD [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-256","page","type-page","status-publish","hentry","post-preview"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/pages\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256"}],"version-history":[{"count":2,"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/pages\/256\/revisions"}],"predecessor-version":[{"id":387,"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=\/wp\/v2\/pages\/256\/revisions\/387"}],"wp:attachment":[{"href":"https:\/\/fishy.fisher.net.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}