Return-Path: Received: from tansi.org (ns.km10532-04.keymachine.de [87.118.102.195]) by mail.saout.de (Postfix) with ESMTP for ; Mon, 2 Aug 2010 19:36:08 +0200 (CEST) Received: from gatewagner.dyndns.org (84-74-164-239.dclient.hispeed.ch [84.74.164.239]) by tansi.org (Postfix) with ESMTPA id 97F772128007 for ; Mon, 2 Aug 2010 19:36:07 +0200 (CEST) Date: Mon, 2 Aug 2010 19:36:06 +0200 From: Arno Wagner Message-ID: <20100802173606.GB29290@tansi.org> References: <20100802002730.GA15890@tansi.org> <1280738327.12803.1387859489@webmail.messagingengine.com> <4C5696E2.1000509@redhat.com> <4C56CB65.1060804@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C56CB65.1060804@redhat.com> Subject: Re: [dm-crypt] How to gather LUKS parameters from active device (if LUKS header lost) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de Hmm, this was still mounted? Ah, I see. Another thing to add to my list to things not to do when tired: Giving advice in critical situations. Sorry. One thing you can do before trying Milan's instructions is to make an image backup (with dd/dd_rescue) of the decrypted device, i.e. the device in /dev/mapper/. That will fix the current state in case something goes wrong and you can do conventional recovery on the image. Arno On Mon, Aug 02, 2010 at 03:43:01PM +0200, Milan Broz wrote: > > > On 08/02/2010 11:58 AM, Milan Broz wrote: > > If you see dm-crypt mapping there mapped to proper drive, you can still recreate > > LUKS header with some some magic. > > Well, here is the idea how to reconstruct LUKS header from active mapping > if header is lost but mapping is still active. > (Note: if device is not active, recovery is impossible). > > - it will change LUKS UUID! > - no passphrase needed, it asks for new one (root access required of course) > - cryptsetup 1.1.x required. > > Do not save master key file (second param) to unencrypted filesystem! > > I'll add something similar to cryptsetup distro into DOC install, > for now take this as an idea - see attached script (it will not touch device, > only saves master key to file and print required parameters for cryptsetup). > > BEWARE: NO GUARANTEES AT ALL. NOT PROPERLY TESTED. > > Example: > If you have mapped device named "luks_sdb", script will produce this: > > #