Restore Manjaro to external drive using live cd

So I’ve been having some trouble with my Manjaro installation, and have, after trying multiple solutions with none working, decided to instead try to make a complete backup and restore from that backup. However, since I am not able to enter my Manjaro installation, I have to do this from my live cd. I have an external drive which I intend to copy the backup to, but I don’t know how to do this. I would prefer for the backup to be complete with all settings and everything, not just the files.

I have used chroot and am able to access my files through that, but don’t know how to make a backup in this way. Any help?

If you are on a live environment i would suggest to create a image of you drive which can be mounted with manjaro afterwards. (No chroot needed)

check which partitions are there:

lsblk

then

dd if=/dev/sda1 of=/path/to/the/sda1-Image.img status=progress

Do it with every important partition: /dev/sda1 …sda2 … sda3

You can mount the image afterwards with:

mount /path/to/sda1-Image.img /mnt

or with your favorite file manager on linux.

How do I know which partitions are important? My partitions are named something along the lines of nvme0np2, with the one ending in 8 being my main Manjaro partition

Since you have problems with the install - I guess the system is wrecked and it makes no sense to restore a wrecked system.

So - if I understand you correct - your real target for the backup is your configurations and user data - everything that cannot be trivially restored by packages.

This would be

  • /etc
  • /home/$USER

If you provide the output of

lsblk -o PATH,NAME,PTTYPE,FSTYPE,FSSIZE

We will be able to deduct the important partition - the partition holding the data from Manjaro.

Using a live ISO and an external storage location (disk/USB/network) we can

  • Mount the partition.
  • Backup the mentioned folders.

With your data backed up you can proceed whichever path you like.

Here is the output:

PATH           NAME        PTTYPE FSTYPE   FSSIZE
/dev/loop0     loop0              squashfs    65M
/dev/loop1     loop1              squashfs   603M
/dev/loop2     loop2              squashfs   1.3G
/dev/loop3     loop3              squashfs 596.3M
/dev/sda       sda         dos    iso9660  
/dev/sda1      ├─sda1      dos    iso9660    2.6G
/dev/sda2      └─sda2      dos    vfat     
/dev/nvme0n1   nvme0n1     gpt             
/dev/nvme0n1p1 ├─nvme0n1p1 gpt    vfat     
/dev/nvme0n1p2 ├─nvme0n1p2 gpt             
/dev/nvme0n1p3 ├─nvme0n1p3 gpt    ntfs     
/dev/nvme0n1p4 ├─nvme0n1p4 gpt    ntfs     
/dev/nvme0n1p5 ├─nvme0n1p5 gpt    ntfs     
/dev/nvme0n1p6 ├─nvme0n1p6 gpt    ntfs     
/dev/nvme0n1p8 ├─nvme0n1p8 gpt    ext4     
/dev/nvme0n1p9 └─nvme0n1p9 gpt    swap

In this case there is only one Linux filesystem - it is fair to say this is the important partition with relation to Manjaro.

Proceed to create two temporary mount points in the live user home

mkdir ~/root
mkdir ~/usb

Mount the partition nvme0n1p8 temporarily

sudo mount /dev/nvme0n1p8 ~/root

Attach your external disk and repeat above command to identify the external disk

When you have identified the external disk - mount the disk’s storage partition e.g. /dev/sdy1 - ensure there is enough space to hold your uncompressed data.

sudo mount /dev/sdy1 ~/usb

Create a folder to hold your backup the**$(date +"%Y%m%d%H%M")** will be a timestamp

Create a variable with a timestamp

timestamp=$(date +"%Y%m%d%H%M")

Create the backup folder

mkdir ~/usb/backup-$timestamp

Use rsync -a to backup /etc to the storage device (files readable only by root will only be copied if run as root).

The -a flag stands for “archive” and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.

rsync -a ~/root/etc ~/usb/backup-$timestamp

List the content of the root/home to identify the username e.g. fido

$ ls ~/root/home
fido

Use rsync to backup the home folder e.g. fido

rsync -a ~/root/fido ~/usb/backup-$timestamp

Verify the content of your backup - and when satisfied - do what you gotta do.

I did exactly as you said, and it seems to have worked so far. However, there is one problem: when in my new Manjaro installation, I am unable to replace my old etc directory with the one from the backup. Whenever I try this, the installation stops working along with everything else, and I have to reinstall Manjaro completely. Is there any workaround to this?

Also, copying over my home directory from the external drive seems to take absolutely forever. Am I doing something wrong there?

As you don’t know what exactly wrecked your previous installation - be selective - take it steps at a time - then you will know what went wrong - and learn something from it.

Especially with /etc - unless you have manually edited configurations - you rarely have the need to restore /etc - concentrate on your personal files.

So I recently had to reinstall Manjaro, but first did a backup of my home and etc directories. However, when I try to replace my etc directory with the one from the backup, everything on my computer stops working and I have to reinstall Manjaro again. Are there any solutions to this or anything that I am doing wrong?

Also, it seems to take a reeeally long time to copy over my home directory from my external drive. Am I doing something wrong here?

So I recently had to reinstall Manjaro, but first did a backup of my home and etc directories. However, when I try to replace my etc directory with the one from the backup, everything on my computer stops working and I have to reinstall Manjaro again. Are there any solutions to this or anything that I am doing wrong?

Also, it seems to take a reeeally long time to copy over my home directory from my external drive. Am I doing something wrong here?

I’m afraid there are so many variables and unknowns in your story that it’s impossible for anyone to properly assess the situation. :thinking:

  • Why did you need to reinstall Manjaro?
  • How did you create the backups of /etc and /home?
  • What filesystem is on that external drive?
  • How did you restore those backups?
  • What kind of computer are we talking about here?
    – CPU
    – RAM
    – desktop or laptop?
    – UEFI boot or legacy boot?
    – partition table
    – …

Always remember that the quality of the help you’ll get here depends on the quality of the information you provide. :man_shrugging:

My manjaro suddenly crached, likely because of a Windows update, so I booted into a live cd and created the backups using rsync.

I am unaware of what filesystem the external drive uses.

When restoring the backups I tried to simply copy and paste, but this did not work. Is there a better solution?

I have a Dell XPS 13 from 2018

I don’t see how that could be possible.

Are you serious? :astonished:

In that case, I suspect that it’s an NTFS filesystem, which means that the POSIX permissions and file ownership won’t have been carried over, because NTFS does not support those.

And then there’s your problem: those backups are now useless, because getting those permissions right is important.

First of all, you cannot simply use copy/paste to restore a directory like /etc ─ you need to do that from the command line, as root ─ and secondly, given that the permissions are likely wrong, you cannot use that backup anymore.

I would advise reinstalling, and only use the copy/paste for the files in your $HOME. Better leave /etc alone. :man_shrugging:

Well then what command am I supposed to use? You seem convinced it won’t work, but I believe it is worth a shot.

The exact command depends on the tool you choose to use. You could do it with cp, you could do it with tar or you could do it with rsync. But it doesn’t matter because you won’t get the permissions right when copying back something from NTFS ─ not unless you really know what you’re doing, and no offense, you don’t seem to. You didn’t even know what filesystem is on your external drive.

GNU/Linux is not Windows, and thinking in terms of Windows logic does not work in GNU/Linux.

If you want to stick to simple things like web browsing and email, then you can use the same methodology as in Windows, but if it comes to system maintenance and/or customization, then you cannot, because Windows builds upon the logic of MS-DOS (and partly OS/2), while GNU/Linux is a UNIX-family operating system.

It is probably going to be a lot easier to just modify the files in the post-install /etc than to try copying back an /etc that may have been responsible for your crash in the first place ─ we don’t know that, because we don’t know what the symptoms were or what triggered it.

1 Like