NetBSD Problem Report #55991

From ryo@tetera.org  Sat Feb 13 05:34:24 2021
Return-Path: <ryo@tetera.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CFBCE1A9217
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 13 Feb 2021 05:34:24 +0000 (UTC)
Message-Id: <602764dd.1c69fb81.a1d89.74d0@mx.google.com>
Date: Sat, 13 Feb 2021 14:34:20 +0900
From: ryo@tetera.org
Reply-To: ryo@tetera.org
To: gnats-bugs@NetBSD.org
Subject: GPT installation of NetBSD/amd64 9.99.80 has unused space in disk
X-Send-Pr-Version: 3.95

>Number:         55991
>Category:       install
>Synopsis:       GPT installation of NetBSD/amd64 9.99.80 has unused space in disk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 13 05:35:00 +0000 2021
>Closed-Date:    Fri Dec 30 15:10:34 +0000 2022
>Last-Modified:  Fri Dec 30 15:10:34 +0000 2022
>Originator:     Ryo ONODERA
>Release:        NetBSD 9.99.80
>Organization:
Ryo ONODERA // ryo@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>Environment:


System: NetBSD brownie 9.99.80 NetBSD 9.99.80 (DTRACE7) #6: Sat Feb 13 08:23:59 JST 2021 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/DTRACE7 amd64
Architecture: x86_64
Machine: amd64
>Description:
Using http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202102120920Z/images/NetBSD-9.99.80-amd64-install.img.gz ,
sysinst creates GPT partitions as follows by default:

# gpt show wd0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34       2014         Unused
       2048     262144      1  GPT part - EFI System
     264192  483258989      2  GPT part - NetBSD FFSv1/FFSv2
  483523181       1427         Unused
  483524608   16593551      3  GPT part - NetBSD swap
  500118159         32         Sec GPT table
  500118191          1         Sec GPT header

Unused space (size: 1427) is created.
I want to use full disk space.

>How-To-Repeat:
Install NetBSD/amd64 9.99.80 with sysinst
in NetBSD-9.99.80-amd64-install.img.gz.
And run
# gpt show wd0

>Fix:

I have no idea.

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/55991: GPT installation of NetBSD/amd64 9.99.80 has
 unused space in disk
Date: Sat, 13 Feb 2021 08:24:44 +0100

 On Sat, Feb 13, 2021 at 05:35:00AM +0000, ryo@tetera.org wrote:
 > Unused space (size: 1427) is created.
 > I want to use full disk space.

 The installer aligns partitions (depending on disk total size and sector
 size, in your case apparently to 2048 block boundaries). The second gap
 in your setup is a side effect of that and could be avoided though.

 You should be able to work around it by switching from "MB" or "GB" as
 input size to single blocks (which is considered an expert option and
 not recommended for normal installs).

 Martin

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 13 Feb 2021 07:25:21 +0000
Responsible-Changed-Why:
take


State-Changed-From-To: open->feedback
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sat, 13 Feb 2021 15:33:21 +0000
State-Changed-Why:
This should be better now - can you test easily?


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55991 CVS commit: src/usr.sbin/sysinst
Date: Sat, 13 Feb 2021 15:31:36 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Feb 13 15:31:36 UTC 2021

 Modified Files:
 	src/usr.sbin/sysinst: bsddisklabel.c

 Log Message:
 PR 55991: when extending the marked partition (typically: the NetBSD root
 partition) round the new size up to current alignment.

 This may lead to a slightly smaller than initialy planned last partition
 (depending on order added) if the disk size is odd or the partitioning
 scheme needs some internal space (like GPT) - but it avoids gaps elsewhere
 due to alignement.

 Ideally we would pin all other partitions in a first pass and then let
 the partitioning backend pick the full available size for the extended
 partition, but this should be good enough.


 To generate a diff of this commit:
 cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/sysinst/bsddisklabel.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Robert Elz <kre@munnari.OZ.AU>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/55991: GPT installation of NetBSD/amd64 9.99.80 has unused space in disk
Date: Sun, 14 Feb 2021 00:08:34 +0700

     Date:        Sat, 13 Feb 2021 07:25:01 +0000 (UTC)
     From:        Martin Husemann <martin@duskware.de>
     Message-ID:  <20210213072501.70CD51A9241@mollari.NetBSD.org>

   |  The installer aligns partitions (depending on disk total size and sector
   |  size, in your case apparently to 2048 block boundaries). The second gap
   |  in your setup is a side effect of that and could be avoided though.

 I would suggest (which is probably what you're already doing) that when
 in some specification size mode other than individual blocks, and when
 partitions are being aligned, that the sizes be rounded up to the next
 alignment boundary.

 When someone says they want a 200GB filesystem, they don't care if it is
 200GB plus a few hundred blocks - making an exact 200GB sized filesystem,
 and then leaving a gap so the next one can be properly aligned is distinctly
 sub-optimal.   On the other hand, if the user tells you the exact number
 of blocks to use, believe them, and use exactly that number (if possible, and
 if not, error).

 kre

From: John Nemeth <jnemeth@cue.bc.ca>
To: gnats-bugs@netbsd.org, install-manager@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org, ryo@tetera.org
Cc: 
Subject: Re: install/55991: GPT installation of NetBSD/amd64 9.99.80 has unused space in disk
Date: Sat, 13 Feb 2021 15:00:12 -0800

 On Feb 13,  7:25, Martin Husemann wrote:
 }
 } The following reply was made to PR install/55991; it has been noted by GNATS.
 } 
 } From: Martin Husemann <martin@duskware.de>
 } Date: Sat, 13 Feb 2021 08:24:44 +0100
 } 
 }  On Sat, Feb 13, 2021 at 05:35:00AM +0000, ryo@tetera.org wrote:
 }  > Unused space (size: 1427) is created.
 }  > I want to use full disk space.
 }  
 }  The installer aligns partitions (depending on disk total size and sector
 }  size, in your case apparently to 2048 block boundaries). The second gap
 }  in your setup is a side effect of that and could be avoided though.
 }  
 }  You should be able to work around it by switching from "MB" or "GB" as
 }  input size to single blocks (which is considered an expert option and
 }  not recommended for normal installs).

      See this to get automatic alignment of both start and size:

      gpt add [-a alignment] [-b blocknr] [-i index] [-l label] [-s size] [-t
              type]
              The add command allows the user to add a new partition to an
              existing table.  By default, it will create a UFS partition
              covering the first available block of an unused disk space.  The
              command-specific options can be used to control this behaviour.

              The -a alignment option allows the user to specify an alignment
              for the start and size.  The alignment is given in bytes and may
              have a suffix to indicate its magnitude.  gpt will attempt to
              align the partition.

 }-- End of excerpt from Martin Husemann

From: Ryo ONODERA <ryo@tetera.org>
To: gnats-bugs@netbsd.org, martin@netbsd.org
Cc: 
Subject: Re: install/55991 (GPT installation of NetBSD/amd64 9.99.80 has
 unused space in disk)
Date: Fri, 30 Dec 2022 06:06:31 +0900

 Hi,

 martin@NetBSD.org writes:

 > Synopsis: GPT installation of NetBSD/amd64 9.99.80 has unused space in disk
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: martin@NetBSD.org
 > State-Changed-When: Sat, 13 Feb 2021 15:33:21 +0000
 > State-Changed-Why:
 > This should be better now - can you test easily?

 I am very sorry. I had not sent feedback.
 It works fine for me now.
 Please close this PR.
 Thank you very much.

 -- 
 Ryo ONODERA // ryo@tetera.org
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3

State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 30 Dec 2022 15:10:34 +0000
State-Changed-Why:
Confirmed fixed, thanks for the report!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.