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