|
NAMEbsdlabel —
read and write BSD label
SYNOPSIS
DESCRIPTIONThebsdlabel utility installs, examines or modifies the
BSD label on a disk partition, or on a file containing
a partition image. In addition, bsdlabel can install
bootstrap code.
Disk Device NameWhen specifying the device (i.e., when the-f option is
not used), the /dev/ path prefix may be omitted; the
bsdlabel utility will automatically prepend it.
General OptionsThe-A option enables processing of the historical parts
of the BSD label. If the option is not given, suitable
values are set for these fields.
The The The Reading the Disk LabelTo examine the label on a disk drive, use the form
disk represents the disk in question, and may be in the form da0 or /dev/da0. It will display the partition layout. Writing a Standard LabelTo write a standard label, use the form
If the drive type is specified, the entry of that name in the disktab(5) file is used; otherwise, or if the type is specified as 'auto', a default layout is used. Editing an Existing Disk LabelTo edit an existing disk label, use the form
This command opens the disk label in the default editor, and when the editor exits, the label is validated and if OK written to disk. Restoring a Disk Label From a FileTo restore a disk label from a file, use the form
The Installing BootstrapsIf the-B option is specified, bootstrap code will be
read from the file /boot/boot and written to the disk.
The -b boot option allows a
different file to be used.
FILES
SAVED FILE FORMATThebsdlabel utility uses an ASCII version of the label
when examining, editing, or restoring a disk label. The format is:
8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 81920 16 4.2BSD 2048 16384 5128 b: 1091994 81936 swap c: 1173930 0 unused 0 0 # "raw" part, don't edit If the # /dev/da1c: type: SCSI disk: da0s1 label: flags: bytes/sector: 512 sectors/track: 51 tracks/cylinder: 19 sectors/cylinder: 969 cylinders: 1211 sectors/unit: 1173930 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 bps/cpg] a: 81920 16 4.2BSD 1024 8192 16 b: 160000 81936 swap c: 1173930 0 unused 0 0 # "raw" part, don't edit Lines starting with a ‘ The partition table can have up to 8 entries. It contains the following information:
EXAMPLESDisplay the label for the first slice of the da0 disk, as obtained via /dev/da0s1:bsdlabel da0s1 Save the in-core label for da0s1 into the
file savedlabel. This file can be used with the
bsdlabel da0s1 >
savedlabel Create a label for da0s1: bsdlabel -w /dev/da0s1 Read the label for da0s1, edit it, and install the result: bsdlabel -e da0s1 Read the on-disk label for da0s1, edit it, and display what the new label would be (in sectors). It does not install the new label either in-core or on-disk: bsdlabel -e -n da0s1 Write a default label on da0s1. Use
another bsdlabel -w da0s1 Restore the on-disk and in-core label for da0s1 from information in savedlabel: bsdlabel -R da0s1
savedlabel Display what the label would be for da0s1
using the partition layout in label_layout. This is
useful for determining how much space would be allotted for various
partitions with a labeling scheme using bsdlabel -R -n da0s1
label_layout Install a new bootstrap on da0s1. The boot code comes from /boot/boot: bsdlabel -B da0s1 Install a new label and bootstrap. The bootstrap code comes from the file newboot in the current working directory: bsdlabel -w -B -b newboot
/dev/da0s1 Completely wipe any prior information on the disk, creating a new bootable disk with a DOS partition table containing one slice, covering the whole disk. Initialize the label on this slice, then edit it. The dd(1) commands are optional, but may be necessary for some BIOSes to properly recognize the disk: dd if=/dev/zero of=/dev/da0 bs=512 count=32 gpart create -s MBR da0 gpart add -t freebsd da0 gpart set -a active -i 1 da0 gpart bootcode -b /boot/mbr da0 dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 bsdlabel -w -B da0s1 bsdlabel -e da0s1 This is an example disk label that uses some of the new partition
size types such as # /dev/ada0s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) b: 1G * swap c: * * unused e: 204800 * 4.2BSD f: 5g * 4.2BSD g: * * 4.2BSD DIAGNOSTICSThe kernel device drivers will not allow the size of a disk partition to be decreased or the offset of a partition to be changed while it is open.COMPATIBILITYDue to the use of an uint32_t to store the number of sectors, BSD labels are restricted to a maximum of 2^32-1 sectors. This usually means 2TB of disk space. Larger disks should be partitioned using another method such as gpart(8).The various BSDs all use slightly different versions of BSD labels and are not generally compatible. SEE ALSOccd(4), geom(4), md(4), disktab(5), boot0cfg(8), gpart(8), newfs(8)HISTORYThedisklabel utility appeared in
4.3BSD-Tahoe.
Visit the GSP FreeBSD Man Page Interface. |