On Wed, 24 Jan 2024 10:44:57 -0500
Ed Maste <ema...@freebsd.org> wrote:

> MBR (PC BIOS) partition tables were historically maintained with
> fdisk(8), but gpart(8) has long been the preferred method for working
> with partition tables of all types. fdisk has been declared as
> obsolete in the man page since 2015. Similarly BSD disklabels were
> historically maintained with bsdlabel. It does not yet have a
> deprecation notice - I have proposed a man page addition in
> https://reviews.freebsd.org/D43563.
> 
> I would like to disconnect these from the build, and subsequently
> remove them. This is prompted by a recent bsdlabel bug report which
> uncovered a longstanding buffer overflow in that tool. Effort is much
> better focused on contemporary, maintained tools rather than
> investigating issues in deprecated ones. Removing these tools would
> happen in FreeBSD 15 only (no change in 14 or 13).
> 
> Code review to disconnect fdisk: https://reviews.freebsd.org/D43575
> 
> Note that this effort is limited to these maintenance tools only -
> there is no change to kernel or gpart support for MBR or BSD
> disklablel partitioning. That said, MBR partitioning and BSD
> disklabels are best considered legacy formats and should be avoided
> for new installations, if possible.
> 
> If anyone is using fdisk and/or bsdlabel rather than gpart I would
> appreciate knowing what is preventing you from using the contemporary
> tools.
> 

FYI gpart doesn't allow you to create disklabel with more than 8 items
either.

robert@venus ~ 563$ doas mdconfig -l
md0 
robert@venus ~ 564$ doas mdconfig -lv
md0     vnode      40M  /usr/home/robert/test_disk.img  
robert@venus ~ 565$ doas gpart backup md0
MBR 4
1 freebsd     1 81919  
robert@venus ~ 566$ doas gpart backup md0s1
BSD 8
1  freebsd-ufs     0  4096  
2 freebsd-swap  4096  4096  
4  freebsd-ufs  8192  4096  
5  freebsd-ufs 12288  4096  
6  freebsd-ufs 16384  4096  
7  freebsd-ufs 20480  4096  
8  freebsd-ufs 24576  4096  
robert@venus ~ 567$ doas gpart add -t freebds-swap -s 2M md0s1
gpart: index '9': No space left on device
robert@venus ~ 568$ doas gpart add -t freebds-swap -s 2M -i 9 md0s1
gpart: index '9': Invalid argument
robert@venus ~ 569$ bsdlabel /dev/md0s1
bsdlabel: unable to get correct path for /dev/md0s1: Permission denied
robert@venus ~ 570$ doas bsdlabel /dev/md0s1 
# /dev/md0s1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:       4096          0    4.2BSD        0     0     0
  b:       4096       4096      swap                    
  c:      81919          0    unused        0     0     # "raw" part, don't edit
  d:       4096       8192    4.2BSD        0     0     0
  e:       4096      12288    4.2BSD        0     0     0
  f:       4096      16384    4.2BSD        0     0     0
  g:       4096      20480    4.2BSD        0     0     0
  h:       4096      24576    4.2BSD        0     0     0
robert@venus ~ 571$ 

I still need to get a netBSD VM running and create a test file with more than 8
partitions under a bsdlabel to see if gpart crashes.

Reply via email to