1

I have a thumb drive that I keep LUKS-encrypted. Recently had a computer crash. I'm able to open the encrypted device without any apparent problems, but when I try to mount the drive (as root) I get the following error:

EXT4-fs (dm-1): write access unavailable, cannot proceed.
mount: /media/thumb: cannot mount /dev/mapper/thumb read-only.

dmesg gives me:

EXT4-fs (dm-1): INFO: Recovery required on read-only filesystem
EXT4-fs (dm-1): write access unavailable, cannot proceed

Okay, so fsck, right? Well...

fsck.ext4: Operation not permitted while trying to open /dev/mapper/thumb
You must have r/w access to the filesystem or be root

And, of course, I'm running this as root.

Does anyone have any suggestions? Am I hooped?

Running Arch, if that makes a difference.

EDIT: The issue was the, uh, read/write switch on the SD card was in the "read only" position. Soooooooooo once I put it right I was able to fsck the partition without issue. Nevertheless the solution provided was enough to get the data off the partition, so I'll leave the question in case someone else has the same issue (since Google didn't really have much about it). I'm gonna go spend the rest of the night sitting in the corner. Cheers!

1

There are a few ways of proceeding. The way I might attack it would be to make a copy of the unencrypted version of the disk to a file, then operate on that. To do this I would (taking extra steps to make failure less likely) :

  1. Open the block device with a command like

    cryptsetup LuksOpen /dev/sdX encryptedusb

  2. Copy the unencrypted version into a file

    pv < /dev/mapper/encryptedusb > /path/to/unencrypted.file

  3. Create a loopback device to access the unecrypted file as a block device (may not be required, but allows some block operations to succeed which might otherwise fail.)

    losetup /dev/loop0 /path/to/unecrypted.file

  4. Attempt data recovery on /dev/loop0 as per any normal filesystem, eg fsck the disk, attempt to mount it, if that fails run photorec on it etc.

  • Thanks for the response. I'm not familiar with the pv command, and I don't have it installed nor can I find it in the Arch repos -- could I achieve the same effect in principle using dd? – Project 9501 Dec 28 '17 at 2:01
  • PV is just a nice little utility which shows progress of a copy. You could replace it with dd if=/dev/mapper/encryptedUSB of=/path/to/unencrypted.file which will have the same effect, but won't show the progress of the copy. – davidgo Dec 28 '17 at 2:04
  • Well, this was enough to recover the files. I was hoping for an in-situ solution so I wouldn't have to transfer all the data back and forth but so it goes. Thanks! – Project 9501 Dec 28 '17 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.