Hoppa till innehåll

Etikett: Security

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


I feel a bit bad for not have been writing this earlier – but in Sweden we have a saying: ”Bättre sent än aldrig”, which translates to something like ”It’s better to be late then never do it.”

Anyway, I’d like to represent to you: Prey!

Prey is a must have application on every and all of your electronic devices. Do you have a tablet, computer (desktop or laptop) or a phone (one of them or all, no matter), you should absolutely have this installed and configured!

It is an application that will help you if the unspeakable would happend: you’re device gets stolen or lost. If that would happend, you can easly login on Prey’s website and set your device to missing and then it’ll start sending reports back to the Prey Dashboard, which includes, position data, (in some cases) pictures, Facebook accounts that the ”new” user uses and much, much more stuff. Data that you could give to the authorities! Data that will help you get your device back!

The installation varies from Android, to iPhone, from Linux, to Windows, to Mac OS X, but it pretty alike and very easy and straight forward.

  • Install the application on your device.
  • Follow the installation instructions.
  • Confirm your account.
  • Finalize the device settings on your Prey Dashboard.
  • Add another device (up to three for free).

Now you are good to go! Which in Prey’s case is nothing more. You won’t have to do anything more (unless you’re device get lost). Prey just sits in the background and doesn’t at all give itself up.

What are you waiting for?! Install it!


4 kommentarer