From unknown Sat Jun 21 03:06:03 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#25103 <25103@debbugs.gnu.org> To: bug#25103 <25103@debbugs.gnu.org> Subject: Status: partition alignment Reply-To: bug#25103 <25103@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:06:03 +0000 retitle 25103 partition alignment reassign 25103 parted submitter 25103 Volta severity 25103 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 03 23:39:26 2016 Received: (at submit) by debbugs.gnu.org; 4 Dec 2016 04:39:26 +0000 Received: from localhost ([127.0.0.1]:51787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDOaE-000076-8w for submit@debbugs.gnu.org; Sat, 03 Dec 2016 23:39:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDM13-00015K-2i for submit@debbugs.gnu.org; Sat, 03 Dec 2016 20:54:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDM0w-00021D-I0 for submit@debbugs.gnu.org; Sat, 03 Dec 2016 20:54:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35115) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cDM0w-000215-Ea for submit@debbugs.gnu.org; Sat, 03 Dec 2016 20:54:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDM0u-0004J0-1Z for bug-parted@gnu.org; Sat, 03 Dec 2016 20:54:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDM0s-0001yX-JI for bug-parted@gnu.org; Sat, 03 Dec 2016 20:54:48 -0500 Received: from mail-ua0-x22a.google.com ([2607:f8b0:400c:c08::22a]:36729) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cDM0s-0001yB-8E for bug-parted@gnu.org; Sat, 03 Dec 2016 20:54:46 -0500 Received: by mail-ua0-x22a.google.com with SMTP id b35so317369988uaa.3 for ; Sat, 03 Dec 2016 17:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=cIQfsNCsCy6MHvTGYDQGh9vplm/p2Ywr2IC+BFgRkuM=; b=Yr1MuX8E2MMQnewO9xEl2aJE3PUyhX+PiaCn7+bZ/ZSRmuUbqLWFssmjkdXf2zzyqJ 7tKD8Q/v9YG2MmUXzE6SkmKjO8QclRd6+9dqYHU+l+TiyUm3XpkN85VnTijHSXj5JHM3 XUA7hgey9hF3IilxU1/by2YtZVoAYnfLrMmRqoqqzktilnkmf7nMWGhVpe7lmCIsNmFH WeikkcAz3E/NxRhW29TldVTNSBPDrJRECqq6VIUeZm6TeyzwlotqRiHzHGUS7n5Gdiem CSV9tIkCBnffZF6nisgWQVAS4U4wU6q/HlANYxMEAyCgSsgmiwOysx9xlTnRxgToDCFV 98sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=cIQfsNCsCy6MHvTGYDQGh9vplm/p2Ywr2IC+BFgRkuM=; b=VGa/RFON6rqb3A6iEKhXtYgF5UcgaZfr1OBgGKVX0IwYrl7kKNGV8KGNymNsAuKsSo h6wVD/LEfSXw7CZl902tU1ardtFv3+P/a9oKjp1+3bDRx1Kt4ylBfTHW4RuLoJhIoE47 rotOKBLhFBW/f0aq8+XTmC/hWIeCg9VEjH2W78mSnIf76UsoIznEB1JbUsg8J9EStAno Ez4b1tHC0BPphSi+fBsPKXW2IoZcXubLqm7fGiaBaC6KYPxJ9Nrg2I0mRxb3vovCB4bX x6s1C984STKvbd0bgAKH4GyOOG/HnX7l8QdAo4+A/2QqYVTKPX2raAVivlrKNodZC8Cw Cz3A== X-Gm-Message-State: AKaTC00fZzH8CW8FmdL1wsZab0kh6/ucZwiviYlHSRAzzXGHoY1bWvOT8u8lSAiWj10nK6WVeq4ER2y4dOrH2w== X-Received: by 10.176.64.42 with SMTP id h39mr22764315uad.85.1480816484732; Sat, 03 Dec 2016 17:54:44 -0800 (PST) MIME-Version: 1.0 From: Volta Date: Sun, 04 Dec 2016 01:54:33 +0000 Message-ID: Subject: partition alignment To: bug-parted@gnu.org Content-Type: multipart/alternative; boundary=94eb2c122ce88cd6c00542cb7470 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 03 Dec 2016 23:39:25 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c122ce88cd6c00542cb7470 Content-Type: text/plain; charset=UTF-8 I'm not sure if this is a bug in parted (parted 3.2 on Ubuntu 16.04.1LTS x86-64), or a bug in my understanding of the concepts. Either way I'd like to know. I've got a new 8TB drive for which the "optimal" alignment calculated by parted doesn't satisfy the "minimal" alignment check. My understanding is the "minimal" check verifies the partition is aligned to physical blocks on the disk, so it seems impossible for an alignment that doesn't pass that check to truly be "optimal". Indeed, the documentation specifies "optimal" is a aligned to a multiple of the physical block size. For this drive, "--align opt" creates a partition starting at 65535s: -- 8< -- $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 0% 100% u s p free a min 1 a opt 1 Model: Seagate Expansion Desk (scsi) Disk /dev/sdi: 15628053167s Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 34s 65534s 65501s Free Space 1 65535s 15628000379s 15627934845s ext4 8tb 15628000380s 15628053133s 52754s Free Space 1 not aligned 1 aligned -- 8< -- So, I fell back to how we used to do this, but the numbers are... weird: -- 8< -- $ cat /sys/block/sdi/queue/optimal_io_size 33553920 $ cat /sys/block/sdi/queue/minimum_io_size 4096 $ cat /sys/block/sdi/queue/physical_block_size 4096 $ cat /sys/block/sdi/queue/logical_block_size 512 $ cat /sys/block/sdi/alignment_offset 0 -- 8< -- ( 33553920 + 0 ) / 4096 = 8191.875, but that's not going to work. Using the logical block size instead gives the 65535s that parted suggested, but if my understanding is correct that's not actually a good alignment. I can get a partition that satisfies both checks by scaling the 65535s out to align with a 4k block, and starting the partition at 524280s, at the cost of "wasting" ~300MiB of space: -- 8< -- $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 524280s 100% u s p free a min 1 a opt 1 Model: Seagate Expansion Desk (scsi) Disk /dev/sdi: 15628053167s Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 34s 524279s 524246s Free Space 1 524280s 15628000379s 15627476100s ext4 8tb 15628000380s 15628053133s 52754s Free Space 1 aligned 1 aligned -- 8< -- ~300MiB out of 7.3TiB isn't the end of the world, so that's what I've gone with for now, but I wonder if I'm not overthinking it. Was parted's original optimal alignment actually fine and my understanding incorrect? If not, is there a better way than what I've done to calculate an alignment that is? For the near-term there's no data on this device so I'm perfectly happy to burn it down for testing. Thanks, -V -- 8< -- $ sudo parted /dev/sdi print unit s print unit chs print Model: Seagate Expansion Desk (scsi) Disk /dev/sdi: 8002GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 268MB 8002GB 8001GB 8tb Model: Seagate Expansion Desk (scsi) Disk /dev/sdi: 15628053167s Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 524280s 15628000379s 15627476100s 8tb Model: Seagate Expansion Desk (scsi) Disk /dev/sdi: 972801,80,61 Sector size (logical/physical): 512B/4096B BIOS cylinder,head,sector geometry: 972801,255,63. Each cylinder is 8225kB. Partition Table: gpt Disk Flags: Number Start End File system Name Flags 1 32,161,57 972798,8,5 8tb -- 8< -- --94eb2c122ce88cd6c00542cb7470 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm not sure if t= his is a bug in parted (parted 3.2 on Ubuntu 16.04.1LTS x86-64), or a bug i= n my understanding of the concepts.=C2=A0 Either way I'd like to know.<= div class=3D"gmail_msg">
I've got a new 8TB drive for which the "optimal" alignmen= t calculated by parted doesn't satisfy the "minimal" alignmen= t check. My understanding is the "minimal" check verifies the par= tition is aligned to physical blocks on the disk, so it seems impossible fo= r an alignment that doesn't pass that check to truly be "optimal&q= uot;.=C2=A0 Indeed, the documentation specifies "optimal" is a al= igned to a multiple of the physical block size.

For this drive, &= quot;--align opt" creates a partition starting at 65535s:

--= 8< --
$ sudo par= ted --align opt /dev/sdi mkpart 8tb ext4 0% 100% u s p free a min 1 a opt 1=
Model: Seagate Expansion Desk (scsi)
Disk /dev/sdi: 15628053167s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:=C2=A0

Number =C2=A0Start =C2=A0 =C2=A0 =C2=A0 =C2=A0 End =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 Size =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0File system =C2= =A0Name =C2=A0Flags
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 34s =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 65534s =C2=A0 =C2=A0 =C2=A0 =C2= =A065501s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space
=C2=A01 =C2=A0 =C2=A0 =C2=A065535s =C2=A0 =C2=A0 =C2=A0 =C2=A01562800037= 9s =C2=A015627934845s =C2=A0ext4 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
=C2=A0 =C2=A0 =C2=A0 =C2=A0 15628000380s =C2=A015628053= 133s =C2=A052754s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space

1 not ali= gned
1 aligned
-- 8< --
So, I fell back to how = we used to do this, but the numbers are... weird:

-- 8< --
$ cat /sys/block/sdi/queue/optimal_io_size= =C2=A0
33553920
$ cat /sys/block/sdi/queue/minimum_io_size=C2=A0
4096
$ cat /sys/block/sdi/queue/physical= _block_size=C2=A0
4096
$ cat /sys/block/sdi/queue/logical_block_size
512
$ cat /sys/block/sdi/alignment_o= ffset=C2=A0
0
-- 8< --

(=C2=A033553920=C2=A0+ 0 ) / 4096 =3D 8191.875, but that's not g= oing to work. Using the logical block size instead gives the 65535s that pa= rted suggested, but if my understanding is correct that's not actually = a good alignment.

I can get a partition that satisfies both checks by scaling the 655= 35s out to align with a 4k block, and starting the partition at 524280s, at= the cost of "wasting" ~300MiB of space:

-- 8< --
$ sudo parted --align opt /dev/sdi mkp= art 8tb ext4 524280s 100% u s p free a min 1 a opt 1
Model: Seagate Expansion Desk (scsi)
= Disk /dev/sdi: 15628053167s
Sector size (logi= cal/physical): 512B/4096B
Partition Table: gp= t
Disk Flags:=C2=A0

Number =C2=A0Start =C2=A0 =C2=A0 = =C2=A0 =C2=A0 End =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Size =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0File system =C2=A0Name =C2=A0Flags
=C2=A0 =C2=A0 =C2=A0 =C2=A0 34s =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5= 24279s =C2=A0 =C2=A0 =C2=A0 524246s =C2=A0 =C2=A0 =C2=A0 Free Space
=C2=A01 =C2=A0 =C2=A0 =C2=A0524280s =C2=A0 =C2=A0 = =C2=A0 15628000379s =C2=A015627476100s =C2=A0ext4 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 8tb
=C2=A0 =C2=A0 =C2=A0 =C2=A0 156280003= 80s =C2=A015628053133s =C2=A052754s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space

1 aligned
1 aligned
-- 8< --

=
~300MiB out of 7.3TiB isn't the end of the world, so that= 9;s what I've gone with for now, but I wonder if I'm not overthinki= ng it.=C2=A0 Was parted's original optimal alignment actually fine and = my understanding incorrect? If not, is there a better way than what I'v= e done to calculate an alignment that is?

For the = near-term there's no data on this device so I'm perfectly happy to = burn it down for testing.=C2=A0

Thanks,
=
=C2=A0-V

-- 8< --
$ sudo parted /dev/sdi print unit s print unit chs print
Model: = Seagate Expansion Desk (scsi)
Disk /dev/sdi: 8002GB
Sec= tor size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:=C2=A0

Number =C2=A0Start =C2=A0E= nd =C2=A0 =C2=A0 Size =C2=A0 =C2=A0File system =C2=A0Name =C2=A0Flags
=
=C2=A01 =C2=A0 =C2=A0 =C2=A0268MB =C2=A08002GB =C2=A08001GB =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb

Model: = Seagate Expansion Desk (scsi)
Disk /dev/sdi: 15628053167s
Sector size (logical/physical): 512B/4096B
Partition Table: gp= t
Disk Flags:=C2=A0

Number =C2=A0Start = =C2=A0 =C2=A0End =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Size =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0File system =C2=A0Name =C2=A0Flags
=C2=A01 =C2= =A0 =C2=A0 =C2=A0524280s =C2=A015628000379s =C2=A015627476100s =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb

Model: = Seagate Expansion Desk (scsi)
Disk /dev/sdi: 972801,80,61
Sector size (logical/physical): 512B/4096B
BIOS cylinder,head,= sector geometry: 972801,255,63.=C2=A0 Each cylinder is 8225kB.
Pa= rtition Table: gpt
Disk Flags:=C2=A0

Num= ber =C2=A0Start =C2=A0 =C2=A0 =C2=A0End =C2=A0 =C2=A0 =C2=A0 =C2=A0 File sy= stem =C2=A0Name =C2=A0Flags
=C2=A01 =C2=A0 =C2=A0 =C2=A032,161,57= =C2=A0972798,8,5 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
-- 8< --
--94eb2c122ce88cd6c00542cb7470-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 04 03:23:25 2016 Received: (at 25103) by debbugs.gnu.org; 4 Dec 2016 08:23:25 +0000 Received: from localhost ([127.0.0.1]:51815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDS4y-0005UN-GT for submit@debbugs.gnu.org; Sun, 04 Dec 2016 03:23:25 -0500 Received: from mail-io0-f171.google.com ([209.85.223.171]:35399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDQi9-0003VM-2p for 25103@debbugs.gnu.org; Sun, 04 Dec 2016 01:55:45 -0500 Received: by mail-io0-f171.google.com with SMTP id a124so549185162ioe.2 for <25103@debbugs.gnu.org>; Sat, 03 Dec 2016 22:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5WFAFFzJlnjh7e4L8hpNK+1E7/j1JNHNoCJljknmITg=; b=X5i5zr6zrZi2Yim79vWUdBDIWsV4yLTtEjwJOwGGsV3qVffJMGRwd5nOMxcvri7GnK vcaNaH1FxpXGJSUIDtJbMmLVciPCE1JIXG2MBBvb4OLDyN7noClxzIcnZkK3ggCEjPDV 7u6fua+YUmYIVtII9PUdfzxeW4+yYYjNzJbFNsPW8j48PuGJ/bMjtoB5ukPKzXijNAOb 1eSmx1rGp6hfCOoVIWmndfFDrFoBRW8ygGAmPBvN4pY1HVr3DWPwUj88gQUnfist2Xto mmZkGIHNgxLzVIsImBKm55e5VHFpmrh1SIlsNXUmlHxnkyIDn3SfIpYSfryOngZPa55m ee3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5WFAFFzJlnjh7e4L8hpNK+1E7/j1JNHNoCJljknmITg=; b=PC1hVRx7wpshpiwFcQcN3pJ6u5+Q5xiZ72JXqFjv1F0oVcpdkDkoqpxZD3opwxE4mx XRtBIk3HCjH3ilYqIHOE311G6/Q7SeyFycGtGTIBBMpQ2BeHheLWx/vaIUXqEFCNpXQl pCzannGxqkbhP/gSqlgJWSmsmy5tU5hasj3T7fuOdPaYYrZTXO5o83WgNVwqWcMghXBM 8bFGoqJFIZTysooWcKK3sGQjvq087fXb6b8GN9oHa8y2PX9zLvObWQEt8fPQgnjwfTpn +ngceYMduIWBaK4VvOKuLbgjFqBPicPhRYAM40OHUPpLADGj1UdeBHsoSz4PX63iTf0Q ObMA== X-Gm-Message-State: AKaTC01PaHBmI/mn/gng8ao9Nqx8wWntrD3VUgRaBNLYvMckDQEFIuvAPSg8w2i5KOeafhtrHIIp+sKCKur5nw== X-Received: by 10.36.103.200 with SMTP id u191mr3992725itc.8.1480834539122; Sat, 03 Dec 2016 22:55:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.200.210 with HTTP; Sat, 3 Dec 2016 22:55:37 -0800 (PST) Received: by 10.107.200.210 with HTTP; Sat, 3 Dec 2016 22:55:37 -0800 (PST) In-Reply-To: References: From: Josep Lladonosa Date: Sun, 4 Dec 2016 07:55:37 +0100 Message-ID: Subject: Re: bug#25103: partition alignment To: Volta Content-Type: multipart/alternative; boundary=001a11484f56acf57c0542cfa8f1 X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25103 X-Mailman-Approved-At: Sun, 04 Dec 2016 03:23:23 -0500 Cc: 25103@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --001a11484f56acf57c0542cfa8f1 Content-Type: text/plain; charset=UTF-8 On 4 Dec 2016 05:40, "Volta" wrote: > > I'm not sure if this is a bug in parted (parted 3.2 on Ubuntu 16.04.1LTS x86-64), or a bug in my understanding of the concepts. Either way I'd like to know. > > I've got a new 8TB drive for which the "optimal" alignment calculated by parted doesn't satisfy the "minimal" alignment check. My understanding is the "minimal" check verifies the partition is aligned to physical blocks on the disk, so it seems impossible for an alignment that doesn't pass that check to truly be "optimal". Indeed, the documentation specifies "optimal" is a aligned to a multiple of the physical block size. > > For this drive, "--align opt" creates a partition starting at 65535s: > > -- 8< -- > $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 0% 100% u s p free a min 1 a opt 1 > Model: Seagate Expansion Desk (scsi) > Disk /dev/sdi: 15628053167s > Sector size (logical/physical): 512B/4096B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > 34s 65534s 65501s Free Space > 1 65535s 15628000379s 15627934845s ext4 8tb > 15628000380s 15628053133s 52754s Free Space > > 1 not aligned > 1 aligned > -- 8< -- > > So, I fell back to how we used to do this, but the numbers are... weird: > > -- 8< -- > $ cat /sys/block/sdi/queue/optimal_io_size > 33553920 Maybe this value is not drive related but usb bus related. Is that a usb drive? I guess so. Found similar cases. One of them: https://www.mail-archive.com/search?l=linux-usb@vger.kernel.org&q=subject:%22Re%5C%3A+questions+about+uas%22&o=newest&f=1 > $ cat /sys/block/sdi/queue/minimum_io_size > 4096 > $ cat /sys/block/sdi/queue/physical_block_size > 4096 > $ cat /sys/block/sdi/queue/logical_block_size > 512 > $ cat /sys/block/sdi/alignment_offset > 0 > -- 8< -- > > ( 33553920 + 0 ) / 4096 = 8191.875, but that's not going to work. Using the logical block size instead gives the 65535s that parted suggested, but if my understanding is correct that's not actually a good alignment. > > I can get a partition that satisfies both checks by scaling the 65535s out to align with a 4k block, and starting the partition at 524280s, at the cost of "wasting" ~300MiB of space: > > -- 8< -- > $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 524280s 100% u s p free a min 1 a opt 1 > Model: Seagate Expansion Desk (scsi) > Disk /dev/sdi: 15628053167s > Sector size (logical/physical): 512B/4096B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > 34s 524279s 524246s Free Space > 1 524280s 15628000379s 15627476100s ext4 8tb > 15628000380s 15628053133s 52754s Free Space > > 1 aligned > 1 aligned > -- 8< -- > > ~300MiB out of 7.3TiB isn't the end of the world, so that's what I've gone with for now, but I wonder if I'm not overthinking it. Was parted's original optimal alignment actually fine and my understanding incorrect? If not, is there a better way than what I've done to calculate an alignment that is? > > For the near-term there's no data on this device so I'm perfectly happy to burn it down for testing. > > Thanks, > > -V > > -- 8< -- > $ sudo parted /dev/sdi print unit s print unit chs print > Model: Seagate Expansion Desk (scsi) > Disk /dev/sdi: 8002GB > Sector size (logical/physical): 512B/4096B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > 1 268MB 8002GB 8001GB 8tb > > Model: Seagate Expansion Desk (scsi) > Disk /dev/sdi: 15628053167s > Sector size (logical/physical): 512B/4096B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > 1 524280s 15628000379s 15627476100s 8tb > > Model: Seagate Expansion Desk (scsi) > Disk /dev/sdi: 972801,80,61 > Sector size (logical/physical): 512B/4096B > BIOS cylinder,head,sector geometry: 972801,255,63. Each cylinder is 8225kB. > Partition Table: gpt > Disk Flags: > > Number Start End File system Name Flags > 1 32,161,57 972798,8,5 8tb > -- 8< -- --001a11484f56acf57c0542cfa8f1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On 4 Dec 2016 05:40, "Volta" <xvolta@gmail.com> wrote:
>
> I'm not sure if this is a bug in parted (parted 3.2 on Ubuntu 16.0= 4.1LTS x86-64), or a bug in my understanding of the concepts.=C2=A0 Either = way I'd like to know.
>
> I've got a new 8TB drive for which the "optimal" alignme= nt calculated by parted doesn't satisfy the "minimal" alignme= nt check. My understanding is the "minimal" check verifies the pa= rtition is aligned to physical blocks on the disk, so it seems impossible f= or an alignment that doesn't pass that check to truly be "optimal&= quot;.=C2=A0 Indeed, the documentation specifies "optimal" is a a= ligned to a multiple of the physical block size.
>
> For this drive, "--align opt" creates a partition starting a= t 65535s:
>
> -- 8< --
> $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 0% 100% u s p free = a min 1 a opt 1
> Model: Seagate Expansion Desk (scsi)
> Disk /dev/sdi: 15628053167s
> Sector size (logical/physical): 512B/4096B
> Partition Table: gpt
> Disk Flags:=C2=A0
>
> Number =C2=A0Start =C2=A0 =C2=A0 =C2=A0 =C2=A0 End =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 Size =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0File system =C2=A0= Name =C2=A0Flags
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 34s =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 655= 34s =C2=A0 =C2=A0 =C2=A0 =C2=A065501s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space=
> =C2=A01 =C2=A0 =C2=A0 =C2=A065535s =C2=A0 =C2=A0 =C2=A0 =C2=A015628000= 379s =C2=A015627934845s =C2=A0ext4 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 15628000380s =C2=A015628053133s =C2=A05275= 4s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space
>
> 1 not aligned
> 1 aligned
> -- 8< --
>
> So, I fell back to how we used to do this, but the numbers are... weir= d:
>
> -- 8< --
> $ cat /sys/block/sdi/queue/optimal_io_size=C2=A0
> 33553920

Maybe this value is not drive related but usb bus related. I= s that a usb drive? I guess so. Found similar cases. One of them:

https://www.mail-archive.com/search?l=3Dlinux-usb@vger= .kernel.org&q=3Dsubject:%22Re%5C%3A+questions+about+uas%22&o=3Dnewe= st&f=3D1


> $ cat /sys/block/sdi/queue/minimum_io_size=C2=A0
> 4096
> $ cat /sys/block/sdi/queue/physical_block_size=C2=A0
> 4096
> $ cat /sys/block/sdi/queue/logical_block_size
> 512
> $ cat /sys/block/sdi/alignment_offset=C2=A0
> 0
> -- 8< --
>
> (=C2=A033553920=C2=A0+ 0 ) / 4096 =3D 8191.875, but that's not goi= ng to work. Using the logical block size instead gives the 65535s that part= ed suggested, but if my understanding is correct that's not actually a = good alignment.
>
> I can get a partition that satisfies both checks by scaling the 65535s= out to align with a 4k block, and starting the partition at 524280s, at th= e cost of "wasting" ~300MiB of space:
>
> -- 8< --
> $ sudo parted --align opt /dev/sdi mkpart 8tb ext4 524280s 100% u s p = free a min 1 a opt 1
> Model: Seagate Expansion Desk (scsi)
> Disk /dev/sdi: 15628053167s
> Sector size (logical/physical): 512B/4096B
> Partition Table: gpt
> Disk Flags:=C2=A0
>
> Number =C2=A0Start =C2=A0 =C2=A0 =C2=A0 =C2=A0 End =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 Size =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0File system =C2=A0= Name =C2=A0Flags
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 34s =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 524= 279s =C2=A0 =C2=A0 =C2=A0 524246s =C2=A0 =C2=A0 =C2=A0 Free Space
> =C2=A01 =C2=A0 =C2=A0 =C2=A0524280s =C2=A0 =C2=A0 =C2=A0 15628000379s = =C2=A015627476100s =C2=A0ext4 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 15628000380s =C2=A015628053133s =C2=A05275= 4s =C2=A0 =C2=A0 =C2=A0 =C2=A0Free Space
>
> 1 aligned
> 1 aligned
> -- 8< --
>
> ~300MiB out of 7.3TiB isn't the end of the world, so that's wh= at I've gone with for now, but I wonder if I'm not overthinking it.= =C2=A0 Was parted's original optimal alignment actually fine and my und= erstanding incorrect? If not, is there a better way than what I've done= to calculate an alignment that is?
>
> For the near-term there's no data on this device so I'm perfec= tly happy to burn it down for testing.=C2=A0
>
> Thanks,
>
> =C2=A0-V
>
> -- 8< --
> $ sudo parted /dev/sdi print unit s print unit chs print
> Model: Seagate Expansion Desk (scsi)
> Disk /dev/sdi: 8002GB
> Sector size (logical/physical): 512B/4096B
> Partition Table: gpt
> Disk Flags:=C2=A0
>
> Number =C2=A0Start =C2=A0End =C2=A0 =C2=A0 Size =C2=A0 =C2=A0File syst= em =C2=A0Name =C2=A0Flags
> =C2=A01 =C2=A0 =C2=A0 =C2=A0268MB =C2=A08002GB =C2=A08001GB =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
>
> Model: Seagate Expansion Desk (scsi)
> Disk /dev/sdi: 15628053167s
> Sector size (logical/physical): 512B/4096B
> Partition Table: gpt
> Disk Flags:=C2=A0
>
> Number =C2=A0Start =C2=A0 =C2=A0End =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= Size =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0File system =C2=A0Name =C2=A0Flags<= br> > =C2=A01 =C2=A0 =C2=A0 =C2=A0524280s =C2=A015628000379s =C2=A0156274761= 00s =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
>
> Model: Seagate Expansion Desk (scsi)
> Disk /dev/sdi: 972801,80,61
> Sector size (logical/physical): 512B/4096B
> BIOS cylinder,head,sector geometry: 972801,255,63.=C2=A0 Each cylinder= is 8225kB.
> Partition Table: gpt
> Disk Flags:=C2=A0
>
> Number =C2=A0Start =C2=A0 =C2=A0 =C2=A0End =C2=A0 =C2=A0 =C2=A0 =C2=A0= File system =C2=A0Name =C2=A0Flags
> =C2=A01 =C2=A0 =C2=A0 =C2=A032,161,57 =C2=A0972798,8,5 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8tb
> -- 8< --

--001a11484f56acf57c0542cfa8f1-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 04 15:15:05 2016 Received: (at 25103) by debbugs.gnu.org; 4 Dec 2016 20:15:05 +0000 Received: from localhost ([127.0.0.1]:56185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDdBg-00086a-Uu for submit@debbugs.gnu.org; Sun, 04 Dec 2016 15:15:05 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:33850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDdBe-00085o-HX for 25103@debbugs.gnu.org; Sun, 04 Dec 2016 15:15:03 -0500 Received: by mail-io0-f180.google.com with SMTP id c21so521208748ioj.1 for <25103@debbugs.gnu.org>; Sun, 04 Dec 2016 12:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nKrYFz2v3MHtsj8ORMsAKqz5uTEjpoSEGW/zMVQloVQ=; b=MauLo88SACTNeZKOyQ6ClmuECZ1Vd5JW9E2Wf9T3UtwnvfvWGLQ6QoTnLeKTvYDmBa UrnU+6JrD/Q+CWWCcE4exLmxDJVXULHFQdkatrXvLduttvWiazgY4lPT9+NeJ7NzMooI kOXxhauRaAjRJIxaryU2maznE1Y4vq9FQo2TdEBeC5YGjhCXSyE2SgWrBB4HRLIzqHGw Isn4gxkqtMLQWdC1mCqwKmfuMj0o7JkAH9cHU9CCRMlhC5j9PThqm/v4SkiPp/RIm7SU WgSS0BOC1SetmpUp0WKqazEZYHksKvroUPppvcGsgpW0r4QB+vVxDMzii8Jji0eihrDQ 2t7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nKrYFz2v3MHtsj8ORMsAKqz5uTEjpoSEGW/zMVQloVQ=; b=GJdoSbZBrhwo8DHoS3vKjnli5UU2Dwe8vyzzb1R8LV69lm3tIlnthjNh1Ulzy0J/YW KEHoqT2GlyrZ2Uo/b/D8qsXpujsBa7gKQMDyspR1IURPA8XlPtUm+MdTHcDRzcIfttYx G0NYeD3/7R5oFMiA1KK1OxMFuXDRkhuVzzBqPu57BADRg6/m+AQacfzwaB+bz+DeR1IJ Ex7bu3PxMP6sF4cItclqcGPpAM8FX7oGO5UqaLXLbt52QCO4bxc+lsdSTBm9bMq9c9P0 dMs0oFa8YYtAc5Vrpkg/lgQq0ysDr3HrwRXDbyJjBNeCoc/3GhCwfSJs8sn2XOcnsWZI voYg== X-Gm-Message-State: AKaTC03eCdpSccY9QPEn2G8IISJCzLB4T7CHuFQ6sA6yAv238gTNykuv3iKvxszoxQlTC0qzdr8n4gdTv27zEw== X-Received: by 10.107.19.22 with SMTP id b22mr11136150ioj.236.1480882496906; Sun, 04 Dec 2016 12:14:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.133.22 with HTTP; Sun, 4 Dec 2016 12:14:56 -0800 (PST) In-Reply-To: References: From: Volta Date: Sun, 4 Dec 2016 15:14:56 -0500 Message-ID: Subject: Re: bug#25103: partition alignment To: Josep Lladonosa Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25103 Cc: 25103@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On 4 December 2016 at 01:55, Josep Lladonosa wrote: > On 4 Dec 2016 05:40, "Volta" wrote: >> 1 not aligned >> 1 aligned >> -- 8< -- >> >> So, I fell back to how we used to do this, but the numbers are... weird: >> >> -- 8< -- >> $ cat /sys/block/sdi/queue/optimal_io_size >> 33553920 > > Maybe this value is not drive related but usb bus related. Is that a usb > drive? I guess so. Found similar cases. One of them: > > https://www.mail-archive.com/search?l=linux-usb@vger.kernel.org&q=subject:%22Re%5C%3A+questions+about+uas%22&o=newest&f=1 Interesting! Yes, as you've guessed, it is a USB drive, using the uas driver. So, not a parted bug, and I've got a new avenue to read up on. Thank you! -V From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 19 10:29:10 2017 Received: (at 25103-done) by debbugs.gnu.org; 19 Apr 2017 14:29:10 +0000 Received: from localhost ([127.0.0.1]:56956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0qbV-0001aG-Va for submit@debbugs.gnu.org; Wed, 19 Apr 2017 10:29:10 -0400 Received: from mail-ua0-f193.google.com ([209.85.217.193]:36443) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0qbU-0001a1-3e for 25103-done@debbugs.gnu.org; Wed, 19 Apr 2017 10:29:08 -0400 Received: by mail-ua0-f193.google.com with SMTP id q26so2480995uaa.3 for <25103-done@debbugs.gnu.org>; Wed, 19 Apr 2017 07:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=lPTg0Hj5LY8+AMBzPevz0GAvHuQo1/GSSipGVu+r0Yk=; b=JEeP3b81PJwDLk4GlyuxErYr90J0fGIKgJ3/GuJP06Bfx1Kikd9694BTclMJDaDaqT h1Gt1bt9VZPS+t369xY3obdyId/ccgTXsfm0kQJZ0Dx8SuDmmaqQMd+6GbEFTMX1c0iv Qq/WlHvObiwN2cyQVZ8BtZ/sAu+TIDio669gODy80CLO5cQbGfu0BKcNdZWbKHVB1AVJ axLqb+CpWcXn/F6xeZEU1amr09jyibrfelt8+oQqkIcN5apMCTcZQYIDQxvTRHJ6euz+ s3YOU6zMRkc/a/zqPGF4aLLel9WZM13GrLJQoti9uK4unbY6Syr9dxQGM3lwE3LX7h20 xfsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=lPTg0Hj5LY8+AMBzPevz0GAvHuQo1/GSSipGVu+r0Yk=; b=UFbRj07Zm+Zoh4PCimGveqe3CbRrVQB6JwDTOrJDBu7QayvyR+6iKZE+TNt9fdPQF1 MZo4Ab7zB2fOW5ByDXgbdMUAz8uuDMIaFPeGiFdjseETaH6rMHhGv7ER00pLeuIUlBc9 w2cDcK7vuLNzcWj+r7hZIj+AGlaHiP1yM3fe8RGFCoZT3gCO+htjaFlDtNOv7mGYi8ld 7yMKEfxkOEhsNFq+oN7SqoiZg+AGZQxAE2t2ilCkyN/OveDwSpDHsTOA9qQFhU5PHprI UF0Ql67mM9rRJYKDe0Q6nbctWNdV+WU63/MDsu7PM537kG11wdgipLgSwhisE/u2Q+iK UlWA== X-Gm-Message-State: AN3rC/5Ol+2C1UbtURYtvVH0tEXAcLk2eAC1gbOGfzQ4QeU+Uf+Msaha zRLS9uAdmyggGQ== X-Received: by 10.159.51.97 with SMTP id a33mr1482037uac.136.1492612142506; Wed, 19 Apr 2017 07:29:02 -0700 (PDT) Received: from [10.1.1.184] (fl-67-77-88-12.sta.embarqhsd.net. [67.77.88.12]) by smtp.googlemail.com with ESMTPSA id y75sm133789vky.15.2017.04.19.07.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 07:29:02 -0700 (PDT) Subject: Re: bug#25103: partition alignment To: Volta , Josep Lladonosa References: From: Phil Susi Message-ID: <6ad367f6-034c-5e76-1f9e-c922ba926221@ubuntu.com> Date: Wed, 19 Apr 2017 10:30:45 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25103-done Cc: 25103-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On 12/4/2016 3:14 PM, Volta wrote: > On 4 December 2016 at 01:55, Josep Lladonosa wrote: >> Maybe this value is not drive related but usb bus related. Is that a usb >> drive? I guess so. Found similar cases. One of them: >> >> https://www.mail-archive.com/search?l=linux-usb@vger.kernel.org&q=subject:%22Re%5C%3A+questions+about+uas%22&o=newest&f=1 > > Interesting! Yes, as you've guessed, it is a USB drive, using the uas > driver. So, not a parted bug, and I've got a new avenue to read up on. Interesting, but yes, parted is simply respecting the fubar optimal IO size this drive is reporting, which appears to be one sector less than 32 mb. Normal drives have an optimal IO size of 32 kb. From unknown Sat Jun 21 03:06:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 18 May 2017 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator