Ubuntu: Recover Data from old Luks Encrypted HDD to new HDD

If you prefer to use encrypted Devices you ran into a problem if you try to move, migrate or recover the files from the old luks protected home. As normal User you should know that luks is used with LVM2 Logicial Volume Manager, which manages the partitions „named based“. Major Info! Ubuntu prename the volume group with the Setup-DVD all time to the same VG_NAME called „ubuntu-vg“!!!

vg name volume group

So what do you need to migrate or recover?

  • Download the ubuntu DVD and burn it to a disc
  • Insert the new HDD to the Sata1 Port
  • Plugin the ubuntu DVD for Setup and boot the PC on DVD to „Live Mode“
  • Do not run a standard SETUP by pressing the Setup Link on the Desktop, select LVM+Crypted, and go on Setup, on end reboot.
  • Now the PC boots on the first HDD, if the new OS Setup is ok, shutdown to insert the old HDD on Sata2 Port.
  • Boot the PC on the DVD again to have a „LIVE MODE“ (readonly OS) again.
  • Now open a Gnome Terminal and enter „$sudo cryptsetup luksopen /dev/sdb3 crypt“ and enter the passoword to unlock the old HDD
  • Here you enter $vgdisplay to read out the UUID of the old „vg-Volumegroup! Name is same like on the new HDD!! Thats the problem!
  • Copy the UUID with the mouse and do a „$sudo vgrename oldUUID NEWVGNAME“ this forces the OS to set a other VG_NAME, by default named as „ubuntu–vg“. YOU CANT MOUNT and HANDLE two different „Volume-Groups“ with SAME VG_NAME!!!
  • Now you can run „$sudo vgscan –mknodes“ and then „$sudo vgchange -ay“ to activate all Volume Groups of all HDD’s
  • After that you will find the new mountpoint at /dev/mapper/… here you can do „$mount /dev/mapper/NEWVGNAME–vg-root /mnt“
  • do now backup your files from old to new HDD.. then reboot again to remove the old HDD..

Need more details? LVM Luks Handling Recovery Backup (external)



Impressum Datenschutz-DSGVO-GDPR

Last Update 08.10.2023 www.linuxonlinehelp.eu - Nonprofit Linux PC & Server Support since 2004 Tags: Linux Online Help, Linuxonlinehelp, Linux Support, Linux Hilfe