3

My current laptop won't power on at all. It's not just the battery, pretty sure the motherboard is fried. (Assume it's irreparable.)

The hard drive on the laptop (SSD, in case that matters) was encrypted when I installed Ubuntu 16.04. Unfortunately for me, my external hard drive died about a month ago and I had yet to set up a new backup external when this laptop bit the dust. So at present I'm missing about a month of work.

How can I retrieve the data off of the dead laptop's encrypted hard drive and transfer it to a new laptop? (Assume the hard drive is intact and there are no problems there.)

2 Answers 2

7

I am assuming that you used the "Encrypt the new Ubuntu installation" or its manual equivalent; that is, your hard disk is encrypted by LUKS and in the encrypted container you have an LVM volume group.

Before starting, make sure that you have cryptsetup and lvm2 installed; if not, install them:

sudo apt-get install cryptsetup-bin lvm2
  1. Take the drive out and put it into a USB enclosure.

  2. Connect it to a working computer running Ubuntu or any other Debian derivative; you can even use a live DVD or USB flash drive for this. Say that the disk is seen by the system as /dev/sdb.

  3. Find out which partition on the disk is the LUKS container:

    for p in /dev/sdb*; do
      sudo cryptsetup isLuks $p && echo $p is a LUKS container
    done
    
  4. For example, suppose that you found out that /dev/sdb2 is a LUKS container. Open it:

    sudo crypsetup luksOpen /dev/sdb2 old-hard-disk
    
  5. LVM should automatically detect the logical volumes; see if it did so with

    sudo lvs -o full_name,size,seg_pe_ranges
    

    If not, you may have to trigger LVM recognition with sudo vgchange -aay.

  6. Now you have the logical volumes in /dev/mapper. Mount them onto some directories.

10
  • Thanks for this answer. It'll take me a couple of days to get the m2->USB adapter I ordered so that I can follow these instructions. I'll make this correct after I'm able to use these directions or I'll follow up with further questions/clarifications. Thanks.
    – Jay
    Dec 20, 2016 at 2:01
  • OK. So when I plugged this in to another (unencrypted) Ubuntu desktop, it actually immediately prompted me for the password to decrypt. That failed because it couldn't find program "cryptsetup". I then installed cryptsetup-bin and removed and reinserted the drive. Prompted for the password again, and it seemed to accept the password but then just said "operation failed" and unmounted the drive. Advice?
    – Jay
    Dec 22, 2016 at 22:04
  • 1
    @Jay: Try to follow the procedure as indicated starting from step 3, to see at what step it fails and why.
    – AlexP
    Dec 22, 2016 at 22:06
  • OK. So one thing is I think it's seeing two partitions on the drive. It's a 256 drive and it has one 512 MB partition and one 255 GB partition. But only the 512 (473) shows up when I run df -h to find out where the drive is mounted. Is that what I use for Step 3? Really appreciate your help.
    – Jay
    Dec 22, 2016 at 22:10
  • What's the name of the disk and of the partitions in Ubuntu? Use sudo lsblk to find out. In step 3, /dev/sdb is supposed to be the name of the disk, and the for will iterate through the partitions on it. Post the result of sudo lsblk in the question.
    – AlexP
    Dec 22, 2016 at 22:12
1

Connect the drive to your new computer (after removing it from your defect notebook, obviously). There are cheap USB connectors for sata or msata drives. When the drive is recognized you can mount it (if you have the password).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .