Apple Mac OS X Server Network Card User Manual


 
90 Chapter 7 Working with Disks and Volumes
After a partition has been created on a device, the partition needs to be formatted
before the computer will be able to store data on the device. Formatting a disk
partition creates the volume and sets the file system.
Labeling a Disk
Once a disk is formatted, it needs to 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 be writable by anne:
$ disklabel -create /dev/rdisk1s1 -msize=1M owner-uid=anne dev-devname=anne
name=anne owner-mode=0644
The following example prints out the key-value pairs from the previous example:
$ disklabel -properties /dev/rdisk1s1
See the disklabel man page for more information about creating disk labels.
Formatting a Disk
You can use newfs, located in /sbin, to create a new volume. 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. Extreme care should be taken to
ensure a successful format when modifying the settings beyond the default. Before
running newfs, the disk must be labeled using the disklabel tool.
To fomat a disk:
$ newfs
See the newfs man page for options in detail.
To format a disk to HFS+, you would need to use the newfs_hfs tool located in /sbin:
$ newfs_hfs
See the newfs_hfs man page for more information.
Checking for Disk Problems
You can use the diskutil or fsck tool (fsck_hfs for HFS volumes) to check the physical
condition and file system integrity of a volume. See the related man pages for more
information.