Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2025 03:19:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        sysinstall@FreeBSD.org
Subject:   [Bug 287904] Most recent installer fails to flush pre-existing GPT labels
Message-ID:  <bug-287904-8135-zD8xz6sIDD@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-287904-8135@https.bugs.freebsd.org/bugzilla/>
References:  <bug-287904-8135@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287904

--- Comment #4 from Dennis Clarke <dclarke@blastwave.org> ---

Starting over and over and over again wherein I drop to a single user
shell from the installer disk1.iso image ( FreeBSD 14.3-RELEASE ) and
then manually use dd to wipe out the GPG labels at the beginning of
the disk and ALSO the backup labels at the end of the disk : 

# 
# gpart show -l /dev/ada0
=>       40  488390552  ada0  GPT  (233G)
         40     532480     1  efiboot0  (260M)
     532520       1024     2  gptboot0  (512K)
     533544        984        - free -  (492K)
     534528   33554432     3  swap0  (16G)
   34088960  454299648     4  zfs0  (217G)
  488388608       1984        - free -  (992K)

# gpart show -l /dev/ada1
=>       40  488390552  ada1  GPT  (233G)
         40     532480     1  efiboot1  (260M)
     532520       1024     2  gptboot1  (512K)
     533544        984        - free -  (492K)
     534528   33554432     3  swap1  (16G)
   34088960  454299648     4  zfs1  (217G)
  488388608       1984        - free -  (992K)

# gpart destroy -F /dev/ada0
ada0 destroyed
# gpart destroy -F /dev/ada1
ada1 destroyed
# 

Now nuke the beginning of the disks :

# 
# dd if=/dev/zero of=/dev/ada0 bs=65536 count=8192 status=progress
  506527744 bytes (507 MB, 483 MiB) transferred 6.063s, 84 MB/s
8192+0 records in
8192+0 records out
536870912 bytes transferred in 6.477946 secs (82876725 bytes/sec)
# dd if=/dev/zero of=/dev/ada1 bs=65536 count=8192 status=progress
  506396672 bytes (506 MB, 483 MiB) transferred 6.063s, 84 MB/s
8192+0 records in
8192+0 records out
536870912 bytes transferred in 6.478905 secs (82864448 bytes/sec)
# 

# dmesg | grep 'ada0'
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SEAGATE ST32500NSSUN250G 0745B68PY6 3AZQ> ATA-7 SATA 2.x device
ada0: Serial Number 9QE68PY6
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada0: Command Queueing enabled
ada0: 238471MB (488390625 512 byte sectors)
ses0: ada0,pass0 in 'Slot 00', SATA Slot: scbus0 target 0
# 

Note the number 488390625 of sectors on the disk.
GPART tells me 488390552 with a 40 block offset.

Thankfully these are older and ( sort of ) smaller disks.

So the trick is to read what dmesg says the real physical size of the disk
is and then compute a pile of blocks backwards from the end and nuke them.

$  echo '8k 488390625 65536 - pq' | dc 
488325089

# dd if=/dev/zero of=/dev/ada0 bs=512 oseek=488325089 count=65536
status=progress
  30327296 bytes (30 MB, 29 MiB) transferred 7.063s, 4294 kB/s   
65536+0 records in
65536+0 records out
33554432 bytes transferred in 7.857187 secs (4270540 bytes/sec)
# dd if=/dev/zero of=/dev/ada1 bs=512 oseek=488325089 count=65536
status=progress
  30386688 bytes (30 MB, 29 MiB) transferred 7.063s, 4302 kB/s   
65536+0 records in
65536+0 records out
33554432 bytes transferred in 7.838621 secs (4280655 bytes/sec)
# 

This was verified with a test and we see end of media hit if we add
even a single 512 byte block : 

# 
# dd if=/dev/zero of=/dev/ada0 bs=512 oseek=488325089 count=65537
status=progress
dd: /dev/ada0: end of deviceMiB) transferred 7.063s, 4291 kB/s   

65537+0 records in
65536+0 records out
33554432 bytes transferred in 7.823743 secs (4288795 bytes/sec)
# 

At this point I believe that the GPT data has been wiped off the disks.

Once again perform the usual install process with the installer and then
drop to a shell at the end to inspect the wreckage :

This shell is operating in a chroot in the new system. When finished making
configuration changes, type "exit".
root@triton:/ # 

root@triton:/ # cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/gpt/efiboot0               /boot/efi       msdosfs rw              2     
2
/dev/mirror/swap                none    swap    sw              0       0
root@triton:/ #

root@triton:/ # 
root@triton:/ # gpart show -l /dev/ada0
=>       40  488390552  ada0  GPT  (233G)
         40     532480     1  efiboot0  (260M)
     532520       1024     2  gptboot0  (512K)
     533544        984        - free -  (492K)
     534528   33554432     3  swap0  (16G)
   34088960  454299648     4  zfs0  (217G)
  488388608       1984        - free -  (992K)

root@triton:/ # gpart show -l /dev/ada1
=>       40  488390552  ada1  GPT  (233G)
         40     532480     1  efiboot1  (260M)
     532520       1024     2  gptboot1  (512K)
     533544        984        - free -  (492K)
     534528   33554432     3  swap1  (16G)
   34088960  454299648     4  zfs1  (217G)
  488388608       1984        - free -  (992K)

root@triton:/ # 

The only geom mirror that exists is swap : 

root@triton:/ # kldload geom_mirror
GEOM_MIRROR: Device mirror/swap launched (2/2).
root@triton:/ # gmirror status
       Name    Status  Components
mirror/swap  COMPLETE  ada1p3 (ACTIVE)
                       ada0p3 (ACTIVE)
root@triton:/ # 

However we do have something under /dev/gpt :

root@triton:/ # ls /dev/gpt/
efiboot0        efiboot1        gptboot0        gptboot1
root@triton:/ # 

Now I exit from the chroot shell session and reboot : 


                  ┌───────────────┤Complete├────────────────┐
                  │ Installation of FreeBSD complete! Would │  
                  │ you like to reboot into the installed   │  
                  │ system now?                             │  
                  ├─────────────────────────────────────────┤  
                  │[  Reboot   ] [ Shutdown  ] [Live System]│  
                  └─────────────────────────────────────────┘  



Loading kernel...
/boot/kernel/kernel text=0x180078 text=0xd97948 text=0x43a46b data=0x180+0xe80
data=0x187590+0x478a70 0x8+0x18e940+0x8+0x1b2b03|
Loading configured modules...
can't find '/etc/hostid'
/boot/kernel/zfs.ko size 0x5e9340 at 0x2142000
/boot/kernel/cryptodev.ko size 0x7808 at 0x272c000
/boot/kernel/geom_mirror.ko size 0x21350 at 0x2734000
/boot/entropy size=0x1000
staging 0x44800000 (not copying) tramp 0x4475b000 PT4 0x44752000
Start @ 0xffffffff80381000 ...
EFI framebuffer information:
addr, size     0xe0000000, 0x258000
dimensions     800 x 600
stride         1024
masks          0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
---<<BOOT>>---
Copyright (c) 1992-2023 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC amd64
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git
llvmorg-19.1.7-0-gcd708029e0b2)
.
.
.
uart0: console (38400,n,8,1)
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
.
.
.
ZFS filesystem version: 5
ZFS storage pool version: features support (5000)
hdacc0: <Realtek ALC662 rev3 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC662 rev3 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC662 rev3 (Analog 2.0+HP/2.0)> at nid 20,27 and 24,26 on hdaa0
pcm1: <Realtek ALC662 rev3 (Analog)> at nid 21 and 25 on hdaa0
hdacc1: <NVIDIA (0x0060) HDA CODEC> at cad 0 on hdac1
hdaa1: <NVIDIA (0x0060) Audio Function Group> at nid 1 on hdacc1
pcm2: <NVIDIA (0x0060) (HDMI/DP 8ch)> at nid 4 on hdaa1
pcm3: <NVIDIA (0x0060) (HDMI/DP 8ch)> at nid 5 on hdaa1
Trying to mount root from zfs:zroot/ROOT/default []...
.
.
.
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SEAGATE ST32500NSSUN250G 0745B68PY6 3AZQ> ATA-7 SATA 2.x device
ada0: Serial Number 9QE68PY6
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada0: Command Queueing enabled
ada0: 238471MB (488390625 512 byte sectors)
ada1 at ahcich1 bus 0 scbus1 target 0 lun 0
ada1: <SEAGATE ST32500NSSUN250G 0744B64QYY 3AZQ> ATA-7 SATA 2.x device
ada1: Serial Number 9QE64QYY
ada1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada1: Command Queueing enabled
ada1: 238471MB (488390625 512 byte sectors)
.
.
.
GEOM_MIRROR: Device mirror/swap launched (2/2).
.
.
.
Starting file system checks:
/dev/gpt/efiboot0: FILESYSTEM CLEAN; SKIPPING CHECKS
Mounting local filesystems:.
.
.
.

Boot completes normally.

There is no mention of anything like an EFI geom mirror for the DOS
partitions. Perhaps they are never mirrored?

This is the first time I have seen this work. Clearly the installer script
is not clearing out the GPT label data from the disks involved.

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-287904-8135-zD8xz6sIDD>