All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eschenberg <sven@whgl.uni-frankfurt.de>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] Alignment issue with 4K disk
Date: Mon, 4 Jan 2016 23:41:11 +0100	[thread overview]
Message-ID: <568AF507.70107@whgl.uni-frankfurt.de> (raw)
In-Reply-To: <1451946046.3914.13.camel@debian.org>

The Startsector of the Partition should NEVER be odd, rather even. 65536 
would be fine, that's why lsblk gives an alignment of -1 for 
scapa-backup I guess.

It does not matter if you use MBR or GPT, well, not too much for this 
matter. The GPT is 34 LBA blocks (of 512 bytes). It can possibly be 
longer to host more than 128 Partition entries, but no way close to 2048 
which would resemble 1MByte. So 2048s would be a good place to start 
your partition. It is aligned to 1 MByte, as well as 4KByte ... it even 
is aligned to all major SSD Page-Sizes and SSD Erase-Block-Sizes.

Anyhow you either need to align the start of your partition or you'll 
have an extremly hard time aligning the dm-crypt offset manually at the 
right place.

Regards

-Sven

P.S.: If you still have a chance to change things, better do it now!


Am 04.01.2016 um 23:20 schrieb Yves-Alexis Perez:
> On lun., 2016-01-04 at 22:54 +0100, Sven Eschenberg wrote:
>> Hi,
>>
>> start=4194304 -> assumind this is in 512 byte blocks, the start sector
>> is aligned to MByte boundary and thus 4k boundary.
>>
>> Anyway, if your device only has one partition which is encrypted with
>> dm-crypt, set it up to start at sector 2048 (which should be default for
>> parted, fdisk and so on). Pass align-payload 2048 during creation of the
>> LUKS header, which will give you an MByte boundary and should always be
>> okay.
>>
>> If the kernel still complains, then something else might be going wrong.
>
> Right now I have:
>
> root@scapa:~# lsblk -o +ALIGNMENT /dev/sdc
> NAME             MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT        ALIGNMENT
> sdc                8:32   0 931.5G  0 disk                            0
> └─sdc1             8:33   0 931.5G  0 part                          512
>    └─scapa-backup 253:4    0 931.4G  0 crypt /mnt/scapa-backup        -1
>
> And:
>
> scapa-backup: 0 1953336209 crypt aes-xts-plain64
> 0000000000000000000000000000000000000000000000000000000000000000 0 8:33 65536
>
> root@scapa:~# fdisk -l /dev/sdc
> Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 4096 bytes
> I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
> Disklabel type: gpt
> Disk identifier: EBA98857-89BA-4B2C-8366-4A77A527A8E0
>
> Device     Start        End    Sectors   Size Type
> /dev/sdc1  65535 1953467279 1953401745 931.5G Linux filesystem
>
> Partition 1 does not start on physical sector boundary.
>
> [I'm a bit concerned with that, but since I'm using a GPT and not MBR it might
> be related]
>
> root@scapa:~# gdisk -l /dev/sdc
> GPT fdisk (gdisk) version 1.0.1
>
> Partition table scan:
>    MBR: protective
>    BSD: not present
>    APM: not present
>    GPT: present
>
> Found valid GPT with protective MBR; using GPT.
> Disk /dev/sdc: 1953525168 sectors, 931.5 GiB
> Logical sector size: 512 bytes
> Disk identifier (GUID): EBA98857-89BA-4B2C-8366-4A77A527A8E0
> Partition table holds up to 128 entries
> First usable sector is 34, last usable sector is 1953525134
> Partitions will be aligned on 8-sector boundaries
> Total free space is 123356 sectors (60.2 MiB)
>
> Number  Start (sector)    End (sector)  Size       Code  Name
>     1           65535      1953467279   931.5 GiB   8300  scapa-backup
>
> Regards,
>
>
>
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
>

  reply	other threads:[~2016-01-04 22:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 21:31 [dm-crypt] Alignment issue with 4K disk Yves-Alexis Perez
2016-01-04 21:54 ` Sven Eschenberg
2016-01-04 22:20   ` Yves-Alexis Perez
2016-01-04 22:41     ` Sven Eschenberg [this message]
2016-01-04 23:02     ` Sven Eschenberg
2016-01-05 10:14       ` Yves-Alexis Perez
2016-01-07 18:00         ` .. ink ..
2016-01-09 12:30           ` Milan Broz
2016-01-09 14:47             ` Sven Eschenberg
2016-01-10  0:25 Eugen Rogoza
2016-01-10  1:14 ` Sven Eschenberg
2016-01-10  4:30   ` Sven Eschenberg
2016-01-10 15:18 Eugen Rogoza
2016-01-10 15:37 Eugen Rogoza
2016-01-10 17:22 Eugen Rogoza
2016-01-10 19:13 ` Sven Eschenberg
2016-01-10 20:20   ` Eugen Rogoza
2016-01-10 21:00     ` 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=568AF507.70107@whgl.uni-frankfurt.de \
    --to=sven@whgl.uni-frankfurt.de \
    --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.