Specifications
92 Chapter 7 Working with Disks and Volumes
When you start editing a device, the pdisk options change. Enter ? at the pdisk prompt
to see the editing commands. The following are some of the more important ones:
pdisk does not support the Intel/DOS partitioning scheme supported by fdisk. For
more information about DOS partitions, see the fdisk man page.
After a partition is created on a device, the partition must be formatted before the
computer can store data on the device. Formatting a disk partition creates the volume
and sets the file system.
Labeling a Disk
After a disk is formatted, it must be labeled. The disklabel tool manipulates Apple
Label partition metadata. Apple Label partitions allow for a disk device to have a
consistent name, ownership, and permissions across reboots, even though it uses a
dynamic pseudo file system for /dev.
The Apple Label partition uses a set of metadata (as a plist) in a reserved area of the
partition. This metadata describes the owner, name, and so forth.
To create a disk label for a device with 1 MB of metadata area, owned by Anne, with
a device name of Fred, and writable by Anne:
$ disklabel -create /dev/rdisk1s1 -msize=1M owner-uid=anne dev-devname=anne
name=anne owner-mode=0644
The following example prints the key-value pairs from the previous example:
$ disklabel -properties /dev/rdisk1s1
For more information about creating disk labels, see the disklabel man page.
Formatting a Disk
To create a volume, use newfs, located in /sbin. newfs builds a file system on the
specified special device, basing its defaults on the information in the disk label.
There are many parameters you can set when formatting disks, such as block and
clump size, b-tree attribute, and catalog node sizes.
Important: Take extreme care to ensure a successful format when modifying the
settings beyond the default.
Command Description
p Prints the partition map for the current device.
i Initializes the partition map for the current device.
C Creates a partition. There are two partition types: Apple_HFS and Apple_UFS.
w Writes the modifications to the partition map on-disk. Before that, edits and
modifications are only in memory and are not yet implemented.