next up previous contents
Next: Checking for Overlapping Partitions Up: Managing Storage Previous: Setting User and Group   Contents


Partitioning Disks

Disk partitions are defined and created either at system installation or when adding disks. It may happen that it is necessary to alter the partitions to accommodate changes and to improve system performance.

Disk geometry is described in the disk label that is managed by the disklabel command. Only root can use disklabel. Disk label is dynamically stored in memory, thus the -r option is required to access the physical label on disk.
N.B. Partition changes may destroy data on disk by overwriting previous partition areas.

The following rules apply to changing partitions:

Before changing the size of a disk partition, review and store the current partition setup:

# disklabel -r device > partition.device #store existing partition setup

Bottom, top, and size of the partitions are in 512-byte sectors. Device is specified as /dev special raw device file composed by name, drive number, and partition either a or c.
Example of disklabel viewing command:


# disklabel -r /dev/rrz3a
type: SCSI
disk: rz26
label:
flags:
bytes/sector: 512
sectors/track: 57
tracks/cylinder: 14
sectors/cylinder: 798
cylinders: 2570
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0

8 partitions:
#       size offset   fstype [fsize bsize cpg]
 a:  131072       0   4.2BSD   1024  8192  16  # (Cyl.    0 - 164*)
 b:  262144  131072   unused   1024  8192      # (Cyl.  164*- 492*)
 c: 2050860       0   unused   1024  8192      # (Cyl.    0 - 2569)
 d:  552548  393216   unused   1024  8192      # (Cyl.  492*- 1185*)
 e:  552548  945764   unused   1024  8192      # (Cyl. 1185*- 1877*)
 f:  552548 1498312   unused   1024  8192      # (Cyl. 1877*- 2569*)
 g:  819200  393216   unused   1024  8192      # (Cyl.  492*- 1519*)
 h:  838444 1212416   4.2BSD   1024  8192 16   # (Cyl. 1519*- 2569*)
Total size in the above example is:

cyl(2570) * sectors/cyl (798) * bytes/sector * (512)

Partitions must be changed with care to avoid overwriting and corruption. To restore a corrupted label, write default partitions using the -w option, as follows:

# disklabel -r -w /dev/rrz1a rz26

disklabel operates dynamically without need of kernel rebuild and system reboot. The steps for partition changes are summarized below:


next up previous contents
Next: Checking for Overlapping Partitions Up: Managing Storage Previous: Setting User and Group   Contents
luvisetto
2001-10-02