1fdisk(1M) System Administration Commands fdisk(1M)
2
3
4
6 fdisk - create or modify fixed disk partition table
7
9 fdisk [-o offset] [-s size] [-P fill_patt] [-S geom_file]
10 [-w | -r | -d | -n | -I | -B | -t | -T | -g | -G | -R | -E]
11 [--F fdisk_file] [ [-v] -W {fdisk_file | −}]
12 [-h] [-b masterboot]
13 [-A id : act : bhead : bsect : bcyl : ehead : esect :
14 ecyl : rsect : numsect]
15 [-D id : act : bhead: bsect : bcyl : ehead: esect :
16 ecyl : rsect : numsect] rdevice
17
18
20 This command is used to do the following:
21
22 o Create and modify an fdisk partition table on x86 systems
23
24 o Create and modify an fdisk partition table on removable
25 media on SPARC or x86 systems
26
27 o Install the master boot record that is put in the first sec‐
28 tor of the fixed disk on x86 systems only
29
30
31 This table is used by the first-stage bootstrap (or firmware) to iden‐
32 tify parts of the disk reserved for different operating systems, and to
33 identify the partition containing the second-stage bootstrap (the
34 active Solaris partition). The rdevice argument must be used to specify
35 the raw device associated with the fixed disk, for example,
36 /dev/rdsk/c0t0d0p0.
37
38
39 The program can operate in three different modes. The first is interac‐
40 tive mode. In interactive mode, the program displays the partition ta‐
41 ble as it exists on the disk, and then presents a menu allowing the
42 user to modify the table. The menu, questions, warnings, and error mes‐
43 sages are intended to be self-explanatory.
44
45
46 In interactive mode, if there is no partition table on the disk, the
47 user is given the options of creating a default partitioning or speci‐
48 fying the initial table values. The default partitioning allocates the
49 entire disk for the Solaris system and makes the Solaris system parti‐
50 tion active. In either case, when the initial table is created, fdisk
51 also writes out the first-stage bootstrap (x86 only) code along with
52 the partition table. In this mode, (x86 only) when creating an entry
53 for a non-EFI partition on a disk that is larger than 2 TB (terabytes),
54 fdisk warns that the maximum size of the partition is 2 TB. Under these
55 conditions percentages displayed by fdisk are based on 2 TB.
56
57
58 The second mode of operation is used for automated entry addition,
59 entry deletion, or replacement of the entire fdisk table. This mode can
60 add or delete an entry described on the command line. In this mode the
61 entire fdisk table can be read in from a file replacing the original
62 table. fdisk can also be used to create this file. There is a command
63 line option that will cause fdisk to replace any fdisk table with the
64 default of the whole disk for the Solaris system.
65
66
67 The third mode of operation is used for disk diagnostics. In this mode,
68 a section of the disk can be filled with a user-specified pattern and
69 mode sections of the disk can also be read or written.
70
71 Note -
72
73 The third mode of operation is not currently supported for extended
74 partitions
75
76
77 When fdisk creates a partition, the space is allocated in the fdisk
78 partition table, but the allocated disk space is not initialized.
79 newfs(1M) is required to create and write file system metadata to the
80 new partition, and format(1M) is required to write the VTOC or EFI/GPT
81 metadata.
82
83 Menu Options
84 The menu options for interactive mode given by the fdisk program are:
85
86 Create a partition
87
88 This option allows the user to create a new partition. The maximum
89 number of partitions is 4. The program will ask for the type of the
90 partition (SOLARIS, MS-DOS, UNIX, or other). It will then ask for
91 the size of the partition as a percentage of the disk. The user may
92 also enter the letter c at this point, in which case the program
93 will ask for the starting cylinder number and size of the partition
94 in cylinders. If a c is not entered, the program will determine the
95 starting cylinder number where the partition will fit. In either
96 case, if the partition would overlap an existing partition or will
97 not fit, a message is displayed and the program returns to the
98 original menu.
99
100
101 Change Active (Boot from) partition
102
103 This option allows the user to specify the partition where the
104 first-stage bootstrap will look for the second-stage bootstrap,
105 otherwise known as the active partition.
106
107
108 Delete a partition
109
110 This option allows the user to delete a previously created parti‐
111 tion. Note that this will destroy all data in that partition.
112
113
114 Change between Solaris and Solaris2 Partition IDs
115
116 This option allows the user to switch between the current fdisk
117 operating system partition identifier and the previous one. This
118 does not affect any data in the disk partition and is provided for
119 compatibility with older software.
120
121
122 Edit/View extended partitions
123
124 This option provides the extended partition menu to the user. Use
125 the extended partition menu to add and delete logical drives,
126 change the sysid of the logical drives, and display logical drive
127 information. To commit the changes made in the extended partition,
128 you must return to the main menu using the extended partition sub‐
129 menu option r. There is also an option to display the list of
130 options that the extended partition submenu supports. Given below
131 is the list:
132
133 a Add a logical drive.
134
135 Use this submenu option to add a logical drive. There are
136 three pieces of information that are required: The beginning
137 cylinder, the size (in cylinders or in human readable form -
138 KB, MB, or GB), and the partition ID. While specifying the
139 partition ID, there is an option (I) that you can use to list
140 the supported partitions.
141
142
143 d Delete a logical drive.
144
145 Use this submenu option to delete a logical drive. The only
146 input required is the number of the logical drive that is to
147 be deleted.
148
149
150 h Display the help menu.
151
152 This submenu option displays the supported operations in the
153 extended partition submenu.
154
155
156 i Change the id of the logical drive.
157
158 Use this submenu option to change the system ID of the exist‐
159 ing logical drives. A list of supported system IDs is dis‐
160 played when you use the I option when in this submenu.
161
162
163 p Display the logical drive layout.
164
165 Displays the logical drive information to stdout. This output
166 reflects any changes made during the current run of the fdisk
167 program. The changes are not committed to the disk until
168 return to the main menu (using the submenu r) and choose the
169 option to commit the changes to the disk.
170
171
172 r Return to the main fdisk menu.
173
174 Exit the extended partition submenu and return to the main
175 menu.
176
177
178
179
180 Use the following options to include your modifications to the parti‐
181 tion table at this time or to cancel the session without modifying the
182 table:
183
184 Exit This option writes the new version of the table created dur‐
185 ing this session with fdisk out to the fixed disk, and exits
186 the program.
187
188
189 Cancel This option exits without modifying the partition table.
190
191
193 The following options apply to fdisk:
194
195 -A id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect
196
197 Add a partition as described by the argument (see the -F option
198 below for the format). Use of this option will zero out the VTOC on
199 the Solaris partition if the fdisk table changes.
200
201
202 -b master_boot
203
204 Specify the file master_boot as the master boot program. The
205 default master boot program is /usr/lib/fs/ufs/mboot.
206
207
208 -B
209
210 Default to one Solaris partition that uses the whole disk. On an
211 x86 machine, if the disk is larger than 2 TB (terabytes), the
212 default size of the Solaris partition will be limited to 2 TB.
213
214
215 -d
216
217 Turn on verbose debug mode. This will cause fdisk to print its
218 state on stderr as it is used. The output from this option should
219 not be used with -F.
220
221
222 -D id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect
223
224 Delete a partition as described by the argument (see the -F option
225 below for the format). Note that the argument must be an exact
226 match or the entry will not be deleted! Use of this option will
227 zero out the VTOC on the Solaris partition if the fdisk table
228 changes.
229
230
231 -E
232
233 Create an EFI partition that uses the entire disk.
234
235
236 -F fdisk_file
237
238 Use fdisk file fdisk_file to initialize table. Use of this option
239 will zero out the VTOC on the Solaris partition if the fdisk table
240 changes.
241
242 The fdisk_file contains four specification lines for the primary
243 partitions followed by specification lines for the logical drives.
244 You must have four lines for the primary partitions if there is at
245 least one logical drive. In this case, if the number of primary
246 partitions to be configured is less than four, the remaining lines
247 should be filled with zeros.
248
249 Each line is composed of entries that are position-dependent, are
250 separated by whitespace or colons, and have the following format:
251
252 id act bhead bsect bcyl ehead esect ecyl rsect numsect
253
254 ...where the entries have the following values:
255
256 id This is the type of partition and the correct numeric
257 values may be found in fdisk.h.
258
259
260 act This is the active partition flag; 0 means not active
261 and 128 means active. For logical drives, this flag will
262 always be set to 0 even if specified as 128 by the user.
263
264
265 bhead This is the head where the partition starts. If this is
266 set to 0, fdisk will correctly fill this in from other
267 information.
268
269
270 bsect This is the sector where the partition starts. If this
271 is set to 0, fdisk will correctly fill this in from
272 other information.
273
274
275 bcyl This is the cylinder where the partition starts. If this
276 is set to 0, fdisk will correctly fill this in from
277 other information.
278
279
280 ehead This is the head where the partition ends. If this is
281 set to 0, fdisk will correctly fill this in from other
282 information.
283
284
285 esect This is the sector where the partition ends. If this is
286 set to 0, fdisk will correctly fill this in from other
287 information.
288
289
290 ecyl This is the cylinder where the partition ends. If this
291 is set to 0, fdisk will correctly fill this in from
292 other information.
293
294
295 rsect The relative sector from the beginning of the disk where
296 the partition starts. This must be specified and can be
297 used by fdisk to fill in other fields. For logical
298 drives, you must make sure that there are at least 63
299 free sectors before the rsect specified for a logical
300 drive.
301
302
303 numsect The size in sectors of this disk partition. This must be
304 specified and can be used by fdisk to fill in other
305 fields.
306
307
308
309 -g
310
311 Get the label geometry for disk and display on stdout (see the -S
312 option for the format).
313
314
315 -G
316
317 Get the physical geometry for disk and display on stdout (see the
318 -S option for the format).
319
320
321 -h
322
323 Issue verbose message; message will list all options and supply an
324 explanation for each.
325
326
327 -I
328
329 Forgo device checks. This is used to generate a file image of what
330 would go on a disk without using the device. Note that you must use
331 -S with this option (see above).
332
333
334 -n
335
336 Don't update fdisk table unless explicitly specified by another
337 option. If no other options are used, -n will only write the master
338 boot record to the disk. In addition, note that fdisk will not come
339 up in interactive mode if the -n option is specified.
340
341
342 -o offset
343
344 Block offset from start of disk. This option is used for -P, -r,
345 and -w. Zero is assumed when this option is not used.
346
347
348 -P fill_patt
349
350 Fill disk with pattern fill_patt. fill_patt can be decimal or hex
351 and is used as number for constant long word pattern. If fill_patt
352 is #, then pattern is block # for each block. Pattern is put in
353 each block as long words and fills each block (see -o and -s).
354
355
356 -r
357
358 Read from disk and write to stdout. See -o and -s, which specify
359 the starting point and size of the operation.
360
361
362 -R
363
364 Treat disk as read-only. This is for testing purposes.
365
366
367 -s size
368
369 Number of blocks to perform operation on (see -o).
370
371
372 -S geom_file
373
374 Set the label geometry to the content of the geom_file. The
375 geom_file contains one specification line. Each line is delimited
376 by a new-line character (0fR). If the first character of a line is
377 an asterisk (*), the line is treated as a comment. Each line is
378 composed of entries that are position-dependent, are separated by
379 white space, and have the following format:
380
381 pcyl ncyl acyl bcyl nheads nsectors sectsiz
382
383
384 where the entries have the following values:
385
386 pcyl This is the number of physical cylinders for the drive.
387
388
389 ncyl This is the number of usable cylinders for the drive.
390
391
392 acyl This is the number of alt cylinders for the drive.
393
394
395 bcyl This is the number of offset cylinders for the drive
396 (should be zero).
397
398
399 nheads The number of heads for this drive.
400
401
402 nsectors The number of sectors per track.
403
404
405 sectsiz The size in bytes of a sector.
406
407
408
409 -t
410
411 Adjust incorrect slice table entries so that they will not cross
412 partition table boundaries.
413
414
415 -T
416
417 Remove incorrect slice table entries that span partition table
418 boundaries.
419
420
421 -v
422
423 Output the HBA (virtual) geometry dimensions. This option must be
424 used in conjunction with the -W flag. This option will work for
425 platforms which support virtual geometry. (x86 only)
426
427
428 -w
429
430 Write to disk and read from stdin. See -o and -s, which specify the
431 starting point and size of the operation.
432
433
434 -W −
435
436 Output the disk table to stdout.
437
438
439 -W fdisk_file
440
441 Create an fdisk file fdisk_file from disk table. This can be used
442 with the -F option below.
443
444
446 /dev/rdsk/c0t0d0p0 Raw device associated with the fixed disk.
447
448
449 /usr/lib/fs/ufs/mboot Default master boot program.
450
451
453 See attributes(5) for descriptions of the following attributes:
454
455
456
457
458 ┌─────────────────────────────┬─────────────────────────────┐
459 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
460 ├─────────────────────────────┼─────────────────────────────┤
461 │Architecture │x86 and SPARC │
462 ├─────────────────────────────┼─────────────────────────────┤
463 │Availability │SUNWcsu │
464 └─────────────────────────────┴─────────────────────────────┘
465
467 uname(1), fmthard(1M), format(1M), newfs(1M), prtvtoc(1M),
468 attributes(5)
469
471 Most messages will be self-explanatory. The following may appear imme‐
472 diately after starting the program:
473
474 Fdisk: cannot open <device>
475
476 This indicates that the device name argument is not valid.
477
478
479 Fdisk: unable to get device parameters for device <device>
480
481 This indicates a problem with the configuration of the fixed disk,
482 or an error in the fixed disk driver.
483
484
485 Fdisk: error reading partition table
486
487 This indicates that some error occurred when trying initially to
488 read the fixed disk. This could be a problem with the fixed disk
489 controller or driver, or with the configuration of the fixed disk.
490
491
492 Fdisk: error writing boot record
493
494 This indicates that some error occurred when trying to write the
495 new partition table out to the fixed disk. This could be a problem
496 with the fixed disk controller, the disk itself, the driver, or the
497 configuration of the fixed disk.
498
499
500
501
502SunOS 5.11 2 Jul 2009 fdisk(1M)