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.
Are you sure that the whole drive isn't encrypted instead? – Ignacio Vazquez-Abrams – 2013-09-12T21:37:07.303