All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ma Begaj <derliebegott@gmail.com>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] WD20EARS (4KB sector size) lost Luks header after reboot
Date: Wed, 15 Sep 2010 01:02:25 +0200	[thread overview]
Message-ID: <AANLkTi=dKAxWs8n_4tU0oyqhdmn+A-U8A=HMrzOUFBR-@mail.gmail.com> (raw)
In-Reply-To: <20100914221303.GA6023@tansi.org>

>> > This confirms that you did create the LUKS container at the
>> > right place, namely the LUKS header is at 64 x 512 B offset.
>>
>> 64x512 =32768
>> 32768  !=  32256
>>
>> 512 bytes is partition table? should it be 32780?
>> I am probably missing something.
>
> No, you see what I missed. Your LUKS sector is at 63 sectors
> offset, not 64. However the partition starts at 64 and therefore
> the LUKS sector is not at its start.
>
> I don't know what went wrong here, but partitions 1-4 are special in
> that you can change them without any changes to the disk except
> in the first sector (for partitions >= a chained partition sector
> is writte to disk and that can kill a LUKS header and do other dmage).
>
> This smeans you can just delete the partiton with fdisk and create
> a new one, which will the start at sector 63 and should have
> your LUKS container in it. It will not be 4kB alingned, though.
> You should unplug and replug the disk after the partition creation.
>
> If this goes wrong, you still have the first 100MB as backup.

;-)). you are the man :).

Working like a charm.  Deleted partition, created new starting at 63,
unplug/plug and luks partition is there. Thanks.

I owe you at least a drink.


>

>> I don't know enough about partition tables and headers but it looks like
>> /dev/sdm1 is starting little bit too far and LUKS header stays before the
>> beginning of /dev/sdm1 (first partition).
>
> Indeed.
>
>> Only obvious reason (at lease for me)  for this could be in this 4Kb
>> sector size.
>
> I think something has gone wrong when you did the alignment.
> Did you first create a not-4kB aligned partition and delete
> that again? If so the kernel would could remembered the partition
> but not that it got deleted and replaced (that needs a disk unplug).
> The reason is that the kernel sees partition changes only under some
> circumstances.

Wow great assumption. I did exactly that. I was doing this remotely
(I was not able to unplug) and I forgot first time to set 4kB sector size.
I deleted partition (which already was luksFormated too) and recreated
it again but this time in 4kB format.


Thanks a lot.


One more question because this is going pretty well now :) :

Do you have an idea how could I recreate 4kB aligned partition
without deleting data from the disk? This is more facultative question,
because I know have my data.

I thought about shrinking this partition, creating a second parition
 with 500gb to copy all data on this new partition, creating first paritition
in 4kB aligned format, copying all data back to this partition etc.

That could maybe  even work if XFS would support shrinking. But it
does not as I can remember ;-). Could partition start be moved from
sector 63 to sector 64 and keep working filesystem (of couse at the same
time risking to destroy some of the data)? Or is this (if possible) would
destroy filesystem totally?


M.

  reply	other threads:[~2010-09-14 23:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14 16:55 [dm-crypt] WD20EARS (4KB sector size) lost Luks header after reboot Ma Begaj
2010-09-14 17:33 ` Arno Wagner
2010-09-14 18:50   ` Ma Begaj
2010-09-14 20:32     ` Arno Wagner
2010-09-14 21:37       ` Ma Begaj
2010-09-14 22:13         ` Arno Wagner
2010-09-14 23:02           ` Ma Begaj [this message]
2010-09-15 10:29             ` Heinz Diehl
2010-09-15 11:21               ` Ma Begaj
2010-09-15 14:09             ` Arno Wagner
2010-09-16  7:30               ` Ma Begaj

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='AANLkTi=dKAxWs8n_4tU0oyqhdmn+A-U8A=HMrzOUFBR-@mail.gmail.com' \
    --to=derliebegott@gmail.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.