Learn how you can use a live Ubuntu DVD or a USB to recover an encrypted hard disk in a failed boot device environment
You can easily retrieve data with the help of live CDs or USB boot devices if the hard disk is not encrypted. What if the hard disk is encrypted? Then the situation becomes a little tricky. You will find the solution in the following steps:
Step1: First, you need to make an Ubuntu CD/USB bootable device. Then boot the failed device or system with the Ubuntu bootable CD/USB device. After booting, the following screen will show.
Choose Try Ubuntu:
Step 2: You will get the window as shown below for the default desktop. Open the terminal and get into the root terminal as follows:
sudo -i
apt-get update
Step 3: Install cryptsetup as it is responsible for encryption/decryption of data. By default it would be pre-installed, if not, then install it using the following command:
apt-get install cryptsetup
Step 4: Now, we need to mount the internal hard disk. First, we check which drive was encrypted. We use the following command:
blkid | grep crypto
Step 5: So now you have /dev/sda5 available as encrypted drive, and you have to mount it as follows:
cryptsetup luksOpen /dev/sda5 unlock
Step 6: Then it will ask for the passphrase which is the encryption password for the hard disk. In this case it is pcquest12345
Step 7: After putting the password, it will get decrypted. Then you have to mount the drive as follows:
mount /dev/mapper/server1--vg-root /mnt
In this case there was lvm configured at /dev/mapper/server1--vg-root, you can check yours in the directory /dev/mapper. After successful mounting, you can see the contents as before in the drive /mnt/root
cd /mnt/root ls
Now you can either use scp or usb copy for the data and you have successfully recovered your data.