[Parted-maintainers] Bug#923561: parted: Incorrect optimal alignment for USB device
Kevin Locke
kevin at kevinlocke.name
Fri Mar 1 23:04:34 GMT 2019
Package: parted
Version: 3.2-24
Severity: normal
Dear Maintainer,
Running `parted /dev/sdb mkpart primary 0% 100%` on an 8TB Seagate
"Backup Plus Hub" USB3 drive results in a partition which starts at
65535s (33553920B), which is not a multiple of the physical block size
(4096B). It also causes parted `parted /dev/sdb mkpart primary 1MiB 100%`
to print "Warning: The resulting partition is not properly aligned for
best performance."
If this partition is used by device-mapper, the kernel will print:
device-mapper: table: 254:2: adding target device sdb1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=33553920
The drive has the following topology (lsblk -t /dev/sdb):
NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME
sdb 0 4096 33553920 4096 512 1 mq-deadline 60 128 32M
Presumably the error occurs because parted is using the optimal_io_size
for alignment. Since optimal_io_size is based on USB constraints rather
than disk constraints, it does not seem suitable for partition layout.
I would suggest ignoring optimal_io_size if it is not a multiple of
minimum_io_size, as done by cryptsetup[1]. Alternatively, 33553920
could be ignored specifically, since it seems common for USB disks.
This issue has been discussed elsewhere:
https://www.saout.de/pipermail/dm-crypt/2016-January/004934.html
https://bugzilla.redhat.com/show_bug.cgi?id=1513820
https://unix.stackexchange.com/q/340484
https://linux-blog.anracom.com/2018/12/03/linux-ssd-partition-alignment-problems-with-external-usb-to-sata-controllers-i/
Thanks for considering,
Kevin
[1]: https://gitlab.com/cryptsetup/cryptsetup/commit/b80278c0
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.20.10 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages parted depends on:
ii libc6 2.28-7
ii libparted2 3.2-24
ii libreadline7 7.0-5
ii libtinfo6 6.1+20181013-2
parted recommends no packages.
Versions of packages parted suggests:
pn parted-doc <none>
-- no debconf information
More information about the Parted-maintainers
mailing list