Results 1 to 8 of 8

Thread: How to reinstall 20.04.2 on encrypted partition without data loss ?

  1. #1
    Join Date
    Mar 2021
    Beans
    12

    How to reinstall 20.04.2 on encrypted partition without data loss ?

    Hello,
    I have a serious problem with my system, with no solution so far : https://ubuntuforums.org/showthread.php?t=2459816
    I'd like to reinstall Ubuntu without data/program loss.
    The thing is I have one LVM encrypted partition with system & data and I don't have the option "reinstall Ubuntu" when I launch a live session.



    Is there a way to do this ?

    Thank you !

  2. #2
    Join Date
    Jun 2014
    Beans
    6,157

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    Is all your data on one partition or do you have separate partitions for the system and personal data?

    You're not likely to find a 'reinstall' option with any operating system. The standard method is to simply install the OS again to the same partition and select to NOT format that partition I you have separate data partition do not format those either. I've done this successfully but I don't use LVM so I don't know what the results would be. I would expect it to work and your Ubuntu would be back to the original install.

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    Be 100% certain you have backups that can be restored for all data and settings you can't lose. Whenever using encryption, it is critical to have excellent backups. Just 1 tiny logical error or a physical error in the storage can be disastrous for all the data inside the encrypted container.

    I've never done this. I use LVM on almost all my systems and encrypt the laptops. If I were attempting this, I'd choose the "do something else" option, unlock the LUKS container (manually if necessary), then chose each LV for the specific mount point. As yancek suggests, don't format. I have doubts that the crypttab and grub will be setup correctly to prompt to open the LUKS container pre-boot, but you might get lucky.

    With great backups and since the restore process begins by doing a fresh, minimal install, I've never had to worry about this technique. Takes about 30 minutes to have everything back for the laptop, installed on a completely different system, with encryption and LVM - handled by the normal Ubuntu Installer - just check "use encryption + LVM". Solves all sorts of compatibility problems and allows completely changing the underlying storage setup without really changing the other settings or data or 99% of the installed programs.

  4. #4
    Join Date
    Mar 2021
    Beans
    12

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    Thank you for your replies !
    @yancek : I only have one partition for system & data. So I'm afraid installing Ubuntu again would erase my data (and all my programs).
    @TheFu : I have periodical GRsync backups of all my data (but not my system). How can I unlock the LUKS container manually (with live sessions, I usually unlock it after, when I access the files) ? Maybe it's why I don't get this "reinstall option" ? This is all new to me (I don't follow everything you say in the last paragraph), are there tutorials explaining it ?
    Thanks again

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    Quote Originally Posted by thealpman View Post
    @TheFu : I have periodical GRsync backups of all my data (but not my system). How can I unlock the LUKS container manually (with live sessions, I usually unlock it after, when I access the files) ? Maybe it's why I don't get this "reinstall option" ? This is all new to me (I don't follow everything you say in the last paragraph), are there tutorials explaining it ?
    cryptsetup can unlock LUKS encrypted containers. You'll need to know the "name" for this command. Look that up and write it down carefully BEFORE you need it. cryptsetup options have changed slightly the last few releases, so check out the manpage to get a feel for the options. You're looking for "open" or "Open" or "LUKSOpen"
    vgchange -ay will "activate" any inactive LVM VGs. These aren't available until after the LUKS container is unlocked.

    A very useful command: lsblk -e 7 -o name,size,type,fstype,mountpoint
    Not tutorials, but long posts in these forums.
    BTW, rsync isn't a good backup tool alone. There are many better options. Most are based on rsync, but add the stuff needed to be a good backup tool.

    Backup Methods

    Restore Methods

    Some Linux skills are required. This is deep stuff, so have some coffee and be ready to think.

  6. #6
    Join Date
    May 2010
    Beans
    1,274

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    Make sure your backups are up to date if you want to avoid data loss. Make a final FULL backup then you know your data is safe.

  7. #7
    Join Date
    Mar 2021
    Beans
    12

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    In the end, I reinstalled the system from scratch. (Which did not solve my initial problem..)

    Thank you for your help !

  8. #8
    Join Date
    Jun 2014
    Beans
    6,157

    Re: How to reinstall 20.04.2 on encrypted partition without data loss ?

    I only have one partition for system & data. So I'm afraid installing Ubuntu again would erase my data (and all my programs).
    No, it should not if you do not select to format the partition. I just did this with another Linux OS on which I had dozens of data files as well as various software I had installed before having problems and when I reinstalled NOT formatting the / (root filesystem) partition, all my personal data files as well as the software I had installed were still available. I don't know what difference encryption would make if any. Moot point since you have reinstalled.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •