Copying my Manjaro install from the HDD to USB

HDD says its on it last legs. On boot, prior to ANYTHING booting I’m presented with a warning screen showing hardware specs and a message, “Hard disk failure is imminent”. Spooky.

Maybe only a noob would ask but I basically need to copy my Manjaro install from the HDD to USB. And to be able to run it on the USB, if the HDD does fail.

The HDD has:

  • an encrypted partition (luks), and
  • swap space.

The USB drive is bigger than the HDD and the only difference that I want to make on this bigger USB disk is keep the swap space at the very end of the disk? Its an SSD so I’m only conerned with wear and tear not head movements. This will result in Unallocated Space between the encrypted partition and the swap space partition.

Will ‘gparted’ do it all? I’m booting from a Manjaro DVD as we speak. Are there are tricks to this. I think because there is no topic in these forums about doing this I’m a bit worried about messing it all up. :slight_smile:

Maybe there are no topics because everyone has an easy time. :upside_down_face:

After I’m done of course I will need to set the boot order in the BIOS to be the USB first. But yeah, its the gparted part that I’m not sure about. Will the ‘Copy’ function in gparted become active when I open the USB from the box and plug it in for example. Currently the Copy function is disabled, grayed out etc.

Thanks in advance again.

Duplicating your operating system is not that easy using a few clicks, it involves manual edits.
Yes there is no tutorial yet that covers it step by step AFAIK, although some come close…

Thanks for the prompt responce.

Well so long as instructions are able to be followed by someone with some computer knowledge, I’m willing to give them a chance. Maybe my web search abilities are off because I couldn’t find anyone doing precisely this.

That’s because it’s mounted. Once it’s unmounted it should be ok.

Replaced my mbp hard drive (gpt uefi, partitions fat and ext4) with ssd like this:

  • booted a live usb stick, connected new ssd in usb enclosure to usb port
  • started gparted, picked new ssd >> new file system >> gpt
  • copied efi partition from hdd to ssd
  • copied all other partitions (from left to right) to ssd then shut down
  • replaced hdd with ssd in internal drive bay
  • booted live usb, chrooted into manjaro, reinstalled grub
  • rebooted, there were no errors

This may take a while; stay at the machine and make sure your live usb system has all power save or sleep options set to off.

Thanks @6x12 for your detailed response. I don’t have great internet where I am, but will try to document how it goes so other people like me can follow.

I tried unmounting with sudo umount /dev/sdXX (where XX specifies the disk and partition) but umount responded, “not mounted”.

Running lsblk --fs seems to show everything as normal. The UUID matched etc.

Then I realized maybe the partition needed to be unencrypted first, so I tried that from the right-click menu in gparted.

Boom, the ‘Copy’ option is available now. :slight_smile:

I’m assuming that if I can only copy after unencrypting, then I’ll get a new UUID on the new USB drive? Is it possible to copy the partition without opening the encryption, or is that deemed bad practice, bad for security, or impossible due to some hardware-related aspect?

It would be nice to keep the UUID but its no problem if that’s impossible.

With the method outlined above you’ll get a different uuid, hence the need to reinstall grub. An advantage is that you can resize partitions once you copied them to the new drive (if eg the target drive is smaller then the source) and that you can later on boot/run with both drives attached at the same time.
If the unchanged uuid is important to you you may consider a cloning tool like clonezilla but I can’t help you with that.

Good to know, that’s why I said “gpt uefi, partitions fat and ext4”; so my setup was all rather basic. If the copying can or should be done encrypted or not I do not know, you decide your thread level, I keep things on my machines very simple. Also, my hdd hadn’t shown as damaged, another thing to keep in mind.

I’m pleased to report that your recommendation to use clonezilla to perform an exact copy of the disk appears to be a success (at least according to clonezilla, I’ve not yet tried to boot from the copy :slight_smile: )

For others who choose to use clonezilla in this situation I recommend entering the slightly more advanced options and using the -rescue option. Rescue means that it will ttry its best to copy and will not stop if it encounters a bad sector on the disk.

Also be patient. :slight_smile:

1 Like

I tried to boot the partition but I think only copying the LUKS-encrypted ext4 was a mistake and I also need to have the fat32 boot partition (300Mb) and the LUKS-encrypted ‘swap’ partition.

Now… does it matter where I place those partitions on the disk? Also does one need to expressly clone those exact partitions or is there some command that can assess the type of partitions that are missing and recreate new ones for it?

I have a feeling the former is the correct approach yes? Unless I want to get down and dirty with the ‘fstab’ file on the disk? But maybe I’m wrong.

If someone would be so kind as to point me in the right direction here that would be sweet. A search is showing some complex solutions that I’m unsure I really need. I’m a novice so instructions that speak to my naivety would be great.

Hi it has been a while. Basically I was attacked by a crime gang and I’m not getting justice. At this point I’m ready to support the ACAB hypothesis in my city because criminals seem to be protected. Anyway, I could not devote time to fixing this.

Now the disk is in worse shape, can’t load manjaro at all now. I did make that exact copy of the partition but I don’t know how to find the 300Mb boot partition, I just can’t see it.

GParted hangs at ‘Searching /dev/sda partitions’ and errors out (old version of GParted from 2019 maybe I should try a new version).

lsblk doesn’t seem to list the 300 mb boot partition at all. As stated in the opening, only the encrypted LUKS partition (sda1) and SWAP space (sda2) are visible.

Should I try a newer version of GParted or is there something very basic I need to do?