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