Hoppa till innehåll

Etikett: Backup and Restore

Recover files from old system LUKS drive

So a few weeks ago – at my very first lecture for this semester – my precious laptop (Sony Vaio Pro 13) gave in. I was rather upset, I must admit. However I actually got myself another one – with twice as much RAM and disk space (pretending it’s the same, altough I love new tech).
Now, the Vaio Pro 13 uses M.2 SSD disks, so backing up the old drive, which I of course kept, needed a M.2 to SATA adapter. Also I already got a SATA to USB. And although I have rather sophisticated backup routine for my machines, there are still things that there, on the old system, that I want – like PPAs, config files and what not (I really need to start backing them up as well). Of course one could to a complete restoration of the system, but I do very much like to combine a backup restore with the feeling of a freshly installed system, hence I recover only what I want.
I plugged everything in. I’m using LUKS on all machines for better security so the passphrase promt showed up much to my appreciation, but. Error. Of course my heart rate rised. Trying a few times more; trying the disk utilty; on other computers; again in the new one. No change. Pop up the terminal to run the commands manual (I knew that it was /dev/sdb5 from error and disk utility):

$ sudo cryptsetup luksOpen /dev/sdb5 encrypt_oldhome
$ mkdir oldhome
$ sudo mount /dev/mapper/encrypt_oldhome oldhome/
mount: unknown filesystem type ’LVM2_member’

And I though: ”What is this?”. I have the lvm2 package installed. Searching and found that it is due to the LVM groups of the old and new system having the very same name, which created the issue.[1]
So, of course one has to change that, but how? Well, using vgrename.[2]
Once again, in terminal, you run:

$ sudo vgdisplay

Here you locate the old LVM – and do be very sure about this so that you accidentally don’t rename the volume of currently running system. I made sure of this by looking at the size of the drives; my old one was 128GB and new is 256GB. Once located, you copy the ”VG UUID” and run this command:

$ sudo vgrename YOUR-VG-UUID ubuntu-vg-old

(”ubuntu-vg-old” is the new name, which the suffix ”old” is added from prevous ”ubuntu-vg”, which is Ubuntu’s default)
Now you are once again able to mount the old system by re-running the mount command, now without error:

$ sudo mount /dev/mapper/encrypt_oldhome oldhome/

So, in conclusion, the issue was that the new and old system’s volume group (LVM) had the same name. Solution was to change the name of the old drive’s LVM.
1: https://askubuntu.com/a/766141
2: http://www.cyberciti.biz/faq/warning-duplicate-vg-name-server01-error/

Kommentarer är stängda