From: Matthias Schniedermeyer <ms@citd.de>
To: Pawel Chojnacki <chojnacki.pawel@linux.com>
Cc: dm-crypt@saout.de
Subject: Re: [dm-crypt] Filesystem unreadabe after resizing LUKS
Date: Thu, 30 Jan 2014 17:22:20 +0100 [thread overview]
Message-ID: <20140130162220.GA8697@citd.de> (raw)
In-Reply-To: <CA+5H9QnQx8OQ+tC0k_FXmCgjvJ_MBmbsJHHwNyzEbK=5fwxPsQ@mail.gmail.com>
On 30.01.2014 16:24, 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:
The actual commands you executed would be useful.
> As far as I understand, the physical volume is 110 GB large, and filesystem
> is 117.9 GB (why?). When trying to read from superblocks:
A filesystem has the information stored about it's size stored inside
itself, it doesn't needs (or uses) the information about the outer
container-size for that.
You have a problem when the outer size doesn't correspond with the
stored filesystem size. Altough actually problematic is only the
"filesystem is bigger" case, the other case is (potentially) just wasted
space.
As for shrinking, this is an operation that is NOT guruanteed to be
successful. There maybe files in the space you want to shrink away and
AFAIK there aren't any (OSS) tools that relocate files (except the
XFS-specific xfs_fsr, but more about XFS in the next paragraph). The
resize2fs-manpage isn't really informative. You would have to check the
file-layouts of EVERY file. "filefrag" can tell you where the physical
blocks of a file are located, you would need to calcutate the offset
that will ouside the shrinked filesystem and move any file that is
beyond the offset (Just copying such a file away and back MIGHT be
enough, but that depends a little on luck)
After that you would need to hope that there aren't any "other" things
in "to be removed" space. Like for e.g. directory-data
For e.g. i can definitly say that you can't shrink an XFS, because there
simply isn't any tool that can do that. It's technically possible to do
that, but nobodoy bothered to create the necessary tool which would
check & relocate files/directores... and then fix up the metadata of the
filesystem. There are people that ask the question from time to time.
But "Backup & Restore" is still the only "officially supported" way to
shrink a XFS filesystem.
The only Linux filesystem (i know) that will definitly be able to
"shrink" is BTRFS (Keyword: rebalancing), altough i'm unsure if it can
do that today or at some point in the future.
--
Matthias
next prev parent reply other threads:[~2014-01-30 16:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 15:24 [dm-crypt] Filesystem unreadabe after resizing LUKS Pawel Chojnacki
2014-01-30 16:22 ` Matthias Schniedermeyer [this message]
2014-01-30 21:01 ` Arno Wagner
2014-01-31 1:36 ` Robert Nichols
2014-01-31 3:17 ` Arno Wagner
2014-01-31 9:04 ` Pawel Chojnacki
2014-01-31 2:26 ` Sven Eschenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140130162220.GA8697@citd.de \
--to=ms@citd.de \
--cc=chojnacki.pawel@linux.com \
--cc=dm-crypt@saout.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.