I shrank the original NTFS partition on a 1TB USB drive to make room
for an encrypted FAT32 filesystem after it. The partition table is:

# 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)
# 

and I left a gap at the end for a 1MB alignment (and future-proofing).
After running badblocks on sdb2, I created a LUKS container and made
the FAT32 filesystem:

# 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
# 

However, I now get this logged:

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

Two of these lines came when I formatted the filesystem, and two more
when I reopened the container in order to:

# cryptsetup open --type luks /dev/sdb2 thequiz
Enter passphrase for /dev/sdb2: 
# dmsetup table
swanhome: 0 372082688 crypt aes-xts-plain64
0000000000000000000000000000000000000000000000000000000000000000 0 8:8 4096
thequiz: 0 651106305 crypt aes-xts-plain64
0000000000000000000000000000000000000000000000000000000000000000 0 8:18 65535
# 

The number of sectors 651106305 matches the filesystem size, and 8:18
matches /run/udev/data/b8:18, but I don't know the significance of 65535.

Should I recreate the partition, container, or filesystem, and what
extra data would I supply to improve things? (The FAT32 filesystem
is currently empty.) I can't see numbers here that indicate misalignment.

Cheers,
David.

Reply via email to