[dm-crypt] Re: Aligning entire LUKS/LVM/Ext4 filesystem stack to 4K sectors

Johnny Dahlberg <[email protected]> Wed, 24 Mar 2021 20:53:00 +0100
Newsgroups de.saout.dm-crypt
Message-ID <CA+3G=9jwG465ALjufeuK5ihSQxe5-iOCE5ZhkXh11s+_rqnB6w@mail.gmail.com>
On Fri, 19 Mar 2021 at 23:21, Carlos E. R. <[email protected]>
wrote:

> On 19/03/2021 22.39, Johnny Dahlberg wrote:
> > On 19/03/2021, Carlos E. R. <[email protected]> wrote:
> >> On 19/03/2021 21.24, Johnny Dahlberg wrote:
> >>> On 19/03/2021, Maksim Fomin <> wrote:
> >>>>> On Friday, 19 March 2021 г., 19:09, Johnny Dahlberg <> wrote:
> >>
> >> ...
>
>
> >> Related question:
> >>
> >> How can one, on an exiting encrypted partition, find out what size is
> >> using each layer, and if they are aligned or not?
> >>
> >> I am using encrypted partitions on SSD and I'm a bit worried.
> >>
> >>
> >
> > Hello Carlos!
> >
> > First you would check the physical sector size of your SSD. It is most
> > likely 4096 bytes (4K). You can check this by doing:
> >
> > cat /sys/block/(the parent device such as
> nvme0n1)/queue/physical_block_size
>
> On the two machines I have running now, both have an nvme system disk,
> but only one has the encrypted partition on it; both use 512:
>
> cer@Telcontar:~> cat /sys/block/nvme0n1/queue/physical_block_size
> 512
> cer@Telcontar:~>
>
> Isengard:~ # cat /sys/block/sda/queue/physical_block_size
> 512
> Isengard:~ #
>
> Hum!
>

Since January 2011, all manufacturers began using Advanced Format (4096
bytes): https://en.m.wikipedia.org/wiki/Advanced_Format#History

From what I can find online, your Samsung 970 Evo Plus uses 8K sectors
physically.


> I think I'm good -  no worries :-)
>
> Thanks! :-)
>
> --
> Cheers / Saludos,
>
>                 Carlos E. R.
>                 (from 15.2 x86_64 at Telcontar)
>

If you want to check everything for sure, and learn everything important
that there is to know about these things, you can check out my new guide /
alignment checker tool at:

https://bananaman.github.io/friendly-guides/pages/storage_alignment.html

You just type in your current values in each field and it will tell you
whether they're aligned to your physical sectors, or better yet to MiB
boundaries (which is guaranteed to be aligned to all physical sector sizes
no matter what your drive uses).

Every step tells you which commands to run to check that particular value.

There's also plenty of interesting information to learn on there.

Take care!

-- Johnny

_______________________________________________
dm-crypt mailing list -- [email protected]
To unsubscribe send an email to [email protected]