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)

 

 

Backup your PC with Linux Full Disk Snapshot Free Tool with Diskdump

Today a User is forced to Update daily his System or change anything to try new Software.

But here mostly the Users run into very BAD PROBLEMS. I got often Calls that Users lose the control of the PC after Updates, Software Setups, Software Removal’s ..

For this Linux offers a default Backup Tool, called Diskdump („dd“ command) which is on every Setup/Recover CD and Installation.

Before any Changes do allways a Backup to USB Drives, Sticks or Second SATA Disk! This will save you TIME, Money, DATA and Nerves!

Backup :

Mount the Disk 2 on Path /mnt as „root/sudo“ user (must have free Space like Disk 1 better more!)

mount disk

then start Backup Disk 1 everything to Disk 2 as IMG Image, bs set the speed disk to disk 10MB/s is a secure value!

dd disk dump backup

Restore :

To Restore a damaged PC, plug your second Disk into the PC, boot from Setup CD, Press ALT-CTRL-F1 (or open Gnome-Terminal)

Mount the second Disk again on /mnt with „root/sudo“ User

mount disk

and start the restore with dd from Disk 2 – IMG – Imagefile to Disk 1, enjoy a long coffee break…

restore disk linux dd

After Command close without Errors or other Messages, reboot and go on working…

 

Remark: This is a Block to Block Backup and Restore, with Snapshots. These IMG Snapshots can be saved on Disks, moved over Network, burned to DVD or mounted like a DVD on other Linux Systems to access the Files for emergency!