From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nm17-vm0.bullet.mail.ne1.yahoo.com (nm17-vm0.bullet.mail.ne1.yahoo.com [98.138.91.58]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Tue, 22 Sep 2015 20:53:18 +0200 (CEST) Date: Tue, 22 Sep 2015 18:52:16 +0000 (UTC) From: H McCurdy Reply-To: H McCurdy Message-ID: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1746144_693657538.1442947936226" Subject: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "dm-crypt@saout.de" ------=_Part_1746144_693657538.1442947936226 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I've read the FAQ (but can't guarantee I didn't miss something).=C2=A0 In t= he warnings sections about the Ubuntu installer I read "... (it is very eas= y to recognize a LUKS container)..." I don't actually need to know, but I'd like to know how this is done.=C2=A0= I didn't find the answer in the FAQ, didn't find it using Google and didn'= t find it on Stack Overflow. ------=_Part_1746144_693657538.1442947936226 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Hi,

I've read the FAQ (but can't guarantee I didn't miss something).  In the warnings sections about the Ubuntu installer I read "... (it is very easy to recognize a LUKS container)..."

I don't actually need to know, but I'd like to know how this is done.  I didn't find the answer in the FAQ, didn't find it using Google and didn't find it on Stack Overflow.

------=_Part_1746144_693657538.1442947936226-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ramses-pyramidenbau.de (ramses-pyramidenbau.de [IPv6:2a03:4000:6:8069::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Tue, 22 Sep 2015 22:08:54 +0200 (CEST) Received: from [IPv6:2a02:810d:25c0:a78:224:d7ff:fe9d:8638] (unknown [IPv6:2a02:810d:25c0:a78:224:d7ff:fe9d:8638]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.ramses-pyramidenbau.de (Postfix) with ESMTPSA id 2F53A12085B for ; Tue, 22 Sep 2015 22:03:04 +0200 (CEST) References: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> From: Ralf Ramsauer Message-ID: <5601B424.4090609@ramses-pyramidenbau.de> Date: Tue, 22 Sep 2015 22:03:48 +0200 MIME-Version: 1.0 In-Reply-To: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> Content-Type: multipart/alternative; boundary="------------040300060700020408070805" Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de This is a multi-part message in MIME format. --------------040300060700020408070805 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Hello, there are few options how to detect a LUKS container: - use 'cryptsetup luksDump' on your device. It will fail, if it's not a LUKS container. - 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" 'sudo head -c 128 /dev/yourdevice | hexdump -C' It should look like 00000000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 |LUKS....aes.....| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 |........xts-plai| 00000030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 |n64.............| ... Cheers Ralf On 09/22/2015 08:52 PM, H McCurdy wrote: > Hi, > > I've read the FAQ (but can't guarantee I didn't miss something). In > the warnings sections about the Ubuntu installer I read "... (it is > very easy to recognize a LUKS container)..." > > I don't actually need to know, but I'd like to know how this is done. > I didn't find the answer in the FAQ, didn't find it using Google and > didn't find it on Stack Overflow. > > > > _______________________________________________ > dm-crypt mailing list > dm-crypt@saout.de > http://www.saout.de/mailman/listinfo/dm-crypt --------------040300060700020408070805 Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: quoted-printable
Hello,

there are few options how to detect a LUKS container:

- use 'cryptsetup luksDump' on your device. It will fail, if it's not a LUKS container.
- 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"
=A0 'sudo head -c 128 /dev/yourdevice | hexdump -C'
It should look like
00000000=A0 4c 55 4b 53 ba be 00 01=A0 61 65 73 00 00 00 00 00=A0 |LUKS....aes.....|
00000010=A0 00 00 00 00 00 00 00 00=A0 00 00 00 00 00 00 00 00=A0 |................|
00000020=A0 00 00 00 00 00 00 00 00=A0 78 74 73 2d 70 6c 61 69=A0 |........xts-plai|
00000030=A0 6e 36 34 00 00 00 00 00=A0 00 00 00 00 00 00 00 00=A0 |n64.............|
...

Cheers
=A0 Ralf

On 09/22/2015 08:52 PM, H McCurdy wrote:
Hi,

I've read the FAQ (but can't guarantee I didn't miss something).=A0 In the warnings sections about the Ubuntu installer I read "... (it is very easy to recognize a LUKS container)..."

I don't actually need to know, but I'd like to know how this is done.=A0 I didn't find the answer in the FAQ, didn't find it using Google and didn't find it on Stack Overflow.



_______________________________________________
dm-crypt mailing list
dm-=
crypt@saout.de
http://www.saout.de/mailman/listinfo/dm-crypt

--------------040300060700020408070805-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ramses-pyramidenbau.de (ramses-pyramidenbau.de [37.120.178.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Tue, 22 Sep 2015 22:13:24 +0200 (CEST) Received: from [IPv6:2a02:810d:25c0:a78:224:d7ff:fe9d:8638] (unknown [IPv6:2a02:810d:25c0:a78:224:d7ff:fe9d:8638]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.ramses-pyramidenbau.de (Postfix) with ESMTPSA id 9340B12085B for ; Tue, 22 Sep 2015 22:13:22 +0200 (CEST) References: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> <5601B424.4090609@ramses-pyramidenbau.de> From: Ralf Ramsauer Message-ID: <5601B68E.9090808@ramses-pyramidenbau.de> Date: Tue, 22 Sep 2015 22:14:06 +0200 MIME-Version: 1.0 In-Reply-To: <5601B424.4090609@ramses-pyramidenbau.de> Content-Type: multipart/alternative; boundary="------------040007090702090601050400" Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de This is a multi-part message in MIME format. --------------040007090702090601050400 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Damn, eventually I forgot to mention cryptsetup isLuks yourDevice Ralf On 09/22/2015 10:03 PM, Ralf Ramsauer wrote: > Hello, > > there are few options how to detect a LUKS container: > > - use 'cryptsetup luksDump' on your device. It will fail, if it's not > a LUKS container. > - 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" > 'sudo head -c 128 /dev/yourdevice | hexdump -C' > It should look like > > 00000000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 > |LUKS....aes.....| > 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > |................| > 00000020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 > |........xts-plai| > 00000030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 > |n64.............| > ... > > > Cheers > Ralf > > On 09/22/2015 08:52 PM, H McCurdy wrote: >> Hi, >> >> I've read the FAQ (but can't guarantee I didn't miss something). In >> the warnings sections about the Ubuntu installer I read "... (it is >> very easy to recognize a LUKS container)..." >> >> I don't actually need to know, but I'd like to know how this is >> done. I didn't find the answer in the FAQ, didn't find it using >> Google and didn't find it on Stack Overflow. >> >> >> >> _______________________________________________ >> dm-crypt mailing list >> dm-crypt@saout.de >> http://www.saout.de/mailman/listinfo/dm-crypt > > > > _______________________________________________ > dm-crypt mailing list > dm-crypt@saout.de > http://www.saout.de/mailman/listinfo/dm-crypt --------------040007090702090601050400 Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: quoted-printable
Damn, eventually I forgot to mention

cryptsetup isLuks yourDevice

=A0 Ralf

On 09/22/2015 10:03 PM, Ralf Ramsauer wrote:
Hello,

there are few options how to detect a LUKS container:

- use 'cryptsetup luksDump' on your device. It will fail, if it's not a LUKS container.
- 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"
=A0 'sudo head -c 128 /dev/yourdevice | hexdump -C'
It should look like
00000000=A0 4c 55 4b 53 ba be 00 01=A0 61 65 73 00 00 00 00 00=A0 |LUKS....aes.....|
00000010=A0 00 00 00 00 00 00 00 00=A0 00 00 00 00 00 00 00 00=A0 |................|
00000020=A0 00 00 00 00 00 00 00 00=A0 78 74 73 2d 70 6c 61 69=A0 |........xts-plai|
00000030=A0 6e 36 34 00 00 00 00 00=A0 00 00 00 00 00 00 00 00=A0 |n64.............|
...

Cheers
=A0 Ralf

On 09/22/2015 08:52 PM, H McCurdy wrote:
Hi,

I've read the FAQ (but can't guarantee I didn't miss something).=A0 In the warnings sections about the Ubuntu installer I read "... (it is very easy to recognize a LUKS container)..."

I don't actually need to know, but I'd like to know how this is done.=A0 I didn't find the answer in the FAQ, didn't find it using Google and didn't find it on Stack Overflow.



_______________________________________________
dm-crypt mailing list
dm-crypt@saout.de
http://www.saout.de/mailman/listinf=
o/dm-crypt



_______________________________________________
dm-crypt mailing list
dm-=
crypt@saout.de
http://www.saout.de/mailman/listinfo/dm-crypt

--------------040007090702090601050400-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from v6.tansi.org (ns.km31936-01.keymachine.de [87.118.116.4]) by mail.server123.net (Postfix) with ESMTP for ; Tue, 22 Sep 2015 22:13:33 +0200 (CEST) Received: from gatewagner.dyndns.org (77-57-54-224.dclient.hispeed.ch [77.57.54.224]) by v6.tansi.org (Postfix) with ESMTPA id 3153334FA001 for ; Tue, 22 Sep 2015 22:13:33 +0200 (CEST) Date: Tue, 22 Sep 2015 22:13:31 +0200 From: Arno Wagner Message-ID: <20150922201330.GA22680@tansi.org> References: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de Hi, it is very easy: - cryptsetup isLuks returns true - the container starts with the LUKS magic number, i.e. 'L','U','K','S', 0xBA, 0xBE. On Tue, Sep 22, 2015 at 20:52:16 CEST, H McCurdy wrote: > Hi, > > I've read the FAQ (but can't guarantee I didn't miss something).=A0 In the > warnings sections about the Ubuntu installer I read "... (it is very easy > to recognize a LUKS container)..." Always good to know it gets read! > I don't actually need to know, but I'd like to know how this is done.=A0 I > didn't find the answer in the FAQ, didn't find it using Google and didn't > find it on Stack Overflow. It is really very easy, both using cryptsetup and manyally: - "cryptsetup isLuks " returns true use option -v for additional text output. - The container starts with the LUKS magic number, i.e. 'L','U','K','S', 0xBA, 0xBE. The reference for the second one would be the Luks Specification, available here: https://gitlab.com/cryptsetup/cryptsetup/wikis/LUKS-standard/on-disk-format= .pdf (It is referenced in the FAQ at the end). Regards, Arno --=20 Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno@wagner.name GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718 ---- A good decision is based on knowledge and not on numbers. -- Plato If it's in the news, don't worry about it. The very definition of=20 "news" is "something that hardly ever happens." -- Bruce Schneier From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nekare.kjorling.se (nekare.kjorling.se [89.221.249.175]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Tue, 22 Sep 2015 22:20:01 +0200 (CEST) Received: from yeono.kjorling.se (h-9-65.a328.priv.bahnhof.se [46.59.9.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "yeono", Issuer "yeono" (not verified)) by nekare.kjorling.se (Postfix) with ESMTPS id 30C39114064 for ; Tue, 22 Sep 2015 20:19:52 +0000 (UTC) Received: from yeono.kjorling.se (localhost [127.0.0.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by yeono (Postfix) with ESMTPS id E51F813E3 for ; Tue, 22 Sep 2015 22:19:51 +0200 (CEST) Date: Tue, 22 Sep 2015 20:19:50 +0000 From: Michael =?utf-8?B?S2rDtnJsaW5n?= Message-ID: <20150922201950.GT14230@yeono.kjorling.se> References: <163648314.1746145.1442947936228.JavaMail.yahoo@mail.yahoo.com> <5601B424.4090609@ramses-pyramidenbau.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5601B424.4090609@ramses-pyramidenbau.de> Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de On 22 Sep 2015 22:03 +0200, from ralf+dm@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.se • michael@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) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nm2-vm6.bullet.mail.ne1.yahoo.com (nm2-vm6.bullet.mail.ne1.yahoo.com [98.138.91.254]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Wed, 23 Sep 2015 04:29:57 +0200 (CEST) Date: Wed, 23 Sep 2015 02:29:55 +0000 (UTC) From: H McCurdy Reply-To: H McCurdy Message-ID: <1499996308.43136.1442975395248.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <20150922201950.GT14230@yeono.kjorling.se> References: <20150922201950.GT14230@yeono.kjorling.se> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_43135_1569941306.1442975395245" Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Michael_Kj=C3=B6rling?= , "dm-crypt@saout.de" ------=_Part_43135_1569941306.1442975395245 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks everyone.=C2=A0 Since the issue was Ubuntu installer software not fi= guring it out, I was wondering about a way to solve the problem so that a p= rogram could figure it out (without human help). I might have figured it out but can't test my idea until tomorrow.=C2=A0 My= thought is to try to access it as if it exists and if the function returns= -1, then it's not a valid LUKS container.=C2=A0 Anyway, that's my idea. I might need to examine errno to make sure the error isn't something like E= PERM. =20 On Tuesday, September 22, 2015 4:20 PM, Michael Kj=C3=B6rling wrote: =20 On 22 Sep 2015 22:03 +0200, from ralf+dm@ramses-pyramidenbau.de (Ralf Rams= auer): > - If you have a dump, you can also use the 'file' command >=20 > 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] UUI= D: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx $=20 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). --=20 Michael Kj=C3=B6rling =E2=80=A2 https://michael.kjorling.se =E2=80=A2 micha= el@kjorling.se OpenPGP B501AC6429EF4514 https://michael.kjorling.se/public-keys/pgp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =E2=80=9CPeople who= think they know everything really annoy =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 those of us who kno= w we don=E2=80=99t.=E2=80=9D (Bjarne Stroustrup) _______________________________________________ dm-crypt mailing list dm-crypt@saout.de http://www.saout.de/mailman/listinfo/dm-crypt ------=_Part_43135_1569941306.1442975395245 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks everyone.  Since the issue= was Ubuntu installer software not figuring it out, I was wondering about a= way to solve the problem so that a program could figure it out (without hu= man help).

I might have figured it out but can'= t test my idea until tomorrow.  My thought is to try to access it as i= f it exists and if the function returns -1, then it's not a valid LUKS cont= ainer.  Anyway, that's my idea.

I might need to examine errno to make sure the er= ror isn't something like EPERM.


<= div id=3D"yui_3_16_0_1_1442975127966_2779">



On Tuesday, = September 22, 2015 4:20 PM, Michael Kj=C3=B6rling <michael@kjorling.se&g= t; wrote:


On 22= Sep 2015 22:03 +0200, from ralf+dm@ramses-py= ramidenbau.de (Ralf Ramsauer):
> - If you have a d= ump, you can also use the 'file' command
>
> Or the sophisticated one :-)
> - Look a= t 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, s= ha512] UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
$

But I expect that 'cryptsetup isLuks' woul= d be the best bet, as well
as lending itself better to au= tomation (assuming of course that is the
end goal).

--
Michael Kj=C3=B6rling= =E2=80=A2 https://michael.kjorling.se =E2=80=A2 mic= hael@kjorling.se
OpenPGP B501AC6429EF4514 https://michael.kjorling.se/public-keys/pgp
 =               =E2=80=9CPeople who thin= k they know everything really annoy
      =           those of us who know we don=E2=80=99t.= =E2=80=9D (Bjarne Stroustrup)

_______________________________________________
dm-crypt mailing list
dm-crypt@s= aout.de
http://www.saout.de/mailman/l= istinfo/dm-crypt


=
------=_Part_43135_1569941306.1442975395245-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nekare.kjorling.se (nekare.kjorling.se [89.221.249.175]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Wed, 23 Sep 2015 09:51:12 +0200 (CEST) Received: from yeono.kjorling.se (h-9-65.a328.priv.bahnhof.se [46.59.9.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "yeono", Issuer "yeono" (not verified)) by nekare.kjorling.se (Postfix) with ESMTPS id 76AD21140C5 for ; Wed, 23 Sep 2015 07:50:58 +0000 (UTC) Received: from yeono.kjorling.se (localhost [127.0.0.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by yeono (Postfix) with ESMTPS id 2DDDE14CD for ; Wed, 23 Sep 2015 09:50:58 +0200 (CEST) Date: Wed, 23 Sep 2015 07:50:56 +0000 From: Michael =?utf-8?B?S2rDtnJsaW5n?= Message-ID: <20150923075056.GA5504@yeono.kjorling.se> References: <20150922201950.GT14230@yeono.kjorling.se> <1499996308.43136.1442975395248.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1499996308.43136.1442975395248.JavaMail.yahoo@mail.yahoo.com> Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de On 23 Sep 2015 02:29 +0000, from hmccurdy@yahoo.com (H McCurdy): > I might have figured it out but can't test my idea until tomorrow.  > My thought is to try to access it as if it exists and if the > function returns -1, then it's not a valid LUKS container.  Anyway, > that's my idea. For the scenario you describe, something like # test -r $DEVICE && cryptsetup isLuks $DEVICE && echo It is LUKS is probably the best bet. -- Michael Kjörling • https://michael.kjorling.se • michael@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) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Wed, 23 Sep 2015 10:39:09 +0200 (CEST) Received: by wicgb1 with SMTP id gb1so194691538wic.1 for ; Wed, 23 Sep 2015 01:39:08 -0700 (PDT) References: <20150922201950.GT14230@yeono.kjorling.se> <1499996308.43136.1442975395248.JavaMail.yahoo@mail.yahoo.com> <20150923075056.GA5504@yeono.kjorling.se> From: Milan Broz Message-ID: <5602652A.4060301@gmail.com> Date: Wed, 23 Sep 2015 10:39:06 +0200 MIME-Version: 1.0 In-Reply-To: <20150923075056.GA5504@yeono.kjorling.se> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [dm-crypt] How to recognize a LUKS container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Michael_Kj=c3=b6rling?= , dm-crypt@saout.de On 09/23/2015 09:50 AM, Michael Kjörling wrote: > On 23 Sep 2015 02:29 +0000, from hmccurdy@yahoo.com (H McCurdy): >> I might have figured it out but can't test my idea until tomorrow. >> My thought is to try to access it as if it exists and if the >> function returns -1, then it's not a valid LUKS container. Anyway, >> that's my idea. > > For the scenario you describe, something like > > # test -r $DEVICE && cryptsetup isLuks $DEVICE && echo It is LUKS In generoic scripts I would better suggest to use blkid (or libblkid if you need link to a library). See blkid man page for all formatting etc. parameters. Milan