Score:0

Restore unencrypted partition into a LUKS encypted partition on 20.04

ca flag

I have an SSD with multiple partitions.

Device             Start       End   Sectors  Size Type
/dev/nvme0n1p1      2048    309247    307200  150M EFI System
/dev/nvme0n1p2    309248    571391    262144  128M Microsoft reserved
/dev/nvme0n1p3    571392 129912831 129341440 61,7G Microsoft basic data
/dev/nvme0n1p4 465311744 467339263   2027520  990M Windows recovery environment
/dev/nvme0n1p5 467339264 497324031  29984768 14,3G Windows recovery environment
/dev/nvme0n1p6 497326080 500117503   2791424  1,3G Windows recovery environment
/dev/nvme0n1p7 129912832 465311743 335398912  160G Linux filesystem

nvme0n1p7 is currently NOT encrypted. What I would like to do is to have this partition encrypted. So, my steps:

  1. Create an image of this partition (done with Disks) and store it on an external drive
  2. Boot from LiveCD
  3. Using Disks: format the partition as a LUKS encrypted, restore the image from the external drive. No errors.
  4. Reboot. At this point I'm stuck: I get into the grub> command line.

I actually expected to be prompt with the typical grub choice and then input the LUKS password.

So, my questions are:

  1. Is it possible to do what I have in mind, at all? So, instead of installing Ubuntu from scratch, just restore an existing image?
  2. If so, how do I get out of this situation? How should I configure Grub to let me pick the OS I want to start?

Thanks in advance!

AlexOnLinux avatar
ng flag
I can give you some hints, but I have no full solution for you. First: When using Disk-Encryption you need an EFI and an unencrypted BOOT partition. Second: Grub (initramfs) has to load the necessary modules to be able to decrypt your partition on boot (the default i suppose). Third: you need to have an /etc/crypttab file setup that will be hooked to initramfs. I would create a new partiton as boot. Copy the content from the actual boot folder to the boot partition. Than create an /etc/crypttab file with the apropriate content in it and try the `update-grub` command and cross fingers.
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.