Creating and mounting a BitLocker drive image on Linux

Last year, my internal M.2 SSD drive stopped working. I had experienced disconnection problems over the last 2 years; however, last year, it just refused to turn on. It was also encrypted with BitLocker. I took it to a repair shop that claimed they could perform data recovery. However, after waiting for a couple of days, they informed me that they couldn’t recover any data; the M.2 SSD drive was broken and not recognized. I didn’t want to lose all the data I had on that drive, so I purchased a cheap M.2 SSD drive reader and returned home.

Disclaimer: This method carries risks. If you’re dealing with crucial data, consider professional data recovery services. I can’t be held responsible for any issues or data loss you may encounter.

A picture of the M.2 SSD reader and its case.
M.2 SSD reader.

When I plugged in the reader, my drive still wasn’t recognized. However, by sheer chance, when I was unplugging and plugging the reader, I didn’t put the drive reader case on, and the computer momentarily recognized the drive. From then on, I knew that when I pushed the drive inside the case, there would be some kind of pressure on the board, causing it to stop working. However, if the drive was left hanging out, it worked.

A picture of the M.2 SSD reader with an m.2 SSD halfway pushed in.
M.2 SSD does not work
A picture of the M.2 SSD reader with an m.2 SSD not pushed in.
M.2 SSD works

Since I could determine the issue, I connected the drive and made an image of it using ddrescue.

$ ddrescue -n /dev/sda1 m2image.img mapfile

There were around 4 MB that was broken but the image creation succeeded. Now I just needed to mount and backup whatever files I needed.

First, I ran fdisk on the image to see which partitions I had and which sectors they started at.

$ fdisk -l m2image.img
Disk m2image.img:238.47 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 294142A9-76A6-4530-B4DC-12EEDF936E1F

Device           Start       End   Sectors   Size Type
m2image.img1      2048    530431    528384   258M EFI System
m2image.img2    530432    563199     32768    16M Microsoft reserved
m2image.img3    563200 340731903 340168704 162.2G Microsoft basic data
m2image.img4 340731904 498020351 157288448    75G Linux filesystem
m2image.img5 498020352 500117503   2097152     1G Windows recovery environment

Then using losetup I attached the image file as a loop device:

$ sudo losetup -P /dev/loop0 m2image.img

and using cryptsetup unlocked the bitlocker partition:

$ sudo cryptsetup open --type bitlk /dev/loop0p3 m2windows

After that, I created a mountfolder and mounted the drive:

$ sudo mkdir /mnt/mountfolder
$ sudo mount /dev/mapper/m2windows /mnt/mountfolder

After that, running

$ ls /mnt/mountfolder

yielded all the files I had on the drive. I backed them up and happy ending!