xref: /illumos-gate/usr/src/man/man8/fmthard.8 (revision c55633c3b85a97a093b3f79f341aee08eb6bd15b)
1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or http://www.opensolaris.org/os/licensing.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\" Copyright 1989 AT&T
22.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
23.\" Copyright 2022 Toomas Soome <tsoome@me.com>
24.\"
25.Dd March 30, 2022
26.Dt FMTHARD 8
27.Os
28.Sh NAME
29.Nm fmthard
30.Nd populate label on hard disks
31.Sh SYNOPSIS
32.Nm
33.Fl d Ar data | Fl n Ar volume_name | Fl s Ar datafile Op Fl i
34.Sm off
35.Ar /dev/rdsk/c? Oo t? Oc d?s2
36.Sm on
37.Sh DESCRIPTION
38The
39.Nm
40command updates the
41.Sy VTOC
42.Pq Volume Table of Contents
43on hard disks.
44One or more of the options
45.Fl s Ar datafile ,
46.Fl d Ar data ,
47or
48.Fl n Ar volume_name
49must be used to request modifications to the disk label.
50To print disk label contents, see
51.Xr prtvtoc 8 .
52The
53.Sm off
54.Ar /dev/rdsk/c? Oo t? Oc d?s2
55.Sm on
56file must be the character special file of the device where the new label
57is to be installed.
58On x86 systems,
59.Xr fdisk 8
60must be run on the drive before
61.Nm .
62.Pp
63If you are using an x86 system, note that the term
64.Sq  partition
65in this page refers to
66.Em slices
67within the x86
68.Sy fdisk
69partition on x86 machines.
70Do not confuse the partitions created by
71.Nm
72with the partitions created by
73.Xr fdisk 8 .
74.Sh OPTIONS
75The following options are supported:
76.Bl -tag -width Ds
77.It Fl d Ar data
78The
79.Ar data
80argument of this option is a string representing the information
81for a particular partition in the current
82.Sy VTOC .
83The string must be of the format
84.Em part:tag:flag:start:size
85where
86.Em part
87is the partition number,
88.Em tag
89is the
90.Sy ID
91TAG of the partition,
92.Em flag
93is the set of permission flags,
94.Em start
95is the starting sector number of the partition, and
96.Em size
97is the number of sectors in the partition.
98See the description of the
99.Ar datafile
100below for more information on these fields.
101.It Fl i
102This option allows the command to create the desired
103.Sy VTOC
104table, but prints the information to standard output instead of modifying the
105.Sy VTOC
106on the disk.
107.It Fl n Ar volume_name
108This option is used to give the disk a
109.Ar volume_name
110up to 8 characters long.
111.It Fl s Ar datafile
112This option is used to populate the
113.Sy VTOC
114according to a
115.Ar datafile
116created by the user.
117If the
118.Ar datafile
119is
120.Sy \(mi Pq a hyphen ,
121.Nm
122reads from standard input.
123The
124.Ar datafile
125format is described below.
126This option causes all of the disk partition timestamp fields to be set
127to zero.
128.sp
129Every
130.Sy VTOC
131generated by
132.Nm
133will also have partition 2, by convention, that corresponds to the whole disk.
134If the input in
135.Ar datafile
136does not specify an entry for partition 2, a default partition 2 entry will be
137created automatically in
138.Sy VTOC
139with the tag
140.Sy V_BACKUP
141and size equal to the full size of the disk.
142.sp
143The
144.Ar datafile
145contains one specification line for each partition, starting with partition 0.
146Each line is delimited by a new-line character
147.Pq Sy \en .
148If the first character of a line is an asterisk
149.Pq \&* ,
150the line is treated as a comment.
151Each line is composed of entries that are position-dependent,
152separated by white space and having the following format:
153.sp
154.Em partition tag flag starting_sector size_in_sectors
155.sp
156where the entries have the following values:
157.Bl -tag -width Ds
158.It Em partition
159The partition number.
160Currently, for Solaris SPARC, a disk can have up to 8 partitions,
161.Sy 0\(mi7 .
162Even though the
163.Em partition
164field has 4 bits, only 3 bits are currently used.
165For x86, all 4 bits are used to allow slices
166.Sy 0\(mi15 .
167Each Solaris
168.Sy fdisk
169partition can have up to 16 slices.
170.It Em tag
171The partition tag: a decimal number.
172The following are reserved codes:
173.Sy 0 Pq Sy V_UNASSIGNED ,
174.Sy 1 Pq Sy V_BOOT ,
175.Sy 2 Pq Sy V_ROOT ,
176.Sy 3 Pq Sy V_SWAP ,
177.Sy 4 Pq Sy V_USR ,
178.Sy 5 Pq Sy V_BACKUP ,
179.Sy 6 Pq Sy V_STAND ,
180.Sy 7 Pq Sy V_VAR ,
181and
182.Sy 8 Pq Sy V_HOME .
183.It Em flag
184The flag allows a partition to be flagged as unmountable or read only, the
185masks being:
186.Sy V_UNMNT 0x01 ,
187and
188.Sy V_RONLY 0x10 .
189For mountable partitions use
190.Sy 0x00 .
191.It Em starting_sector
192The sector number (decimal) on which the partition starts.
193.It Em size_in_sectors
194The number (decimal) of sectors occupied by the partition.
195.El
196.sp
197You can save the output of a
198.Xr prtvtoc 8
199command to a file, edit the file, and use it as the
200.Ar datafile
201argument to the
202.Fl s
203option.
204.El
205.Sh SEE ALSO
206.Xr uname 1 ,
207.Xr attributes 7 ,
208.Xr format 8 ,
209.Xr installboot 8 ,
210.Xr prtvtoc 8
211.Ss "x86 Only"
212.Xr fdisk 8
213.Sh NOTES
214Special care should be exercised when overwriting an existing
215.Sy VTOC ,
216as incorrect entries could result in current data being inaccessible.
217As a precaution, save the old
218.Sy VTOC .
219.sp
220For disks under two terabytes,
221.Nm
222cannot write a
223.Sy VTOC
224on an unlabeled disk.
225Use
226.Xr format 8
227for this purpose.
228