Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 16GB encrypted LUKS flash drive with corrupted partition table. Here is the fdisk output:

fdisk -l /dev/sdf 

Disk /dev/sdf: 16.2 GB, 16236150784 bytes
64 heads, 32 sectors/track, 15484 cylinders, total 31711232 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

Disk /dev/sdf doesn't contain a valid partition table

Can this be recovered?

share|improve this question
Are you sure that the whole drive isn't encrypted instead? – Ignacio Vazquez-Abrams Sep 12 '13 at 21:37
up vote 4 down vote accepted

First, did you encrypt the entire hard drive /dev/sdf or a partition /dev/sdf1? Try cryptsetup luksOpen /dev/sdf test from a root terminal to see if maybe you encrypted the entire volume and not the first partition in it. Which is OK, you'll just have to remember that each time you mount it and ignore the partition warnings. (You probably can't mount it through the Disk Utility GUI - you'll need to use the command line each time.)

If you really overwrote the partition table, you may need to use a tool to recreate. It shouldn't be too hard if you only had 1 partition in it, and a utility such as cfdisk may be able to help. Don't format the partition afterward, obviously.

Something that may be safer than putting a new partition table on it, if you indeed overwrote the partition table, is to get cryptsetup to look at not sector 0 of that volume but the sector that your encrypted volume begins at. I'm sure that it's possible somehow but can't think of a tool that does that (you can do that with "loopback" files easily but I'm not sure if losetup works with a raw device /dev/sdf).

You can probably dd if=/dev/sdf | hexdump -C | less and scroll through until you find the text LUKS - then divide that by 512 to get the beginning block of your LUKS partition.

share|improve this answer
I tried if=/dev/sdf | hexdump -C | grep LUKS but nothing. Probably LUKS header corrupted & I can't recover my encrypted partition in any way. Thanks for answer. – user1406146 Sep 13 '13 at 20:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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