
A Step Taken Wrong
As someone who's fairly new to the Linux ecosystem, I recently found myself in quite a predicament while trying to get Kubuntu installed on my NVME drive. You see, I have my Windows installation in my NVME M.2 SSD, and Kubuntu on a SATA SSD. I thought that I could just clone the Kubuntu drives from the SATA SSD into NVME SSD, and everything would work. Long story short, it did not, and in the process of trying to get it to work, I accidentally destroyed the MBR and the boot partition for Windows.
Okay, well, I would like to restore my Windows to a working state. But before that, I would like to make a backup of it, and so I decided to clone the partition. Since I only have Kubuntu I decided to look up online for ways that one use to clone a partition in Linux.
Option 1 - dd
This is a very powerful tool. It does raw sector-to-sector copy, which can be very fast if paired with a higher block-size (of around 64K). However, with great power comes great responsibility. For one, dd works on the drive sectors, and has no way of knowing if a sector is a valid file system or not citation needed . For that reason, if an error occurs, the entire block will not be written, and be replaced with 0 instead. This can happen even if only a small 512 byte sector bugs out. On top of that, being such a powerful tool, a simple mistake %% link to superuser post %% can lead to disaster, and there are no short cases of it. For that reason, I won't be using this tool.
Option 2 - clonezilla
An alternative usually recommended is clonezilla. It is a live bootable ISO that performs disk/partition cloning or imaging. This is more user-friendly (we are comparing to dd here), as it asks for more questions which reduces chance of a user-error. With all that said, I decided to try it out.
Here's a problem, though.
I don't have a lot of spare USB sticks left. In case of a disaster, I would like to retain the ability to boot into Kubuntu. This made me think: What if i could boot into both Kubuntu or Clonezilla? Well, Ventoy might just have the answer for that.
Ventoy is a tool that allows us to boot into multiple ISO files directly without requiring us to flash it over and over again. This not only save us time, but also space, as we can have 1 USB that serves multiple ISO at the same time. Knowing that, I installed it in my USB drive, and added clonezilla along with kubuntu's ISO. After ensuing that the kunbutu ISO works, I booted into clonezilla and performed the partition to partition copy. However....
Things didn't go smoothly
I am facing a problem where clonezilla would not properly start the cloning process. I would choose the settings, confirm (twice) on the drive that I want to copy over to, and then it would just, not work. Checking the logs revealed that it could not load something.
The directory for this inputted image name does NOT exist: /tmp/d2d-pseudo-<something>
Program terminated!!!!
Okay, that's fine, let's look that up to see how could I resolve this problem. Well, little did I know, there are not much details on why this problem occurs. After hacking around for quite some time, I got frustrated and decided to stop and look for other options. I was around here that I stumble upon 1 line of message that ultimately made me asks a very basic question.
Option 3 - gparted
One post, somewhere (I did not jot it down, sorry) said something along the lines of you can just copy the partition over in a forum post talking aboutgparted. I did not know that! I immediately tried starting the app up, copied over my nvme partition and paste onto my hard disk, and what you do know, not only it copy over the partition size, it also copied the content.
Welp, that solves the problem. I feel a bit frustrated, because I spent a whole lot of hours tinkering with different tools and stuff, and I did not realize that the partition tool I've been using to resize, and move partition around, had such a feature.
On disk/partition cloning guides, I don't see much that recommends using gparted, which is why I never considered it in the first place. It's wild.
The Next Steps
In the next upcoming blog post, I will talk about restoring the boot record of a Windows system, and the amount of hoops I had to jump through to get it to work. It involves converting MBR to GPT, regenerating boot record, and more.