[dm-crypt] How to recognize a LUKS container

Michael Kjörling michael at kjorling.se
Tue Sep 22 22:19:50 CEST 2015

On 22 Sep 2015 22:03 +0200, from ralf+dm at ramses-pyramidenbau.de (Ralf Ramsauer):
> - If you have a dump, you can also use the 'file' command
> Or the sophisticated one :-)
> - Look at the first few bytes of your partition/dump and check, if it
> contains the magic header "LUKS"

Or you can use 'file' directly, if you pass '-s' (--special-files) to it:

$ sudo file -s /dev/sdXY
/dev/sdXY: sticky LUKS encrypted file, ver 1 [aes, xts-plain64, sha512] UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

But I expect that 'cryptsetup isLuks' would be the best bet, as well
as lending itself better to automation (assuming of course that is the
end goal).

Michael Kjörling • https://michael.kjorling.semichael at kjorling.se
OpenPGP B501AC6429EF4514 https://michael.kjorling.se/public-keys/pgp
                 “People who think they know everything really annoy
                 those of us who know we don’t.” (Bjarne Stroustrup)

More information about the dm-crypt mailing list