DISKSETUP(8) DISKSETUP(8)
NAME
disksetup - read and write disk labels
SYNOPSIS
disksetup disk
disksetup -e disk [ xxboot bootxx [ mboot ] ]
disksetup -i [ -I ] disk
disksetup -R disk protofile [ xxboot bootxx [ mboot ] ]
disksetup [ -NW ] disk
DESCRIPTION
The goal of the disksetup program is to define the FDISK
table if needed (see below), the BSD partition tables (and
geometry information), and to write the appropriate boot
blocks to the disk.
Disksetup installs, examines, or modifies both the FDISK
and BSD/386 disk labels on a disk drive. Disksetup can
set or change the disk geometry, the sizes, types and off-
sets for the FDISK and BSD/386 partitions. It can also
write both BSD/386 boot blocks and, optionally, master
boot record boot blocks.
A disk shared between BSD/386 and any other operating sys-
tem(s) has a single FDISK partition table in its first
physical sector. This table defines 1 to 4 partitions
which enumerate the extents of the sections of the disk
used by various operating systems and the types of those
sections. Additionally, the FDISK table indicates which
partition is currently `active' and will be used for the
next reboot (unless overridden). The FDISK partition
table is used by BSD/386 only to find the location of the
BSD part of the disk. The four FDISK partitions are num-
bered `1' through `4'.
Disks used by BSD/386 also have a BSD label (in sector 1
of the bootable BSD partition) which describes the geome-
try of the entire disk (number of heads, sectors, tracks,
etc.) and enumerates 1 to 8 BSD partitions which are named
`a' through `h'.
BSD/386 uses the BSD partition definitions to access the
disk (including access of MS-DOS files in other FDISK par-
titions).
In common usage, BSD/386 divides its part of the primary
disk into three sections: one for the root filesystem
(always the `a' partition), one for swapping (and paging)
(always the `b' partition), and one for /usr and other
files (usually the `h' partition). If BSD/386 is to
access other parts of the disk (e.g., for MS-DOS co-
residency), another partition is assigned to refer to that
disk data (often the `d' partition).
February 18,1993 1
DISKSETUP(8) DISKSETUP(8)
More advanced users sometimes set up additional parti-
tions, e.g., for the /var directories.
Confusingly enough, BSD/386 always defines one more parti-
tion: the `c' partition. The `c' partition refers to the
entire disk (including the boot blocks and the bad sector
table at the end of the disk). This partition obviously
overlaps with any other BSD partition on the disk. The
`c' partition can be used to define a filesystem only on
non-primary disks and only on disks that have no bad-block
table (e.g., SCSI). The `c' partition must not be used to
store BSD/386 filesystems on IDE or ESDI drives (drives
using the wd disk driver). Instead, use a different,
slightly shorter partition (e.g., define `h' to be the
entire usable portion of the disk). In the interactive
(-i) mode, disksetup enforces the correct maximum size.
INVOKING disksetup IN THE INTERACTIVE MODE
Disksetup is most often used in the interactive mode.
Invoke it by specifying the -i flag and naming the disk to
be set up. The example below shows invocations for SCSI
and non-SCSI primary drives, respectively:
# disksetup -i sd0
or
# disksetup -i wd0
If the -I option is also specified, disksetup will ignore
any existing label on the disk. This can be very useful
if an incorrect geometry was previously specified, or if
the current label is valid but incorrect for some reason.
Other options are described below.
disksetup asks if the disk is to be used exclusively for
BSD partitions or if it is to be shared with other operat-
ing systems. Answer the question appropriately.
disksetup learns the drive's geometry either by reading it
from an existing BSD label on the drive or by querying the
user. If no BSD label previously existed, no geometry
information is available so disksetup asks the user to
supply one. Otherwise, disksetup proceeds to the sizing
screens (see below).
When no geometry information is available, disksetup asks
the user to choose from:
o running the scsicmd utility (only for SCSI disks, of
course) to query the drive for its geometry,
o supplying the name of a `disktab' entry that corresponds
to the disk to be labeled (chosen from the file
/etc/disktab),
o querying the kernel for the current geometry (the kernel
may have information from an on-disk label or from the
CMOS),
February 18,1993 2
DISKSETUP(8) DISKSETUP(8)
o querying an IDE/ESDI controller for the geometry,
o answering prompts about the geometry,
o naming a file containing a saved geometry (from a previ-
ous invocation of disksetup (described later) or some
other command)
Except for supplying the answers to prompts, all choices
above proceed `automatically'. When answering the
prompts, the user must supply the following data: inter-
face type, vendor and type (e.g., `Maxtor P012S') which is
only used to document the disk's vendor and type ID,
bytes/sector (usually 512, always a multiple of 512), num-
ber of cylinders (from the manual; must be the number of
data cylinders on the drive - it excludes those cylinders
for the drive's own internal use such as for bad blocks),
number of heads (also known as tracks/cylinder; from the
manual), number of sectors per track (from the manual),
and total data sectors (which might not be the same as the
default in the unlikely case that the last cylinder is not
a complete one). The user then verifies that the informa-
tion is correct before proceeding.
INTERACTIVE SIZING
Disksetup displays one of two different screen sets for
sizing, depending on whether the drive is to be shared
between operating systems. If the drive is used exclu-
sively for BSD/386, then disksetup displays the `BSD Par-
tition Sizing' screen. Otherwise, it displays the `FDISK
Partition Sizing & BSD Partition Assignment' screen. Sep-
arate sections that follow document these two different
execution paths.
In general, the interactive screens use `hot keys' for
their commands and otherwise require a `return' to be
entered after the input. A `return' with no input usually
aborts the current operation; otherwise, it indicates
acceptance of a default value which has been presented
between square brackets. Your backspace and line delete
characters work correctly for input to these screens.
Numbers can be entered in many ways: absolute, relative,
and with a unit suffix. Absolute numbers are entered
without a sign and have a value identical to the number
typed. Relative numbers are preceded by a + or - sign and
specify a change to the current value (i.e., an increase
or decrease).
Normally, numbers represent sectors, However, specifying
a unit suffix can change the meaning of the numbered
typed. Use the `m' suffix to specify megabytes (1024*1024
bytes); `c' for cylinders, or `M' for cylinder-aligned-
megabytes (the entered number multiplied by 1024*1024 and
rounded up to the nearest cylinder boundary.
February 18,1993 3
DISKSETUP(8) DISKSETUP(8)
BSD PARTITION SIZING SCREEN'
In the BSD-only scenario, the sizing screen resembles
this:
BSD Partition Sizing
BSD Type Size MB Start End Warnings
a 4.2 33600 ( 16) 0 33599
b swap 134400 ( 65) 33600 167999
c Unused 639450 ( 312) 0 639449
d 4.2 67200 ( 32) 168000 235199
e 4.2 67200 ( 32) 235200 302399
f <unused>
g <unused>
h 4.2 337050 ( 164) 302400 639449
Last Data Sector: 639449
Commands: [T]ype [S]tart [L]ength [N]ext phase
Command>
Directions:
Use `L' and `S' to set the BSD partition Lengths and Starting sectors
Use `T' to set the BSD partition Types
Use `N' to move to the next phase: Installing boot blocks
Numbers can be relative (with + or -) or suffixed with c (cylinders),
m (megabytes), or M (megabytes rounded to cylinders)
The goal of this screen is to set the sizes, starting off-
sets (i.e., starting sector numbers), and types of the BSD
partitions.
This screen allows you to set up overlapping partitions
and will display a warning in the `Warnings' column.
Unless you have specific needs for overlapping partitions,
they are best avoided.
Use the `T', `S', and `L' keys to set the parameters you
desire. As a starting idea, consider using an 8 MB `a'
(root) partition, 16 MB `b' (swap) partition (32MB if you
will be using the X window system or MFS, the memory based
filesystem), and allocating the remainder to the `h' par-
tition for /usr directory and files owned by your system's
users.
Enter `N' when the parameters shown meet your needs to
move to the next phase: boot block installation (if you
are using BSD partitions only; skip the next section and
move on to the discussion of boot blocks).
February 18,1993 4
DISKSETUP(8) DISKSETUP(8)
FDISK PARTITION SIZING & BSD PARTITION ASSIGNMENT SCREENS
The first FDISK & BSD sizing screen resembles this (though
your system may already have FDISK and/or BSD partitions
which would then appear in the table:
FDISK Partition Sizing & BSD Partition Assignment
FDISK
Part# type Start Length MB BSD Partitions Warnings
1 [--unused--]
2 [--unused--]
3 [--unused--]
4 [--unused--]
Last data sector: 414364 Gap at end: 414365
Unassigned BSD partitions: a b d e f g h
Commands: [T]ype [S]tart [L]ength [A]ssign BSD partition [N]ext
phase
Command>
Directions:
Use `L' and `S' to set the FDISK partition Lengths and Starting sectors
Use `T' to set the FDISK partition Types
Use `A' to assign the BSD partitions to cover the FDISK partitions
-- One BSD partition for non-BSDI FDISK partitions
-- One or more BSD partitions for BSDI FDISK partitions
-- Assignment is to the end of the partition list
Use `N' to move to the next phase: BSD partition sizing
This screen has two goals. It sets the starting sector,
length, and type for each FDISK partition to be used. It
also assigns the name of the BSD partition(s) to be asso-
ciated with each FDISK partition.
The disksetup program does not allow arbitrary disk lay-
outs; instead it enforces common sense rules. For
instance, disksetup does not allow partitions to overlap
in any final configuration.
Automatically enforced rules: Disksetup occasionally
adjusts start addresses to various boundaries (a warning
is shown). Only the BSDI parts of the FDISK partition can
have more than one associated BSD partition.
Figure out your disk's overall layout scheme (how much for
MS/DOS; how much for BSD/386; how much for any other sys-
tem). Enter the parameters using the `L' key to enter the
FDISK partition size (do this first). Next, set the FDISK
partition types using the `T' key. Then, use `S' to enter
the starting sectors. Adhering to this order will mini-
mize distractions when partition starting sectors are
moved due to constraints inherent in the various operating
systems.
Adjust the lengths and starting sectors to eliminate all
warnings.
Finally, assign the BSD partition names (`a' through `h')
that you wish to use to refer to the various partitions
February 18,1993 5
DISKSETUP(8) DISKSETUP(8)
(and sub-partitions in the case of a BSD partition). A
typical scheme for BSD partition layout is: `a', `b', and
`h' for the BSDI portion of the disk; `d' for the first
other operating system (e.g., MS/DOS), `e' for the next,
and `f' for the next. Of course, it is common to have
only two operating systems present.
You should only assign to FDISK partitions those BSD par-
titions that you plan to use. You need not assign every
single BSD partition. It is very common to see some
unused partitions.
When you have set up the FDISK partition sizes and the BSD
partition assignments, use `N' to proceed to the next
screeen. You can not proceed in certain cases (e.g., no
FDISK partitions assigned). Resolve the issue and then
move on.
The second screen resembles this:
BSD Partition Sizing
FDISK
Part# Start Length BSD Type Length MB Warnings
1 0 347165 a Unused 0 0
b Unused 0 0
h Unused 0 0 BSD partitions 347165 too short
Commands: [a-h] Set BSD partition length [N]ext phase
[A-H] Set BSD partition type [P]revious page (sizing)
Command>
Directions:
Use `a' thru `h' to set the BSD partition lengths
Use `A' thru `H' to set the BSD partition types
Use `N' to move to the next phase: Installing boot blocks
Use `P' for previous page (FDISK sizing and BSD partition assignment)
It shows the FDISK partitions of type BSDI - the parti-
tions which will be subdivided into smaller BSD parti-
tions. The start and length of the FDISK partition are
shown. Only the length of the BSD partitions is shown;
the offsets are computed automatically so that the parti-
tions are packed as tightly as possible (and in the order
shown). Only the lengths and types of the BSD partitions
can be set on the screen. Return the previous screen
(`P') to adjust the FDISK starting sector or length.
Use the lower case `a' through `h' keys to set lengths;
use the upper case keys to set types. Heed the warnings
about aggregate lengths being too long or too short. You
can not proceed to the next phase if the BSD partitions
will not fit in the FDISK partition. Note that disksetup
presents a default size value if you change the size of a
BSD partition and it is possible for that partition to
fill out the FDISK partition exactly. This is handy for
the `h' partition in this example; less handy for the
rest.
February 18,1993 6
DISKSETUP(8) DISKSETUP(8)
Set the sizes and types and type `N' to move to boot block
installation.
INSTALLING BOOT BLOCKS
In the last phase disksetup asks you which kind of boot
blocks to install on your disk. Make the correct menu
choice.
Finally, if you are sharing the disk among multiple oper-
ating systems, disksetup asks which master boot record you
wish installed. You can choose the default (using the
return key) or you can enter the pathname of a different
boot program. You must tell which partitions are bootable
and what identifying string should be displayed by the
`bootany' program.
OTHER MODES
You can invoke disksetup to see an ASCII representation of
the entire FDISK and BSD setup information. Use
disksetup disk
to show the ASCII representation on standard output (which
can be redirected to a file, say, protofile). Use
disksetup -R disk protofile
to set FDISK and BSD partition information to be that of
the contents of protofile. Optional arguments can spec-
ify: the primary and secondary BSD boot block files (two
filenames are required if they are specified). A final
optional argument can specify master boot record (only if
you also specify the BSD boot files and only if the disk
is shared between multiple operating systems).
The -e option (edit mode) combines the the previous two
schemes. It creates a temporary file with the ASCII rep-
resentation then invokes an editor ($EDITOR or vi) on that
file. Any changes made to the file are made to the FDISK
and BSD labels. The -e option automatically installs boot
blocks and may ask certain questions if more data is
required.
With the -W or -N options, disksetup will enable (-W) or
disable (-N) writing of the disk label sector. This can
sometimes be helpful when the only way to proceed is to
destroy the on-disk label (e.g., with the dd command) and
reboot to start with a clean slate.
FILES
/etc/disktab
/usr/bootstraps/xxboot
/usr/bootstraps/bootxx
/usr/bootstraps/bootany.sys
SEE ALSO
disktab(5), disklabel(5), disklabel(8)
February 18,1993 7