2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH FDISK 1M "Sep 10, 2013"
8 fdisk \- create or modify fixed disk partition table
12 \fBfdisk\fR [\fB-o\fR \fIoffset\fR] [\fB-s\fR \fIsize\fR] [\fB-P\fR \fIfill_patt\fR] [\fB-S\fR \fIgeom_file\fR]
13 [\fB-w\fR | \fB-r\fR | \fB-d\fR | \fB-n\fR | \fB-I\fR | \fB-B\fR | \fB-t\fR | \fB-T\fR | \fB-g\fR | \fB-G\fR | \fB-R\fR | \fB-E\fR]
14 [-\fB-F\fR \fIfdisk_file\fR] [ [\fB-v\fR] \fB-W\fR {\fIfdisk_file\fR | \(mi}]
15 [\fB-h\fR] [\fB-b\fR \fImasterboot\fR]
16 [\fB-A\fR \fIid\fR : \fIact\fR : \fIbhead\fR : \fIbsect\fR : \fIbcyl\fR : \fIehead\fR : \fIesect\fR :
17 \fIecyl\fR : \fIrsect\fR : \fInumsect\fR]
18 [\fB-D\fR \fIid\fR : \fIact\fR : \fIbhead:\fR \fIbsect\fR : \fIbcyl\fR : \fIehead:\fR \fIesect\fR :
19 \fIecyl\fR : \fIrsect\fR : \fInumsect\fR] \fIrdevice\fR
25 This command is used to do the following:
30 Create and modify an \fBfdisk\fR partition table on x86 systems
36 Create and modify an \fBfdisk\fR partition table on removable media on SPARC or
43 Install the master boot record that is put in the first sector of the fixed
44 disk on x86 systems only
48 This table is used by the first-stage bootstrap (or firmware) to identify parts
49 of the disk reserved for different operating systems, and to identify the
50 partition containing the second-stage bootstrap (the \fIactive\fR Solaris
51 partition). The \fIrdevice\fR argument must be used to specify the raw device
52 associated with the fixed disk, for example, \fB/dev/rdsk/c0t0d0p0\fR.
55 The program can operate in three different modes. The first is interactive
56 mode. In interactive mode, the program displays the partition table as it
57 exists on the disk, and then presents a menu allowing the user to modify the
58 table. The menu, questions, warnings, and error messages are intended to be
62 In interactive mode, if there is no partition table on the disk, the user is
63 given the options of creating a default partitioning or specifying the initial
64 table values. The default partitioning allocates the entire disk for the
65 Solaris system and makes the Solaris system partition active. In either case,
66 when the initial table is created, \fBfdisk\fR also writes out the first-stage
67 bootstrap (x86 only) code along with the partition table. In this mode, (x86
68 only) when creating an entry for a non-EFI partition on a disk that is larger
69 than 2 TB (terabytes), \fBfdisk\fR warns that the maximum size of the partition
70 is 2 TB. Under these conditions percentages displayed by \fBfdisk\fR are based
74 The second mode of operation is used for automated entry addition, entry
75 deletion, or replacement of the entire \fBfdisk\fR table. This mode can add or
76 delete an entry described on the command line. In this mode the entire
77 \fBfdisk\fR table can be read in from a file replacing the original table.
78 \fBfdisk\fR can also be used to create this file. There is a command line
79 option that will cause \fBfdisk\fR to replace any \fBfdisk\fR table with the
80 default of the whole disk for the Solaris system.
83 The third mode of operation is used for disk diagnostics. In this mode, a
84 section of the disk can be filled with a user-specified pattern and mode
85 sections of the disk can also be read or written.
90 The third mode of operation is not currently supported for extended partitions
94 When \fBfdisk\fR creates a partition, the space is allocated in the \fBfdisk\fR
95 partition table, but the allocated disk space is not initialized.
96 \fBnewfs\fR(1M) is required to create and write file system metadata to the new
97 partition, and \fBformat\fR(1M) is required to write the VTOC or EFI/GPT
102 The menu options for interactive mode given by the \fBfdisk\fR program are:
106 \fB\fBCreate a partition\fR\fR
110 This option allows the user to create a new partition. The maximum number of
111 partitions is 4. The program will ask for the type of the partition (SOLARIS,
112 MS-DOS, UNIX, or other). It will then ask for the size of the partition as a
113 percentage of the disk. The user may also enter the letter \fBc\fR at this
114 point, in which case the program will ask for the starting cylinder number and
115 size of the partition in cylinders. If a \fBc\fR is not entered, the program
116 will determine the starting cylinder number where the partition will fit. In
117 either case, if the partition would overlap an existing partition or will not
118 fit, a message is displayed and the program returns to the original menu.
124 \fB\fBChange Active (Boot from) partition\fR\fR
128 This option allows the user to specify the partition where the first-stage
129 bootstrap will look for the second-stage bootstrap, otherwise known as the
130 \fIactive\fR partition.
136 \fB\fBDelete a partition\fR\fR
140 This option allows the user to delete a previously created partition. Note that
141 this will destroy all data in that partition.
147 \fB\fBChange between Solaris and Solaris2 Partition IDs\fR\fR
151 This option allows the user to switch between the current \fBfdisk\fR operating
152 system partition identifier and the previous one. This does not affect any data
153 in the disk partition and is provided for compatibility with older software.
159 \fB\fBEdit/View extended partitions\fR\fR
163 This option provides the extended partition menu to the user. Use the extended
164 partition menu to add and delete logical drives, change the sysid of the
165 logical drives, and display logical drive information. To commit the changes
166 made in the extended partition, you must return to the main menu using the
167 extended partition submenu option \fBr\fR. There is also an option to display
168 the list of options that the extended partition submenu supports. Given below
178 Use this submenu option to add a logical drive. There are three pieces of
179 information that are required: The beginning cylinder, the size (in cylinders
180 or in human readable form - KB, MB, or GB), and the partition ID. While
181 specifying the partition ID, there is an option (\fBI\fR) that you can use to
182 list the supported partitions.
191 Delete a logical drive.
193 Use this submenu option to delete a logical drive. The only input required is
194 the number of the logical drive that is to be deleted.
203 Display the help menu.
205 This submenu option displays the supported operations in the extended partition
215 Change the id of the logical drive.
217 Use this submenu option to change the system ID of the existing logical drives.
218 A list of supported system IDs is displayed when you use the \fBI\fR option
219 when in this submenu.
228 Display the logical drive layout.
230 Displays the logical drive information to stdout. This output reflects any
231 changes made during the current run of the \fBfdisk\fR program. The changes are
232 not committed to the disk until return to the main menu (using the submenu
233 \fBr\fR) and choose the option to commit the changes to the disk.
242 Return to the main \fBfdisk\fR menu.
244 Exit the extended partition submenu and return to the main menu.
251 Use the following options to include your modifications to the partition table
252 at this time or to cancel the session without modifying the table:
259 This option writes the new version of the table created during this session
260 with \fBfdisk\fR out to the fixed disk, and exits the program.
269 This option exits without modifying the partition table.
275 The following options apply to \fBfdisk\fR:
279 \fB\fB-A\fR \fIid:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect\fR\fR
283 Add a partition as described by the argument (see the \fB-F\fR option below for
284 the format). Use of this option will zero out the \fBVTOC\fR on the Solaris
285 partition if the \fBfdisk\fR table changes.
291 \fB\fB-b\fR \fImaster_boot\fR\fR
295 Specify the file \fImaster_boot\fR as the master boot program. The default
296 master boot program is \fB/usr/lib/fs/ufs/mboot\fR.
306 Default to one Solaris partition that uses the whole disk. On an x86 machine,
307 if the disk is larger than 2 TB (terabytes), the default size of the Solaris
308 partition will be limited to 2 TB.
318 Turn on verbose \fIdebug\fR mode. This will cause \fBfdisk\fR to print its
319 state on stderr as it is used. The output from this option should not be used
326 \fB\fB-D\fR \fIid:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect\fR\fR
330 Delete a partition as described by the argument (see the \fB-F\fR option below
331 for the format). Note that the argument must be an exact match or the entry
332 will not be deleted! Use of this option will zero out the \fBVTOC\fR on the
333 Solaris partition if the \fBfdisk\fR table changes.
343 Create an \fBEFI\fR partition that uses the entire disk.
349 \fB\fB-F\fR \fIfdisk_file\fR\fR
353 Use fdisk file \fIfdisk_file\fR to initialize table. Use of this option will
354 zero out the \fBVTOC\fR on the Solaris partition if the \fBfdisk\fR table
357 The \fIfdisk_file\fR contains four specification lines for the primary
358 partitions followed by specification lines for the logical drives. You must
359 have four lines for the primary partitions if there is at least one logical
360 drive. In this case, if the number of primary partitions to be configured is
361 less than four, the remaining lines should be filled with zeros.
363 Each line is composed of entries that are position-dependent, are separated by
364 whitespace or colons, and have the following format:
366 \fIid act bhead bsect bcyl ehead esect ecyl rsect numsect\fR
368 \&...where the entries have the following values:
375 This is the type of partition and the correct numeric values may be found in
385 This is the active partition flag; \fB0\fR means not active and \fB128\fR means
386 active. For logical drives, this flag will always be set to 0 even if specified
396 This is the head where the partition starts. If this is set to \fB0\fR,
397 \fBfdisk\fR will correctly fill this in from other information.
406 This is the sector where the partition starts. If this is set to \fB0\fR,
407 \fBfdisk\fR will correctly fill this in from other information.
416 This is the cylinder where the partition starts. If this is set to \fB0\fR,
417 \fBfdisk\fR will correctly fill this in from other information.
426 This is the head where the partition ends. If this is set to \fB0\fR,
427 \fBfdisk\fR will correctly fill this in from other information.
436 This is the sector where the partition ends. If this is set to \fB0\fR,
437 \fBfdisk\fR will correctly fill this in from other information.
446 This is the cylinder where the partition ends. If this is set to \fB0\fR,
447 \fBfdisk\fR will correctly fill this in from other information.
456 The relative sector from the beginning of the disk where the partition starts.
457 This must be specified and can be used by \fBfdisk\fR to fill in other fields.
458 For logical drives, you must make sure that there are at least 63 free sectors
459 before the \fIrsect\fR specified for a logical drive.
468 The size in sectors of this disk partition. This must be specified and can be
469 used by \fBfdisk\fR to fill in other fields.
481 Get the label geometry for disk and display on stdout (see the \fB-S\fR option
492 Get the physical geometry for disk and display on stdout (see the \fB-S\fR
493 option for the format).
503 Issue verbose message; message will list all options and supply an explanation
514 Forgo device checks. This is used to generate a file image of what would go on
515 a disk without using the device. Note that you must use \fB-S\fR with this
526 Don't update \fBfdisk\fR table unless explicitly specified by another option.
527 If no other options are used, \fB-n\fR will only write the master boot record
528 to the disk. In addition, note that \fBfdisk\fR will not come up in interactive
529 mode if the \fB-n\fR option is specified.
535 \fB\fB-o\fR \fIoffset\fR\fR
539 Block offset from start of disk. This option is used for \fB-P\fR, \fB-r\fR,
540 and \fB-w\fR. Zero is assumed when this option is not used.
546 \fB\fB-P\fR \fIfill_patt\fR\fR
550 Fill disk with pattern \fIfill_patt\fR. \fIfill_patt\fR can be decimal or hex
551 and is used as number for constant long word pattern. If \fIfill_patt\fR is
552 \fB#\fR, then pattern is block # for each block. Pattern is put in each block
553 as long words and fills each block (see \fB-o\fR and \fB-s\fR).
563 Read from disk and write to stdout. See \fB-o\fR and \fB-s\fR, which specify
564 the starting point and size of the operation.
574 Treat disk as read-only. This is for testing purposes.
580 \fB\fB-s\fR \fIsize\fR\fR
584 Number of blocks to perform operation on (see \fB-o\fR).
590 \fB\fB-S\fR \fIgeom_file\fR\fR
594 Set the label geometry to the content of the \fIgeom_file\fR. The
595 \fIgeom_file\fR contains one specification line. Each line is delimited by a
596 new-line character (\fB\en\fR). If the first character of a line is an asterisk
597 (*), the line is treated as a comment. Each line is composed of entries that
598 are position-dependent, are separated by white space, and have the following
603 \fIpcyl ncyl acyl bcyl nheads nsectors sectsiz\fR
608 where the entries have the following values:
615 This is the number of physical cylinders for the drive.
624 This is the number of usable cylinders for the drive.
633 This is the number of alt cylinders for the drive.
642 This is the number of offset cylinders for the drive (should be zero).
651 The number of heads for this drive.
660 The number of sectors per track.
669 The size in bytes of a sector.
681 Adjust incorrect slice table entries so that they will not cross partition
692 Remove incorrect slice table entries that span partition table boundaries.
702 Output the HBA (virtual) geometry dimensions. This option must be used in
703 conjunction with the \fB-W\fR flag. This option will work for platforms which
704 support virtual geometry. (x86 only)
714 Write to disk and read from stdin. See \fB-o\fR and \fB-s\fR, which specify the
715 starting point and size of the operation.
721 \fB\fB-W\fR \fB\(mi\fR\fR
725 Output the disk table to \fBstdout\fR.
731 \fB\fB-W\fR \fIfdisk_file\fR\fR
735 Create an \fBfdisk\fR file \fIfdisk_file\fR from disk table. This can be used
736 with the \fB-F\fR option below.
743 \fB\fB/dev/rdsk/c0t0d0p0\fR\fR
746 Raw device associated with the fixed disk.
752 \fB\fB/usr/lib/fs/ufs/mboot\fR\fR
755 Default master boot program.
761 See \fBattributes\fR(5) for descriptions of the following attributes:
769 ATTRIBUTE TYPE ATTRIBUTE VALUE
771 Architecture x86 and SPARC
777 \fBuname\fR(1), \fBfmthard\fR(1M), \fBformat\fR(1M), \fBnewfs\fR(1M),
778 \fBprtvtoc\fR(1M), \fBattributes\fR(5)
782 Most messages will be self-explanatory. The following may appear immediately
783 after starting the program:
787 \fB\fBFdisk\fR: \fBcannot open\fR <\fBdevice\fR>\fR
791 This indicates that the device name argument is not valid.
797 \fB\fBFdisk\fR: \fBunable to get device parameters for device\fR
802 This indicates a problem with the configuration of the fixed disk, or an error
803 in the fixed disk driver.
809 \fB\fBFdisk\fR: \fBerror reading partition table\fR\fR
813 This indicates that some error occurred when trying initially to read the fixed
814 disk. This could be a problem with the fixed disk controller or driver, or with
815 the configuration of the fixed disk.
821 \fB\fBFdisk\fR: \fBerror writing boot record\fR\fR
825 This indicates that some error occurred when trying to write the new partition
826 table out to the fixed disk. This could be a problem with the fixed disk
827 controller, the disk itself, the driver, or the configuration of the fixed