Moved to another disk

My computer began to warn me that the hard drive was starting to fail. I felt I needed an exact copy so I used clonezilla to move the partition to another device, a new USB SSD (2TB). I was not able to boot into the operating system with this clone. I didn’t install grub on the SSD, nor fstab, nor a bootloader (keep in mind I don’t really know how to do all that).

At any rate I could access the filesystem, for important files from this SSD copy quite easily, which was helpful, in terms of peace of mind.

I made a mistake to put it on that SSD however, and decided to copy it off that new SSD to a new HDD instead. Again I used clonezilla for this but this time I asked clonezilla to setup something “grub” in the hope that I might be able to boot too.

Booting would be helpful but its not a priority, the most important thing is that I have access to the data.

Yet, on this new HDD copy I’m not seeing the new HDD partitions in the file manager on my Manjaro at all, which I think is strange given that it can see other partitions on other devices without much issue.

Anyway when I try to boot the old computer with the new USB HDD I get:

error: attempt to read or write outside of disk `hd0'.
error: attempt to read or write outside of disk `hd0'.
error: attempt to read or write outside of disk `hd0'.

Press any key to continue...

Failed to boot both default and fallback entries

I was not able to copy all the information but it could be a couple issues, the failing disk with the same UUID is still in the computer (I have tried opening the computer up but it is a weird configuration inside and the hard drive must be behind the Bluray disk drive, lol. It could be that I have not also made a swap space, which I am working on fixing as a type this.

Anyway at some point unallocated space appeared INSIDE the luks encrypted drive when it was on the new SSD, that unallocated space also copied across to the new HDD. I wondered whether that was the cause. So I did some basic repair.

# To open the LUKS encryption
lsblk --fs   # to get 'x', 'y' and the UUID
sudo cryptsetup open /dev/sdxY luks-<UUID>

# To do the repair
export LANG=C
sudo dumpe2fs /dev/mapper/luks-<UUID> | grep -i superblock
sudo fsck -b <superblock-number-here> /dev/mapper/luks-<UUID>

This did some “shortening” and “narrowing” but didn’t fix the unallocated space inside the filesystem problem that (only) gPartEd seemed to care about. So I enlisted gPartEd to do its “Check” (read: Check and repair) that it was so wanting to do, and after a handful of short operations there were no more complaints about the unallocated space. Great. I try to boot with it (still no swap space) but same response.

I have just now finally looked at copying across the (useless?) swap space from the old failing drive. gPartEd took 30 minutes to load the three file systems on the one device but the swap space is now labelled as a black, ‘unknown’ file system, the ‘swap’ flag that I expected to see in the Flags column is missing also.

I think I know why there was “unallocated” space in the main partition, I must’ve miscalculated the size of the partition that I would need to make the clone. Its now 3% larger than the partition on the old failing drive, oh well. I notice that the ‘esp’ flag is not on the failing main partition either. I was lazy and noticed the ‘esp’ flag on a functioning Manjaro and flagged my most recent copy (that is not loading in the file manager with ‘esp’). Maybe that was a mistake?

Well woop-de-woo

I couldn’t remove the ‘esp’ flag on its own, I had to also remove the ‘boot’ flag too. And NOW I can see the partition/filesystem in the filemanager. Yay.

It would be nice to be able to boot into the filesystem, if only to finally have a successful documented case of someone doing that in these forums.

Is there a way to produce the needed encrypted swap partition, bootloader, fstab and whatever else needed? I tried from two laptops but they both just ignored the USB HDD despite it being higher in the boot order.

Someone in these forums mentioned a need to be connected to the internet to run ‘manjaro-chroot’, is it really not possible to do without the internet. I don’t need to repair the kernel anyway, do I?

I leave this little puzzle in the Manjaro community’s capable hands. Half my issue is solved just by taking the time to think about my assumptions in this indulgent post. So it might help someone anyway.

tldr: Half your solution might just be that incorrect ‘flags’ were added to the filesystem, you can see and edit the flags easily from gPartEd.

I did not read till the end, honestly. But generally speaking, after cloning a disk or partition, you will have to, at least:
The ESP and the boot entries, as well grub menu, has to be recreated

That is however, the second step. You will first have to open /etc/fstab from the live usb, without chrooting, and correct the UUIDs. You can see them from, for example, gparted.

If the encryption adds additional steps, i do not know.


Why does the tutorial not cover swap? Isn’t swap needed for hibernation functions? I will need to lookup how to do that with encryption yes.

This is all the stuff that goes into the small 1-32MB partition, yes? ‘ESP’ is not explained anywhere, I just double-checked my working manjaro and “boot,esp” is indeed for the what is mounted at /boot/efi. So that would explain how I botched that (see above OP).

Because I used Clonezilla the UUIDs don’t need changing, right? Only a potential UUID for a newly created swap space (that I don’t know how to do yet), yes? And for the ESP (aka /boot/efi) partition, which seems to have a weirdly short UUID (???)

Am I wrapping my head around all this correctly?

I have no experience with clonezilla - i do not know if it writes UUID on restore. You can easily check, launch a live usb session and gparted and note the UUIDs, then open /etc/fstab and, if you use hibernation, the UUID in the kernel parameter for the swap in /etc/default/grub and compare/correct it.

Again, i have no idea about the encryption. I think you will have to see /etc/crypttab too.

Thanks @Teo. I haven’t been able to do this yet, but hopefully soon.