ahdilabel allows you to modify the AHDI partition table on a disk partitioned with AHDI or an AHDI compatible formatter. The AHDI partition format is usually only present on disks shared between
NetBSD and some other OS. The partition identifiers are used by
NetBSD as a guideline to emulate a disklabel on such a disk.
ahdilabel supports the following options:
disk
The name of the disk you want to edit. ahdilabel will first try to open a disk of this name. If this cannot be opened, it will attempt to open r<disk>c. Finally, if this also cannot be opened, it will attempt to open /dev/r<disk>c.
ahdilabel will display information about the number of sectors, tracks and sectors on the disk, as well as the current AHDI partition information. It will then prompt for input. The input choices are:
a-p
Modify a partition. You will be prompted for a partition id, root, start and size.
NetBSD recognises the following partition id's:
NBD
Partition is reserved for NetBSD. This can be either a root or an user partition. The first NBD partition on a disk will be mapped to NetBSD partition letter a. The following NBD partitions will be mapped from letter d up. The filesystem type is ffs by default.
SWP
The first SWP partition is mapped to partition b.
GEM or BGM
These partitions are mapped from d up. The filesystem type is msdos.
The root, start and size parameters can be entered using sector, cylinder/track/sector or megabyte notations. Whole numbers of cylinders can be entered using the shorthand <cylinder>/. Likewise, whole numbers of tracks can be entered using the shorthand <cylinder>/<track>/. Megabytes are entered using the suffix
M.
The following can also be used to enter partition parameters:
-N (root)
Position the root sector for this partition immediately after partition N.
-N (start)
Make this partition start after partition N (leaving a gap of 1 sector for a root sector, if necessary).
-N (size)
Make this partition end immediately before partition N.
-1 (size)
Make this partition extend to the end of the disk.
The sector holding the primary AHDI partition table only has space for four partitions. Thus, if a disk has more than four partitions, the extra partition information is held in auxiliary root sectors. There is one auxiliary root for each additional partition (and also for the fourth partition, if the disk has more than four partitions).
r
Recalculate the root sectors. This will automatically assign auxiliary root sectors if the disk has more than 4 partitions. The auxiliary root sectors will be positioned in a default location preceding the relevant partition.
s
Show the current partition information.
u
Toggle the unit display between sector and cylinder/track/sector notation.
w
Write the AHDI partition table to the disk.
z
Options for zero'ing the boot sector and bad sector lists. The default is to preserve them both.