From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 03 11:17:26 2019 Received: (at submit) by debbugs.gnu.org; 3 Aug 2019 15:17:26 +0000 Received: from localhost ([127.0.0.1]:59771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htvmd-0007V0-W5 for submit@debbugs.gnu.org; Sat, 03 Aug 2019 11:17:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:53705) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1httH9-00058r-6k for submit@debbugs.gnu.org; Sat, 03 Aug 2019 08:36:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57416) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1httH7-0001Gn-BM for bug-parted@gnu.org; Sat, 03 Aug 2019 08:36:43 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1httH5-0000nf-Hz for bug-parted@gnu.org; Sat, 03 Aug 2019 08:36:41 -0400 Received: from au-smtp-delivery-203.mimecast.com ([180.189.28.203]:50209) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1httH3-0000lv-SY for bug-parted@gnu.org; Sat, 03 Aug 2019 08:36:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimelb.edu.au; s=mimecast20161020; t=1564835792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=pSFolDETj9kAew7P4peu44N7QcCpBDffaNq8+AgwwAU=; b=JWij0ygtp94YeWI+2z/leCD7Zj8T1d987ogCOzfzkxET0EL5xhDQHx1VtpScX63fAKAYZE 93d8UQkLLKWfeVOpGVjIyMeDxQwvQWoXG9hTAtPgtWIB6dtSsxE0BTKxuwynrjefYwNUnl RkKZud2G1Rb/Asxx0fRyMWW866/uwDk= Received: from AUS01-ME1-obe.outbound.protection.outlook.com (mail-me1aus01lp2057.outbound.protection.outlook.com [104.47.116.57]) (Using TLS) by relay.mimecast.com with ESMTP id au-mta-81-F6RI-TKdOLylSfx4MCe7IQ-1; Sat, 03 Aug 2019 22:27:02 +1000 Received: from ME2PR01MB4948.ausprd01.prod.outlook.com (20.178.193.79) by ME2PR01MB3250.ausprd01.prod.outlook.com (52.134.220.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.16; Sat, 3 Aug 2019 12:26:57 +0000 Received: from ME2PR01MB4948.ausprd01.prod.outlook.com ([fe80::bcf7:196b:791b:f5d7]) by ME2PR01MB4948.ausprd01.prod.outlook.com ([fe80::bcf7:196b:791b:f5d7%7]) with mapi id 15.20.2136.010; Sat, 3 Aug 2019 12:26:57 +0000 From: George Fedorov To: "bug-parted@gnu.org" Subject: parted optimal alignment fails minimal alignment check Thread-Topic: parted optimal alignment fails minimal alignment check Thread-Index: AQHVSfPfm5HsDBllIkOi9K2V3YSoRg== Date: Sat, 3 Aug 2019 12:26:56 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [202.172.103.136] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5c309a60-7417-4515-8096-08d7180de058 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:ME2PR01MB3250; x-ms-traffictypediagnostic: ME2PR01MB3250: x-ms-exchange-purlcount: 4 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 0118CD8765 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(376002)(366004)(136003)(346002)(52314003)(199004)(189003)(8936002)(99286004)(478600001)(25786009)(2351001)(5660300002)(76116006)(26005)(5640700003)(86362001)(55016002)(68736007)(53936002)(9686003)(236005)(6306002)(476003)(54896002)(2906002)(6436002)(486006)(7696005)(53386004)(2501003)(66446008)(6506007)(53376002)(74316002)(52536014)(1015004)(33656002)(102836004)(19627405001)(186003)(6606003)(88552002)(66066001)(6916009)(8676002)(71200400001)(14454004)(256004)(71190400001)(81166006)(66946007)(626008)(316002)(3846002)(786003)(64756008)(966005)(14444005)(81156014)(66556008)(66476007)(606006)(6116002)(7736002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:ME2PR01MB3250; H:ME2PR01MB4948.ausprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: VsjsWvxKu8+OQmcbynLl2KcZ2O8F4lFIzRBa735Pw2zAqTbVVES+idzlYOHpFAwEPhozBfVBqCx4eHRzkgt7j3PAxw4zzVJraToJXMZTtODuQJtCvL+5P2Vql+6gGnsHFKFp5uSlWZy/HKZBWlQ6JPa5/JiZiHuPo02TdzdhERSUHAZMuHmkHqZpANjzdZ3prgfpXazfDfgNI2YRQgX1z6D0zGfJjwgDWSQ1J05ejWEEED9d00cZiz739u28UoJL7u6HU1uxyj/pDKMJuRCiB/kfKu5JebskZ6NdMOw9G0h5ziXTavZLJCpa6wmVgPN6Ebd9fDkggrC2Yh+0deVlX19vq8mPVw5rNp0dJ13ydYRdGO6F9F6hQKokkC2SCZ2T/1FJ15D2n4g8ocJ/BdD0tnPJ+mYfcKl+qBRWGjrW0rg= MIME-Version: 1.0 X-OriginatorOrg: unimelb.edu.au X-MS-Exchange-CrossTenant-Network-Message-Id: 5c309a60-7417-4515-8096-08d7180de058 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2019 12:26:56.7925 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0e5bf3cf-1ff4-46b7-9176-52c538c22a4d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gfedorov@unimelb.edu.au X-MS-Exchange-Transport-CrossTenantHeadersStamped: ME2PR01MB3250 X-MC-Unique: F6RI-TKdOLylSfx4MCe7IQ-1 X-Mimecast-Spam-Score: 0 Content-Type: multipart/alternative; boundary="_000_ME2PR01MB4948477500A42A8D915F40ADEAD80ME2PR01MB4948ausp_" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 180.189.28.203 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 03 Aug 2019 11:17:23 -0400 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: -2.3 (--) --_000_ME2PR01MB4948477500A42A8D915F40ADEAD80ME2PR01MB4948ausp_ Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Hi, I was directed here by the page at https://www.gnu.org/software/parted/bugs= .shtml ; is there any bugreport tracker where one can file a bug instead ? Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18= .04 and checked vs. a manual build of the sources from http://ftp.gnu.org/g= nu/parted/parted-3.2.tar.xz ): =3D=3D=3D parted version =3D=3D=3D # parted --version parted (GNU parted) 3.2 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by . =3D=3D=3D print unit s print unit chs print =3D=3D=3D # parted /dev/sdi print unit s print unit chs print Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 5860533168s Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 364801,80,62 Sector size (logical/physical): 512B/512B BIOS cylinder,head,sector geometry: 364801,255,63. Each cylinder is 8225kB= . Partition Table: gpt Disk Flags: Number Start End File system Name Flags =3D=3D=3D the problem =3D=3D=3D # parted /dev/sdi GNU Parted 3.2 Using /dev/sdi Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mkpart test1 0% 1T (parted) unit B (parted) print Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 3000592982016B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 33553920B 1000007477759B 999973923840B test1 (parted) align-check optimal 1 1 aligned (parted) align-check minimal 1 1 not aligned (parted) =3D=3D=3D=3D=3D First of all, start sector value looks insanely big for "0%" ; second, one = would imagine that passing an optimal check would imply passing a minimal c= heck. If one tries to start at e.g. 1 MiB, then of course the optimal check will = not pass : =3D=3D=3D=3D=3D # parted /dev/sdi GNU Parted 3.2 Using /dev/sdi Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 3001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags (parted) mkpart test1 ext2 2048s 1T Warning: The resulting partition is not properly aligned for best performan= ce. Ignore/Cancel? I (parted) unit B (parted) print Model: WDC WD30 EZRZ-00Z5HB0 (scsi) Disk /dev/sdi: 3000592982016B Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1048576B 1000000000511B 999998951936B ext2 test1 (parted) align-check optimal 1 1 not aligned (parted) align-check minimal 1 1 aligned =3D=3D=3D=3D=3D As it turns out, the root of all evil comes from here : =3D=3D=3D=3D=3D # cat /sys/block/sdi/queue/optimal_io_size 33553920 =3D=3D=3D=3D=3D So parted is not to blame, but the system. But from the user's point of vie= w, it is quite hard to figure this out. And certainly the user deserves to = know the actual values that parted considers to be of best performance -- I= mean, pa->offset and pa->grain_size from parted.c::print_partition_alignme= nt() shall probably be exposed in some way -- at least when it comes to a w= arning like the one above. Kind regards Georgy Fedorov Senior Systems Specialist Melbourne School of Engineering The University of Melbourne, Victoria 3010, Australia email: gfedorov@unimelb.edu.au http://www.eng.unimelb.edu.au --_000_ME2PR01MB4948477500A42A8D915F40ADEAD80ME2PR01MB4948ausp_ Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable

Hi,


I was directed here by the page a= t https://www.gnu.org/software/parted/bugs.shtml ; is there any bugreport= tracker where one can file a bug instead ?


Anyway, here's the problem ( mani= fested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual buil= d of the sources from http://ftp.gnu.org/gnu/parted/parted-3.2.tar.xz  ):


=3D=3D=3D parted version =3D= =3D=3D


# parted --version
parted (GNU parted) 3.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/= gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <http://git.debian.org/?p=3Dparted/parted.git;a=3Dblob_plain;= f=3DAUTHORS>.

=3D=3D=3D print unit s print unit chs print =3D=3D=3D


# parted /dev/sdi print unit s print unit chs print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  = Flags

Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 5860533168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  = Flags

Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 364801,80,62
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 364801,255,63.  Each cylinder is 8= 225kB.
Partition Table: gpt
Disk Flags:

Number  Start  End  File system  Name  Flags

=3D=3D=3D the problem =3D=3D= =3D


# parted /dev/sdi
GNU Parted 3.2
Using /dev/sdi
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart test1 0% 1T        =             &nb= sp;            =              &n= bsp;
(parted) unit B
(parted) print          &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3000592982016B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End    = ;         Size   &nb= sp;       File system  Name   = Flags
 1      33553920B  1000007477759B  = 999973923840B          &n= bsp;    test1

(parted) align-check optimal 1       &nb= sp;            =             &nb= sp;           
1 aligned
(parted) align-check minimal 1       &nb= sp;            =             &nb= sp;    
1 not aligned
(parted)        


=3D=3D=3D=3D=3D


First of all, start sector value = looks insanely big for "0%" ; second, one would imagine that pass= ing an optimal check would imply passing a minimal check.


If one tries to start at e.g. 1 M= iB, then of course the optimal check will not pass :


=3D=3D=3D=3D=3D

# parted /dev/sdi
GNU Parted 3.2
Using /dev/sdi
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  = Flags

(parted) mkpart test1 ext2 2048s 1T      &nbs= p;            &= nbsp;           &nbs= p;       
Warning: The resulting partition is not properly aligned for best performan= ce.
Ignore/Cancel? I          = ;            &n= bsp;            = ;            &n= bsp;          
(parted) unit B          =             &nb= sp;            =             &nb= sp;           
(parted) print          &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3000592982016B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End     = ;        Size    &nb= sp;      File system  Name   Flags<= br>  1      1048576B  1000000000511B  9= 99998951936B  ext2         tes= t1

(parted) align-check optimal 1       &nb= sp;            =             &nb= sp;           
1 not aligned
(parted) align-check minimal 1       &nb= sp;            =             &nb= sp;    
1 aligned

=3D=3D=3D=3D=3D


As it turns out, the root of all = evil comes from here :


=3D=3D=3D=3D=3D

# cat /sys/block/sdi/queue/optimal_io_size
33553920
=3D=3D=3D=3D=3D

So parted is not to blame, but th= e system. But from the user's point of view, it is quite hard to figure thi= s out. And certainly the user deserves to know the actual values that parte= d considers to be of best performance -- I mean, pa->offset and pa->grain_size f= rom parted.c::print_partition_alignment() shall probably be ex= posed in some way -- at least when it comes to a warning like the one above= .




Kind regards
= Georgy Fedorov
= Senior Systems Specialist
= Melbourne School of Engineering
= The University of Melbourne, Victoria 3010, Australia
--_000_ME2PR01MB4948477500A42A8D915F40ADEAD80ME2PR01MB4948ausp_-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 03 12:15:23 2019 Received: (at 36908) by debbugs.gnu.org; 3 Aug 2019 16:15:23 +0000 Received: from localhost ([127.0.0.1]:59806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htwgl-0002dh-0y for submit@debbugs.gnu.org; Sat, 03 Aug 2019 12:15:23 -0400 Received: from mail-io1-f47.google.com ([209.85.166.47]:37792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htwgi-0002dT-Ah for 36908@debbugs.gnu.org; Sat, 03 Aug 2019 12:15:21 -0400 Received: by mail-io1-f47.google.com with SMTP id q22so39138714iog.4 for <36908@debbugs.gnu.org>; Sat, 03 Aug 2019 09:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=0FGdfYkxNbf8hAMeMFfi0Qkt1f69dlK1wCE0mhbb6GU=; b=nexJud16NQQE6iPcz/KyQf+WyYPWFQdR9tUT3fH0ZtDx0hkuOl4sMfNssN7+tmNJw8 GNd6UMHMvN9CMJvDUiMOOry3G50OtH1ST9g+8HQxlM0E/7oyK7Gt+7xtRuu4rDAlBAwS R1NZt7wHTSZvUU5dyJ7NSZfnFKV8rgjzY4BwcFp0FgRwRT0/bBBjCpLeEJx9Fmh+5JtG 6tcGGM9Rgngaa09/q5SGznerRwpnXwGU5HUAChn8kDeaFgvsF/QSSBZ63ULQ67V2lzYv lUSoiiYxvms1q9VguIzxg3UfQ4/Wc7PkBi+2f6JOwRH4zhmudPLUF5NOiVi+HrcMOlBa OUQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=0FGdfYkxNbf8hAMeMFfi0Qkt1f69dlK1wCE0mhbb6GU=; b=cROPk7gi+uhS1fXEFzoQDNtmPB3hBwScyL9ukczocipQ2qmQUOkMZmuKNr0AHQuETR x6V0pKwyoISqw+QASInpIoGBExNLWZefO8ToRqtczXHvMqOn6+NQxC6OnWkHkvIxICXD XtHB3S4TKAXV43Y5l2TpKrIfsupvqn6y/Yli18v4MYGh58OJMUp7tORqgk46JhJ8KiH/ GRYLgM/8vVn/uGVCAP5j4Eq1dGvPGXD1D39lU0slQt1JztZElQptJXbLvCu4G7Y51aJ0 tKexNu/FieUkGFdSsn1MD/E5eSgnKNIsY+EXeoAwVfRSdfBLvJqqQsPm8eoJYGngsgL4 JZ5w== X-Gm-Message-State: APjAAAUy7uHB+0Riw0SP7H7KVC1hjtnMN+RSbjYPjjCsA4UXpIpEbTxZ SKBNcuDMz7qkf+ipzOc+egqAP76SJ2/yotFSbms= X-Google-Smtp-Source: APXvYqxzRjzn7++HKJi+m5EJRj/SGdF62h/ADWcM7UQq0yFE6bf4IWUotdnBrqEoZw5AgpGJAd1lriWdXeh4RuIfR4Y= X-Received: by 2002:a6b:7b07:: with SMTP id l7mr63328883iop.225.1564848914110; Sat, 03 Aug 2019 09:15:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Volta Date: Sat, 3 Aug 2019 12:15:01 -0400 Message-ID: Subject: Re: bug#36908: parted optimal alignment fails minimal alignment check To: George Fedorov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36908 Cc: 36908@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: -1.0 (-) I'm not a parted dev, just a user, but I've run into this same issue several times. This wouldn't happen to be a USB device using the UAS driver? IME setting quirks mode for such devices so they use the usb-storage driver instead yields sensible values for optimal_io_size, etc. so parted can do the right thing with 0% and properly align the partitions. This also works around other issues I've had with these devices randomly disconnecting when using UAS. My /etc/modprobe.d/usbdisks.conf file contains: options usb-storage quirks=3D0x0bc2:0xab31:u,0x0bc2:0x3322:u,0x0bc2:0xa0a4:u,0x0bc2:0x331a:u,0x= 0bc2:3343:u get the device identifiers for the affected device(s) from lsusb, stick them in there, then 'depmod -a' and reboot or remove and reattach the device(s) (the latter should work, but sometimes the kernel doesn't do the right thing, and I've not bothered to investigate further as I only use USB disks on workstations that are easily rebooted), then try parted again. Doesn't really "solve" the problem, which I understand to be with the UAS implementation in these devices, but at least it is a usable workaround. On Sat, 3 Aug 2019 at 11:18, George Fedorov wrote= : > > Hi, > > > I was directed here by the page at https://www.gnu.org/software/parted/bu= gs.shtml ; is there any bugreport tracker where one can file a bug instead = ? > > > Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu = 18.04 and checked vs. a manual build of the sources from http://ftp.gnu.org= /gnu/parted/parted-3.2.tar.xz ): > > > =3D=3D=3D parted version =3D=3D=3D > > > # parted --version > parted (GNU parted) 3.2 > Copyright (C) 2014 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later . > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > Written by . > > =3D=3D=3D print unit s print unit chs print =3D=3D=3D > > > # parted /dev/sdi print unit s print unit chs print > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 3001GB > Sector size (logical/physical): 512B/512B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 5860533168s > Sector size (logical/physical): 512B/512B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 364801,80,62 > Sector size (logical/physical): 512B/512B > BIOS cylinder,head,sector geometry: 364801,255,63. Each cylinder is 8225= kB. > Partition Table: gpt > Disk Flags: > > Number Start End File system Name Flags > > =3D=3D=3D the problem =3D=3D=3D > > > # parted /dev/sdi > GNU Parted 3.2 > Using /dev/sdi > Welcome to GNU Parted! Type 'help' to view a list of commands. > (parted) mkpart test1 0% 1T > (parted) unit B > (parted) print > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 3000592982016B > Sector size (logical/physical): 512B/512B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Fla= gs > 1 33553920B 1000007477759B 999973923840B test1 > > (parted) align-check optimal 1 > 1 aligned > (parted) align-check minimal 1 > 1 not aligned > (parted) > > > =3D=3D=3D=3D=3D > > > First of all, start sector value looks insanely big for "0%" ; second, on= e would imagine that passing an optimal check would imply passing a minimal= check. > > > If one tries to start at e.g. 1 MiB, then of course the optimal check wil= l not pass : > > > =3D=3D=3D=3D=3D > > # parted /dev/sdi > GNU Parted 3.2 > Using /dev/sdi > Welcome to GNU Parted! Type 'help' to view a list of commands. > (parted) print > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 3001GB > Sector size (logical/physical): 512B/512B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flags > > (parted) mkpart test1 ext2 2048s 1T > Warning: The resulting partition is not properly aligned for best perform= ance. > Ignore/Cancel? I > (parted) unit B > (parted) print > Model: WDC WD30 EZRZ-00Z5HB0 (scsi) > Disk /dev/sdi: 3000592982016B > Sector size (logical/physical): 512B/512B > Partition Table: gpt > Disk Flags: > > Number Start End Size File system Name Flag= s > 1 1048576B 1000000000511B 999998951936B ext2 test1 > > (parted) align-check optimal 1 > 1 not aligned > (parted) align-check minimal 1 > 1 aligned > > =3D=3D=3D=3D=3D > > > As it turns out, the root of all evil comes from here : > > > =3D=3D=3D=3D=3D > > # cat /sys/block/sdi/queue/optimal_io_size > 33553920 > =3D=3D=3D=3D=3D > > So parted is not to blame, but the system. But from the user's point of v= iew, it is quite hard to figure this out. And certainly the user deserves t= o know the actual values that parted considers to be of best performance --= I mean, pa->offset and pa->grain_size from parted.c::print_partition_align= ment() shall probably be exposed in some way -- at least when it comes to a= warning like the one above. > > > > > Kind regards > Georgy Fedorov > Senior Systems Specialist > Melbourne School of Engineering > The University of Melbourne, Victoria 3010, Australia > email: gfedorov@unimelb.edu.au > http://www.eng.unimelb.edu.au > From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 05 12:01:22 2019 Received: (at 36908-done) by debbugs.gnu.org; 5 Aug 2019 16:01:22 +0000 Received: from localhost ([127.0.0.1]:35709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hufQI-0007Qf-6R for submit@debbugs.gnu.org; Mon, 05 Aug 2019 12:01:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hufQF-0007QP-MM for 36908-done@debbugs.gnu.org; Mon, 05 Aug 2019 12:01:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B30F9307D844; Mon, 5 Aug 2019 16:01:13 +0000 (UTC) Received: from lister.brianlane.com (ovpn-112-32.phx2.redhat.com [10.3.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2977F5D6C8; Mon, 5 Aug 2019 16:01:12 +0000 (UTC) Date: Mon, 5 Aug 2019 09:01:09 -0700 From: "Brian C. Lane" To: George Fedorov Subject: Re: bug#36908: parted optimal alignment fails minimal alignment check Message-ID: <20190805160109.GA4490@lister.brianlane.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 05 Aug 2019 16:01:14 +0000 (UTC) X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 36908-done Cc: 36908-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: -6.0 (------) On Sat, Aug 03, 2019 at 12:26:56PM +0000, George Fedorov wrote: > Hi, > > > I was directed here by the page at https://www.gnu.org/software/parted/bugs.shtml ; is there any bugreport tracker where one can file a bug instead ? > > > Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual build of the sources from http://ftp.gnu.org/gnu/parted/parted-3.2.tar.xz ): The 3.2 tar is *really* old at this point and should not really be used. [snip] > As it turns out, the root of all evil comes from here : > > > ===== > > # cat /sys/block/sdi/queue/optimal_io_size > 33553920 > ===== > > > So parted is not to blame, but the system. But from the user's point of view, it is quite hard to figure this out. And certainly the user deserves to know the actual values that parted considers to be of best performance -- I mean, pa->offset and pa->grain_size from parted.c::print_partition_alignment() shall probably be exposed in some way -- at least when it comes to a warning like the one above. In commit 1726dbb4cd2dc4b19fe8d3c4b94e172fc0bd2c7c I added a message that describes the failure with a bit more detail. It will print something like: % != I'm guessing Ubuntu doesn't have that patch, and the 3.2 tarball is getting *really* old at this point (which is why I'm working toward a 3.3 release soon). Brian -- Brian C. Lane (PST8PDT) - weldr.io - lorax - parted From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 06 10:36:23 2019 Received: (at 36908) by debbugs.gnu.org; 6 Aug 2019 14:36:23 +0000 Received: from localhost ([127.0.0.1]:37623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hv0Zb-0002QP-2v for submit@debbugs.gnu.org; Tue, 06 Aug 2019 10:36:23 -0400 Received: from mail-gw2.its.unimelb.edu.au ([128.250.5.151]:39736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1husHi-0003Bu-2F; Tue, 06 Aug 2019 01:45:24 -0400 Received: from [128.250.27.138] (geo3.eng.unimelb.edu.au [128.250.27.138]) (Authenticated sender: gfedorov) by mail-gw2.its.unimelb.edu.au (Postfix) with ESMTPSA id 58776801909D; Tue, 6 Aug 2019 15:45:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimelb.edu.au; s=smtp; t=1565070312; bh=1wn1d/eEEW3NoI1KWZRHpNYegHd/729ugp4MIH8t3G4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=JDU7Bwv9h1+M/tmAESnTYXL27GUWFORyd+6HEJR0OjkR6ddQKAYAyQ2FShdF44sT9 7kCJhIMKfPjLhiIak8sCwZoX9tFf49qkYdEEAE52+/35c1dpm/pnyiZStOvJCpphIH XRZs12aFSDjHN/E9y3ZinEPwAzCHOYkjvJG7qIN8= Subject: Re: bug#36908: parted optimal alignment fails minimal alignment check To: "Brian C. Lane" References: <20190805160109.GA4490@lister.brianlane.com> From: Georgy Fedorov Message-ID: Date: Tue, 6 Aug 2019 15:45:12 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190805160109.GA4490@lister.brianlane.com> Content-Type: multipart/alternative; boundary="------------96A2BC8C3FC634071FF50784" Content-Language: en-GB X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36908 X-Mailman-Approved-At: Tue, 06 Aug 2019 10:36:18 -0400 Cc: 36908@debbugs.gnu.org, 36908-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: -1.7 (-) This is a multi-part message in MIME format. --------------96A2BC8C3FC634071FF50784 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Perfect! That's exactly what I had in mind. As for the version -- I have noticed that the most recent release at ftp.gnu.org/gnu/parted is a little old -- but it still was the most recent release, so I went with that. My apologies. Kind regards, George On 6/8/19 2:01 am, Brian C. Lane wrote: > On Sat, Aug 03, 2019 at 12:26:56PM +0000, George Fedorov wrote: >> Hi, >> >> >> I was directed here by the page at https://protect-au.mimecast.com/s/FpF4C91ZVBSnZ5nYsoexuZ?domain=gnu.org ; is there any bugreport tracker where one can file a bug instead ? >> >> >> Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual build of the sources from https://protect-au.mimecast.com/s/Kz_DC0YZJpCvERvrcDJs5C?domain=ftp.gnu.org ): > > The 3.2 tar is *really* old at this point and should not really be used. > > [snip] > > >> As it turns out, the root of all evil comes from here : >> >> >> ===== >> >> # cat /sys/block/sdi/queue/optimal_io_size >> 33553920 >> ===== >> >> >> So parted is not to blame, but the system. But from the user's point of view, it is quite hard to figure this out. And certainly the user deserves to know the actual values that parted considers to be of best performance -- I mean, pa->offset and pa->grain_size from parted.c::print_partition_alignment() shall probably be exposed in some way -- at least when it comes to a warning like the one above. > > In commit 1726dbb4cd2dc4b19fe8d3c4b94e172fc0bd2c7c I added a message > that describes the failure with a bit more detail. It will print > something like: > > % != > > I'm guessing Ubuntu doesn't have that patch, and the 3.2 tarball is > getting *really* old at this point (which is why I'm working toward a > 3.3 release soon). > > Brian > -- George Fedorov Senior Systems Specialist Melbourne School of Engineering The University of Melbourne, Victoria 3010, Australia email: gfedorov@unimelb.edu.au http://www.eng.unimelb.edu.au/ --------------96A2BC8C3FC634071FF50784 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 7bit Perfect! That's exactly what I had in mind.

As for the version -- I have noticed that the most recent release at ftp.gnu.org/gnu/parted is a little old -- but it still was the most recent release, so I went with that. My apologies.

Kind regards, George


On 6/8/19 2:01 am, Brian C. Lane wrote:
On Sat, Aug 03, 2019 at 12:26:56PM +0000, George Fedorov wrote:
Hi,


I was directed here by the page at https://protect-au.mimecast.com/s/FpF4C91ZVBSnZ5nYsoexuZ?domain=gnu.org ; is there any bugreport tracker where one can file a bug instead ?


Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual build of the sources from https://protect-au.mimecast.com/s/Kz_DC0YZJpCvERvrcDJs5C?domain=ftp.gnu.org  ):

The 3.2 tar is *really* old at this point and should not really be used.

[snip]


As it turns out, the root of all evil comes from here :


=====

# cat /sys/block/sdi/queue/optimal_io_size
33553920
=====


So parted is not to blame, but the system. But from the user's point of view, it is quite hard to figure this out. And certainly the user deserves to know the actual values that parted considers to be of best performance -- I mean, pa->offset and pa->grain_size from parted.c::print_partition_alignment() shall probably be exposed in some way -- at least when it comes to a warning like the one above.

In commit 1726dbb4cd2dc4b19fe8d3c4b94e172fc0bd2c7c I added a message
that describes the failure with a bit more detail. It will print
something like:

<start> % <grain_size> != <offset>

I'm guessing Ubuntu doesn't have that patch, and the 3.2 tarball is
getting *really* old at this point (which is why I'm working toward a
3.3 release soon).

Brian


-- 
George Fedorov
Senior Systems Specialist
Melbourne School of Engineering
The University of Melbourne, Victoria 3010, Australia
email: gfedorov@unimelb.edu.au
http://www.eng.unimelb.edu.au/
--------------96A2BC8C3FC634071FF50784-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 06 10:36:25 2019 Received: (at 36908) by debbugs.gnu.org; 6 Aug 2019 14:36:25 +0000 Received: from localhost ([127.0.0.1]:37625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hv0Zb-0002QX-Oz for submit@debbugs.gnu.org; Tue, 06 Aug 2019 10:36:25 -0400 Received: from mail-gw1.its.unimelb.edu.au ([128.250.5.150]:33780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huseI-0003ma-FI for 36908@debbugs.gnu.org; Tue, 06 Aug 2019 02:08:45 -0400 Received: from [128.250.27.138] (geo3.eng.unimelb.edu.au [128.250.27.138]) (Authenticated sender: gfedorov) by mail-gw1.its.unimelb.edu.au (Postfix) with ESMTPSA id 29D66801909C; Tue, 6 Aug 2019 16:08:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimelb.edu.au; s=smtp; t=1565071713; bh=RjY+0sYcdNdoga+SKi5LA0gKYwRftnFYRhrsXxd9Qa4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=KY6r40UHCFDfSyNACCQ1alAIK8W2ouvSFC+mCBuS0tBK6TxECoIY7kQ3KtXocyK3N 9WMJr+9rQcaQBKcKRsgXr5VzXXUXEuNUfmKoaowENrhgi1s/jpbSxagw8+m8gbkjtQ G/UeGFdjgTmPCYjlKyOw79AlxHUwcDxQP36Oh1x8= Subject: Re: bug#36908: parted optimal alignment fails minimal alignment check To: Volta References: From: Georgy Fedorov Message-ID: Date: Tue, 6 Aug 2019 16:08:32 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------2A85C4F4D11A67281EBB2B27" Content-Language: en-GB X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36908 X-Mailman-Approved-At: Tue, 06 Aug 2019 10:36:18 -0400 Cc: 36908@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: -1.7 (-) This is a multi-part message in MIME format. --------------2A85C4F4D11A67281EBB2B27 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thank you -- that's a very good point. Just in case if this thread would get indexed, I would add a reference for usb-storage quirks: https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html ( search for "usb-storage.quirks=" ) Kind regards, George On 4/8/19 2:15 am, Volta wrote: > I'm not a parted dev, just a user, but I've run into this same issue > several times. This wouldn't happen to be a USB device using the UAS > driver? IME setting quirks mode for such devices so they use the > usb-storage driver instead yields sensible values for optimal_io_size, > etc. so parted can do the right thing with 0% and properly align the > partitions. This also works around other issues I've had with these > devices randomly disconnecting when using UAS. My > /etc/modprobe.d/usbdisks.conf file contains: > > options usb-storage > quirks=0x0bc2:0xab31:u,0x0bc2:0x3322:u,0x0bc2:0xa0a4:u,0x0bc2:0x331a:u,0x0bc2:3343:u > > get the device identifiers for the affected device(s) from lsusb, > stick them in there, then 'depmod -a' and reboot or remove and > reattach the device(s) (the latter should work, but sometimes the > kernel doesn't do the right thing, and I've not bothered to > investigate further as I only use USB disks on workstations that are > easily rebooted), then try parted again. > > Doesn't really "solve" the problem, which I understand to be with the > UAS implementation in these devices, but at least it is a usable > workaround. > > On Sat, 3 Aug 2019 at 11:18, George Fedorov wrote: >> Hi, >> >> >> I was directed here by the page at https://protect-au.mimecast.com/s/yFf9CWLJMvF3vx10s6x6jT?domain=gnu.org ; is there any bugreport tracker where one can file a bug instead ? >> >> >> Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual build of the sources from https://protect-au.mimecast.com/s/b7SyCXLKNwFA3GlmTVBluL?domain=ftp.gnu.org ): >> >> >> === parted version === >> >> >> # parted --version >> parted (GNU parted) 3.2 >> Copyright (C) 2014 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later . >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. >> >> Written by . >> >> === print unit s print unit chs print === >> >> >> # parted /dev/sdi print unit s print unit chs print >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 3001GB >> Sector size (logical/physical): 512B/512B >> Partition Table: gpt >> Disk Flags: >> >> Number Start End Size File system Name Flags >> >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 5860533168s >> Sector size (logical/physical): 512B/512B >> Partition Table: gpt >> Disk Flags: >> >> Number Start End Size File system Name Flags >> >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 364801,80,62 >> Sector size (logical/physical): 512B/512B >> BIOS cylinder,head,sector geometry: 364801,255,63. Each cylinder is 8225kB. >> Partition Table: gpt >> Disk Flags: >> >> Number Start End File system Name Flags >> >> === the problem === >> >> >> # parted /dev/sdi >> GNU Parted 3.2 >> Using /dev/sdi >> Welcome to GNU Parted! Type 'help' to view a list of commands. >> (parted) mkpart test1 0% 1T >> (parted) unit B >> (parted) print >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 3000592982016B >> Sector size (logical/physical): 512B/512B >> Partition Table: gpt >> Disk Flags: >> >> Number Start End Size File system Name Flags >> 1 33553920B 1000007477759B 999973923840B test1 >> >> (parted) align-check optimal 1 >> 1 aligned >> (parted) align-check minimal 1 >> 1 not aligned >> (parted) >> >> >> ===== >> >> >> First of all, start sector value looks insanely big for "0%" ; second, one would imagine that passing an optimal check would imply passing a minimal check. >> >> >> If one tries to start at e.g. 1 MiB, then of course the optimal check will not pass : >> >> >> ===== >> >> # parted /dev/sdi >> GNU Parted 3.2 >> Using /dev/sdi >> Welcome to GNU Parted! Type 'help' to view a list of commands. >> (parted) print >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 3001GB >> Sector size (logical/physical): 512B/512B >> Partition Table: gpt >> Disk Flags: >> >> Number Start End Size File system Name Flags >> >> (parted) mkpart test1 ext2 2048s 1T >> Warning: The resulting partition is not properly aligned for best performance. >> Ignore/Cancel? I >> (parted) unit B >> (parted) print >> Model: WDC WD30 EZRZ-00Z5HB0 (scsi) >> Disk /dev/sdi: 3000592982016B >> Sector size (logical/physical): 512B/512B >> Partition Table: gpt >> Disk Flags: >> >> Number Start End Size File system Name Flags >> 1 1048576B 1000000000511B 999998951936B ext2 test1 >> >> (parted) align-check optimal 1 >> 1 not aligned >> (parted) align-check minimal 1 >> 1 aligned >> >> ===== >> >> >> As it turns out, the root of all evil comes from here : >> >> >> ===== >> >> # cat /sys/block/sdi/queue/optimal_io_size >> 33553920 >> ===== >> >> So parted is not to blame, but the system. But from the user's point of view, it is quite hard to figure this out. And certainly the user deserves to know the actual values that parted considers to be of best performance -- I mean, pa->offset and pa->grain_size from parted.c::print_partition_alignment() shall probably be exposed in some way -- at least when it comes to a warning like the one above. >> >> >> >> >> Kind regards >> Georgy Fedorov >> Senior Systems Specialist >> Melbourne School of Engineering >> The University of Melbourne, Victoria 3010, Australia >> email: gfedorov@unimelb.edu.au >> http://www.eng.unimelb.edu.au >> -- George Fedorov Senior Systems Specialist Melbourne School of Engineering The University of Melbourne, Victoria 3010, Australia email: gfedorov@unimelb.edu.au http://www.eng.unimelb.edu.au/ --------------2A85C4F4D11A67281EBB2B27 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Thank you -- that's a very good point.

Just in case if this thread would get indexed, I would add a reference for usb-storage quirks:
https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html ( search for "usb-storage.quirks=" )

Kind regards, George

On 4/8/19 2:15 am, Volta wrote:
I'm not a parted dev, just a user, but I've run into this same issue
several times.  This wouldn't happen to be a USB device using the UAS
driver? IME setting quirks mode for such devices so they use the
usb-storage driver instead yields sensible values for optimal_io_size,
etc. so parted can do the right thing with 0% and properly align the
partitions.  This also works around other issues I've had with these
devices randomly disconnecting when using UAS. My
/etc/modprobe.d/usbdisks.conf file contains:

options usb-storage
quirks=0x0bc2:0xab31:u,0x0bc2:0x3322:u,0x0bc2:0xa0a4:u,0x0bc2:0x331a:u,0x0bc2:3343:u

get the device identifiers for the affected device(s) from lsusb,
stick them in there, then 'depmod -a' and reboot or remove and
reattach the device(s) (the latter should work, but sometimes the
kernel doesn't do the right thing, and I've not bothered to
investigate further as I only use USB disks on workstations that are
easily rebooted), then try parted again.

Doesn't really "solve" the problem, which I understand to be with the
UAS implementation in these devices, but at least it is a usable
workaround.

On Sat, 3 Aug 2019 at 11:18, George Fedorov <gfedorov@unimelb.edu.au> wrote:
Hi,


I was directed here by the page at https://protect-au.mimecast.com/s/yFf9CWLJMvF3vx10s6x6jT?domain=gnu.org ; is there any bugreport tracker where one can file a bug instead ?


Anyway, here's the problem ( manifested in parted 3.2 coming with Ubuntu 18.04 and checked vs. a manual build of the sources from https://protect-au.mimecast.com/s/b7SyCXLKNwFA3GlmTVBluL?domain=ftp.gnu.org  ):


=== parted version ===


# parted --version
parted (GNU parted) 3.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://protect-au.mimecast.com/s/wE-3CYWLOxhYPgK5s9N9ZR?domain=gnu.org>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <https://protect-au.mimecast.com/s/T3hlCZYMPyCvyx1zcygnbo?domain=git.debian.org>.

=== print unit s print unit chs print ===


# parted /dev/sdi print unit s print unit chs print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 5860533168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 364801,80,62
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 364801,255,63.  Each cylinder is 8225kB.
Partition Table: gpt
Disk Flags:

Number  Start  End  File system  Name  Flags

=== the problem ===


# parted /dev/sdi
GNU Parted 3.2
Using /dev/sdi
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart test1 0% 1T
(parted) unit B
(parted) print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3000592982016B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End             Size           File system  Name   Flags
 1      33553920B  1000007477759B  999973923840B               test1

(parted) align-check optimal 1
1 aligned
(parted) align-check minimal 1
1 not aligned
(parted)


=====


First of all, start sector value looks insanely big for "0%" ; second, one would imagine that passing an optimal check would imply passing a minimal check.


If one tries to start at e.g. 1 MiB, then of course the optimal check will not pass :


=====

# parted /dev/sdi
GNU Parted 3.2
Using /dev/sdi
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart test1 ext2 2048s 1T
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
(parted) unit B
(parted) print
Model: WDC WD30 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdi: 3000592982016B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start     End             Size           File system  Name   Flags
 1      1048576B  1000000000511B  999998951936B  ext2         test1

(parted) align-check optimal 1
1 not aligned
(parted) align-check minimal 1
1 aligned

=====


As it turns out, the root of all evil comes from here :


=====

# cat /sys/block/sdi/queue/optimal_io_size
33553920
=====

So parted is not to blame, but the system. But from the user's point of view, it is quite hard to figure this out. And certainly the user deserves to know the actual values that parted considers to be of best performance -- I mean, pa->offset and pa->grain_size from parted.c::print_partition_alignment() shall probably be exposed in some way -- at least when it comes to a warning like the one above.




Kind regards
Georgy Fedorov
Senior Systems Specialist
Melbourne School of Engineering
The University of Melbourne, Victoria 3010, Australia
email: gfedorov@unimelb.edu.au
http://www.eng.unimelb.edu.au


    

-- 
George Fedorov
Senior Systems Specialist
Melbourne School of Engineering
The University of Melbourne, Victoria 3010, Australia
email: gfedorov@unimelb.edu.au
http://www.eng.unimelb.edu.au/
--------------2A85C4F4D11A67281EBB2B27-- From unknown Mon Aug 18 04:47:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 04 Sep 2019 11:24:04 +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