|Samsung 860 PRO SSD|
I've been contemplating upgrading my Xubuntu boot drive for quite some time. It was still running on the original 250GB HDD that I bought back in 2010, and from my experience that is quite a long time to trust a single hard drive. Plus, Samsung just released the 860 Pro SSD which I got a pretty good deal on. The SSD should allow the OS to run a bit snappier and boot time will be quicker.
I did some research to find out what all I needed to do in order to move 250GB HDD to a 500GB SSD. All signs pointed to Clonezilla, so that's the route I took. I started out by installing Multiboot in Xubuntu so that I could create a bootable USB stick with both Clonezilla on it, as well as a copy of Xubuntu 16.10 just in case I screwed things up and needed to get in to edit fstab or grub.
Installing and using Multiboot is fairly simple. Download it from the website, run the .sh install file, and it creates a new menu item for itself under Accessories. Once open, point it to your USB stick on which Grub and your multiple ISOs will be installed, and then drag over the ISOs into the window (supposedly). Note, drag-and-drop did not work for me, but it has a file finder option that worked just fine. It will prompt for password, and then run the copy operation in a small terminal window. The first time around I became impatient because the process was at 100% for about 10 minutes, so I just closed the window. When I tested it, the Grub menu didn't have any bootable options. I then formatted the USB stick, dropped the image back into it, and then just let it do it's thing for a while. I think Xubuntu took about 15 minutes to finish, and Clonezilla was only about 5, at which point it takes you back to the main Multiboot screen. From there, click the Boot tab at the top and test the USB drive. If it tests properly in the VM, you are ready to shutdown your machine and install the new drive.
Like I said previously, I purchased the Samsung 500GB 860 Pro SSD. I also purchased an IcyDock Flex-Fit Trio cage for it, which can fit 2x2.5" and 1x3.5" drive simultaneously into a 5.25" (ie CD drive size) slot. This works out great because I've filled my media server hard drive slots (8 total!), but have plenty 5.25" slots remaining.
|IcyDock Flex-Fit Trio|
If I wanted to copy my existing hard drive to an image on a USB drive for backup purposes, I would have used the first option.
Next, I chose my 250GB drive as the source disk. NOTE: The drive naming that was used by Clonezilla differed from that of the normal OS. For example, my /dev/sde hard drive contained sde1 (swap) and sde2 (/). Clonezilla named it sda, so just look for the serial number of the correct hard drive if you are unsure.
Next step was to choose the new SSD as the target. After that, since I selected Advanced mode, I was presented with some options. I actually left them all as default, because it already had the -r flag to resize the partition. On the final screen before, I chose to partition proportionally. Since I am moving up in size, this allows the entire 512GB to be utilized. I've read that if your /swap is at the end of your drive on the old HDD, the new SSD would not be able to be larger than the end of your /boot, but I didn't do too much research on it once I read about the partition proportionally magic that Clonezilla does. I think it's option k1, but don't quote me...
Finally, it asks for confirmation two times, just in case the target volume was selected incorrectly (it wipes the entire drive!). And then the actual cloning process took about 20 minutes, which is impressively fast I think.
Now, I did run into issues. I left my old drive and new drive both plugged in when I rebooted. Once in the OS, I noticed that it's still running on the old drive. So, I checked my BIOS boot order, and ensured that it was changed to boot from the Samsung. Then I shut the computer down, unplugged the original drive, then tried to boot. Nothing. This is why I put Xubuntu on the thumb drive, I have a feeling some fstab editing will be happening soon...
After some research, I booted back into Clonezilla and chose "Super Grub2 Disk." From there, select "Detect any Operating System," and then the latest Linux kernel (usually the top in the list). Allow it to boot into your normal environment (wow SSDs are fast!!). After this, I did a couple things. First, I ran update-grub and tried to reboot. Still nothing. Then I installed and ran Boot Repair, with the following options:
Unhide boot menu 10 seconds
OS to boot by default sdd2 (The OS now in use...)
Place GRUB into sdd
Place the boot flag on sdd2 (The OS now in use...)
Applied those settings and got "GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again. Alternatively, you can retry after activating the [Separate /boot/efi partition:] option.
So, I rebooted into my Xubuntu live install (usb stick), and ran Gparted; however, I cannot reliably resize the /boot partition to add a 1MB partition with a bios_grub flag - it warns of the potential of losing data. I then booted back into the live Xubuntu and ran the same Boot Repair installation - which warned of conflicts with my RAID, so I had to install mdadm - and then selected these options:
Use the standard EFI file
Unhide boot menu 10 seconds
Separate /boot/efi partition: sdd2
Purge GRUB before reinstalling it
Place the boot flag on sdd2
(unchecked the defaults at the bottom to create pastebins and BootInfo summary, etc.)
Now then, after attempting I get: "The current session is in Legacy mode. Please reboot the computer, and use this software in an EFI session. This will enable this feature. For example, use a live-USB of Boot-Repair-Disk-64bit (url), after making sure your BIOS is set up to boot USB in EFI mode."
I enabled UEFI mode in my BIOS (it was previous disabled), and attempted to boot back into the live USB, however apparently I can't boot to the USB when UEFI is enabled, so I disabled UEFI boot, went back into Xubuntu live on the USB, bit the bullet, and resized my partitions (hey, I have a backup already - the original disk!).
Using GParted, I moved the /swap partition (beginning of the drive) up by 1MB at the start, created a new partition (/dev/sdd3) as an ext4, gave it the grub flag, and then committed changes. I then ran the boot-repair utility again, this time with more success. I did have to finagle it a bit to remove the old grub(s) and reinstall the new one, but it finally got to a point where it could recognize my /boot/vmlinuz... and then: "Boot successfully repaired. You can now reboot your computer. Please do not forget to make your BIOS boot on sdd (ATA Samsung SSD 860) disk!" Thanks, boot-repair, that's fantastic news.
Now, off to testing for that corrupted operating system...