Score:0

Restoring OS image after performing disk encryption

us flag

I have an Ubuntu 20.04 system which is already in use and requires to have its disk encrypted. I have reviewed some methods to perform encryption after installation. But the general suggestion has been that it is easier to backup data, perform a new installation and restore data. I do not have any issue backing up and restoring data in my /home. However, I have a system that does not work well with Linux and was difficult to setup. On top of that, I also have some libraries that can be tricky to install.

I am trying to see if the following steps will work:

  1. Create an image of the complete, current system.
  2. Perform a new installation with disk encryption, using the Ubuntu installer.
  3. Restore the image.

My plan is to restore a complete image, including the root(/) directory, so that my hardware setup, other OS settings and libraries are not lost. But I am not certain if such a restoration will affect the encryption of the disk, since it is a complete image coming from an unencrypted disk. I am also not certain how well such a restoration will work. I almost always do a clean install and restore only the user data.

I have seen this answer. But the link leads to a page that says the page on the topic is missing. Does anyone have the details on this idea? I am thinking, this can work by using dd to transfer data to external disk, then perform an encryption without a new installation, and then run a live disk to transfer back all the contents. But again, not certain how practical this is.

Kindly advise. I am also open to better methods, if available.

Score:2
ar flag

It won't work

First

The partition structure of full disk encryption as implemented by Ubuntu is different from that of a default install.

In particular, the /boot/ folder is a separate partition in an encrypted installation. In the default install it is a folder inside the / partition.

When you replace the encrypted / partition with the unencrypted one, it will try to boot using the wrong boot folder.

Second

The encrypted system has system files that either don't exist in the system without encryption, or they are different.

When you copy the system partition, these files either not exist or be replaced by the wrong ones.

Third

There is no easy way to restore a partition image made by dd for example, inside an encrypted partition in my opinion.

Hope this helps

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.