[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kernel: device-mapper: table: 254:1: adding target device sda1 caused an alignment inconsistency



On Sat 28 Jul 2018 at 10:57:45 (-0300), Henrique de Moraes Holschuh wrote:
> On Sat, 28 Jul 2018, Rick Thomas wrote:
> > > rbthomas@small:~$ lsblk -t
> > > NAME           ALIGNMENT MIN-IO   OPT-IO PHY-SEC LOG-SEC ROTA SCHED       RQ-SIZE  RA WSAME
> > > sda                    0   4096 33553920    4096     512    1 mq-deadline      60 128    0B
> > > `-sda1                 0   4096 33553920    4096     512    1 mq-deadline      60 128    0B
> > >   |-small-swap        -1   4096        0    4096     512    1                 128 128   32M
> > >   |-small-root        -1   4096        0    4096     512    1                 128 128   32M
> > >   `-small-home        -1   4096        0    4096     512    1                 128 128   32M
> > > mmcblk2                0    512        0     512     512    0 mq-deadline     128 128    0B
> > > |-mmcblk2p1            0    512        0     512     512    0 mq-deadline     128 128    0B
> > > `-mmcblk2p2            0    512        0     512     512    0 mq-deadline     128 128    0B
> > > rbthomas@small:~$ 
> > 
> > Note the alignment values of “-1” for the lvm entries but not for the GPT partition or the whole disk.
> > Why do you suppose that is?
> 
> Keep in mind that you *offset*-align the outer container *only*, and then inside
> you just keep the size alignment.
> 
> So, the above ensures correct use of the partitions even if sda1 is
> unaligned.
> 
> If you offset-align sda1 to -1, everything inside it should have an offset of
> zero to keep the alignment correct.

I don't think I fully understand the explanation. Can you point out
the number(s) that's wrong, and how it should be corrected.
(To which number does the -1 apply, and what units is it in?)

Below, sda is internal, sdb is USB-connected. The latter causes a pair
of messages when sdb2 is unlocked:

 device-mapper: table: 254:1: adding target device sdb2 caused an alignment inconsistency:
 physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=33553920
 device-mapper: table: 254:1: adding target device sdb2 caused an alignment inconsistency:
 physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=33553920

What is it that "starts" at 33553920?

$ lsblk -t
NAME          ALIGNMENT MIN-IO   OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE  RA WSAME
sda                   0   4096        0    4096     512    1 cfq       128 128    0B
├─sda1                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda2                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda3                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda4                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda5                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda6                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda7                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda8                0   4096        0    4096     512    1 cfq       128 128    0B
│ └─swanhome          0   4096        0    4096     512    1           128 128    0B
├─sda9                0   4096        0    4096     512    1 cfq       128 128    0B
├─sda10               0   4096        0    4096     512    1 cfq       128 128    0B
├─sda11               0   4096        0    4096     512    1 cfq       128 128    0B
├─sda12               0   4096        0    4096     512    1 cfq       128 128    0B
├─sda13               0   4096        0    4096     512    1 cfq       128 128    0B
└─sda14               0   4096        0    4096     512    1 cfq       128 128    0B
sdb                   0   4096 33553920    4096     512    1 cfq       128 128   32M
├─sdb1                0   4096 33553920    4096     512    1 cfq       128 128   32M
└─sdb2                0   4096 33553920    4096     512    1 cfq       128 128   32M
  └─luks-0229da67-…  -1   4096        0    4096     512    1           128 128    0B
$ 

Here's the partitioning of these disks:

$ sudo gdisk -l /dev/sda
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/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2653F13F-2CD0-406F-B004-6AFFDBE18127
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4077 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2050047   1000.0 MiB  2700  Basic data partition
   2         2050048         2582527   260.0 MiB   EF00  EFI system partition
   3         2582528         4630527   1000.0 MiB  ED01  Basic data partition
   4         4630528         4892671   128.0 MiB   0C01  Microsoft reserved ...
   5         4892672       347348991   163.3 GiB   0700  Basic data partition
   6       347348992       429268991   39.1 GiB    8300  Linux-A
   7       429268992       511188991   39.1 GiB    8300  Linux-B
   8       511188992       883275775   177.4 GiB   8300  Linux-Home
   9       883275776       883292159   8.0 MiB     EF02  Linux-BIOS-Boot
  10       883292160       892084223   4.2 GiB     8200  Linux-Swap
  11       892086272       892803071   350.0 MiB   2700  
  12       892803072       894900223   1024.0 MiB  0700  Basic data partition
  13       894900224       947329023   25.0 GiB    0700  Basic data partition
  14       947329024       976773119   14.0 GiB    2700  Basic data partition
$ 

$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 931.5 GiB, 1000204885504 bytes, 1953525167 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: dos
Disk identifier: 0x6bc6bcdc

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdb1             2048 1302349823 1302347776   621G  7 HPFS/NTFS/exFAT
/dev/sdb2       1302349824 1953521663  651171840 310.5G  c W95 FAT32 (LBA)
$ 

In case it helps:

# cryptsetup luksFormat /dev/sdb2
[…]
# cryptsetup open --type luks /dev/sdb2 thequiz
Enter passphrase for /dev/sdb2: 
# mkdosfs -v -i 20141210 -F 32 -n quiz02 /dev/mapper/thequiz
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS
or Windows
/dev/mapper/thequiz has 255 heads and 63 sectors per track,
hidden sectors 0x0000;
logical sector size is 512,
using 0xf8 media descriptor, with 651106305 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 64 sectors per cluster.
FAT size is 79488 sectors, and provides 10171051 clusters.
There are 64 reserved sectors.
Volume ID is 20141210, volume label quiz02     .
# cryptsetup luksClose thequiz
# 

Cheers,
David.


Reply to: