From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.saout.de ([127.0.0.1]) by localhost (mail.saout.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P3-b9GKuTP5Y for ; Fri, 31 Jan 2014 02:36:44 +0100 (CET) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.saout.de (Postfix) with ESMTPS for ; Fri, 31 Jan 2014 02:36:44 +0100 (CET) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W932B-0002EM-Ia for dm-crypt@saout.de; Fri, 31 Jan 2014 02:36:43 +0100 Received: from c-98-227-220-190.hsd1.il.comcast.net ([98.227.220.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Jan 2014 02:36:43 +0100 Received: from rnicholsNOSPAM by c-98-227-220-190.hsd1.il.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Jan 2014 02:36:43 +0100 From: Robert Nichols Date: Thu, 30 Jan 2014 19:36:33 -0600 Message-ID: References: <20140130210159.GA27307@tansi.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: <20140130210159.GA27307@tansi.org> Subject: Re: [dm-crypt] Filesystem unreadabe after resizing LUKS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de On 01/30/2014 03:01 PM, Arno Wagner wrote: > On Thu, Jan 30, 2014 at 16:24:27 CET, Pawel Chojnacki wrote: >> Hello, >> >> Two days ago I tried to shrink my LUKS-encrypted /dev/sdb5 partition from >> 119 to 110 GB according to >> http://ubuntuforums.org/showthread.php?t=726724. Each step worked >> properly, but in the end I'm not able to mount the >> partition. I wanted to ask if you have any idea what may have caused that >> and how to fix it: >> >> # cryptsetup luksOpen /dev/sdb5 neuro >> >> accepts the proper password, doesn't recognize any other, and fails to >> mount the partition inside: >> >> # mount /dev/mapper/neuro /mnt/ >> mount: unknown filesystem type 'LVM2_member' > > This means LUKS is fine, just the resize failed. > I should pount out the clear "It should go without > saying, resizing your crypt may result in data loss > Be sure to BACK UP your data first." given in that posting. The thing that bugs me about the procedure in that thread is that it includes a totally unnecessary and complex ("I had to do this by trial and error") step of "cryptsetup ... resize". Nowhere in the LUKS header is there any field that holds the size of the container. Each time the LUKS container is opened it takes on the size of whatever is holding it (physical partition, LVM logical volume, dmsetup mapping, ... whatever). The "resize" operation in cryptsetup is useful only in the fairly rare circumstance that you actually want to _use_ an encrypted area _while_ it is smaller than whatever is holding it. That is similar to having a filesystem that is smaller than its partition, except that the filesystem _does_ have persistent knowledge of its size whereas a LUKS container does _not_. -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it.