fdisk(1M) manual page
Table of Contents
fdisk - create or modify fixed disk partition table
fdisk
[ -o offset ] [ -s size ] [ -P fill_patt ] [ -S geom_file ] [ -w|r|d|n|I|B|t|T|g|G|R
] [ -F fdisk_file ] [ -W creat_fdisk_file ] [ -h ] [ -b masterboot]
[ -A id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect ]
[ -D id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect ] rdevice
x86
PowerPC Edition
SUNWcsu
This command is used
to create and modify the partition table, and to install the master boot
(x86 only) record that is put in the first sector of the fixed disk. This
table is used by the first-stage bootstrap (or firmware) to identify parts
of the disk reserved for different operating systems, and to identify the
partition containing the second-stage bootstrap (the active Solaris partition).
The rdevice argument must be used to specify the raw device associated
with the fixed disk, for example, /dev/rdsk/c0t0d0p0.
The program can operate
in three different modes. The first is interactive mode. In interactive mode,
the program displays the partition table as it exists on the disk, and
then presents a menu allowing the user to modify the table. The menu, questions,
warnings, and error messages are intended to be self-explanatory.
In interactive
mode, if there is no partition table on the disk, the user is given the
options of creating a default partitioning or specifying the initial table
values. The default partitioning allocates the entire disk for the Solaris
system and makes the Solaris system partition active. In either case, when
the initial table is created, fdisk also writes out the first-stage bootstrap
(x86 only) code along with the partition table.
The second mode of operation
is used for automated entry addition, entry deletion, or replacement of
the entire fdisk table. This mode can add or delete an entry described on
the command line. In this mode the entire fdisk table can be read in from
a file replacing the original table. fdisk can also be used to create this
file. There is a command line option that will cause fdisk to replace any
fdisk table with the default of the whole disk for the Solaris system.
The third mode of operation is used for disk diagnostics. In this mode,
a section of the disk can be filled with a user specified pattern, and
mode sections of the disk can also be read or written.
The
menu options for interactive mode given by the fdisk program are:
- Create
a partition
- This option allows the user to create a new partition. The maximum
number of partitions is 4. The program will ask for the type of the partition
(SOLARIS, MS-DOS, UNIX, or other). It will then ask for the size of the partition
as a percentage of the disk.
The user may also enter the letter c at this point, in which case the
program will ask for the starting cylinder number and size of the partition
in cylinders. If a c is not entered, the program will determine the starting
cylinder number where the partition will fit. In either case, if the partition
would overlap an existing partition or will not fit, a message is displayed
and the program returns to the original menu.
- Change Active (Boot from) partition
- This option allows the user to specify
the partition where the first-stage bootstrap will look for the second-stage
bootstrap, otherwise known as the active partition.
- Delete a partition
- This
option allows the user to delete a previously created partition. Note that
this will destroy all data in that partition.
Use the following options
to include your modifications to the partition table at this time or to
cancel the session without modifying the table:
- Exit
- This option writes
the new version of the table created during this session with fdisk out
to the fixed disk, and exits the program.
- Cancel
- This option exits without
modifying the partition table.
The following options apply to fdisk:
- -S geom_file
- Set the label geometry to the content of the geom_file. The
geom_file contains one specification line. Each line is delimited by a new-line
character (\n). If the first character of a line is an asterisk (*), the
line is treated as a comment. Each line is composed of entries that are
position-dependent, are separated by white space, and have the following
format:
PCYL NCYL ACYL BCYL NHEADS NSECTORS SECTSIZ
where the entries have
the following values:
- PCYL
- This is the number of physical cylinders for
the drive.
- NCYL
- This is the number of usable cylinders for the drive.
- ACYL
- This is the number of alt cylinders for the drive.
- BCYL
- This is the number
of offset cylinders for the drive (should be zero).
- NHEADS
- The number of
heads for this drive.
- NSECTORS
- The number of sectors per track.
- SECTSIZ
- The size in bytes of a sector.
- -g
- Get the label geometry for disk and display on stdout (see the -S option
for the format).
- -G
- Get the physical geometry for disk and display on stdout
(see the -S option for the format).
- -n
- Don’t update fdisk table unless explicitly
specified by another option. If no other options are used, -n will only write
the master boot record to the disk. In addition, note that fdisk will not
come up in interactive mode if the -n option is specified.
- -I
- Forgo device
checks. This is used to generate a file image of what would go on a disk
without using the device. Note that you must use -S with this option (see
above).
- -B
- Default to one Solaris partition that uses the whole disk.
- -t
- Adjust
incorrect slice table entries so that they will not cross partition table
boundaries.
- -T
- Remove incorrect slice table entries that span partition
table boundaries.
- -b master_boot
- (x86 only) Specify the file master_boot
as the master boot program. The default master boot program is /usr/platform/platform-name/lib/fs/ufs/mboot.
The platform name can be found using the -i option of uname(1)
.
- -R
- Treat disk
as read-only. This is for testing purposes.
- -W fdisk_file
- Create an fdisk
file fdisk_file from disk table. This can be used with the -F option below.
- -A id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect
- Add a partition
as described by the argument (see the -F option below for the format).
- -D
id:act:bhead:bsect:bcyl:ehead:esect:ecyl:rsect:numsect
- Delete a partition
as described by the argument (see the -F option below for the format).
Note that the argument must be an exact match or the entry will not be
deleted!
- -F fdisk_file
- Use fdisk file fdisk_file to initialize table. The
fdisk_file contains up to four specification lines. Each line is delimited
by a new-line character (\n). If the first character of a line is an asterisk
(*), the line is treated as a comment. Each line is composed of entries
that are position-dependent, are separated by ‘‘white space’’ or colons, and
have the following format:
id act bhead bsect bcyl ehead esect ecyl rsect
numsect
where the entries have the following values:
- id
- This is the type
of partition and the correct numeric values may be found in fdisk.h.
- act
- This is the active partition flag; 0 means not active and 128 means active.
- bhead
- This is the head where the partition starts. If this is set to 0,
fdisk will correctly fill this in from other information.
- bsect
- This is
the sector where the partition starts. If this is set to 0, fdisk will
correctly fill this in from other information.
- bcyl
- This is the cylinder
where the partition starts. If this is set to 0, fdisk will correctly fill
this in from other information.
- ehead
- This is the head where the partition
ends. If this is set to 0, fdisk will correctly fill this in from other
information.
- esect
- This is the sector where the partition ends. If this is
set to 0, fdisk will correctly fill this in from other information.
- ecyl
- This is the cylinder where the partition ends. If this is set to 0, fdisk
will correctly fill this in from other information.
- rsect
- The relative
sector from the beginning of the disk where the partition starts. This must
be specified and can be used by fdisk to fill in other fields.
- numsect
- The size in sectors of this disk partition. This must be specified and can
be used by fdisk to fill in other fields.
- -r
- Read from disk and write to stdout. See -o and -s, which specify the
starting point and size of the operation.
- -w
- Write to disk and read from
stdin. See -o and -s, which specify the starting point and size of the
operation.
- -P fill_patt
- Fill disk with pattern fill_patt. fill_patt can be
decimal or hex and is used as number for constant long word pattern. If
fill_patt is #, then pattern is block # for each block. Pattern is put
in each block as long words and fills each block (see -o and -s).
- -o Offset
- Block offset from start of disk. This option is used for -P, -r, and -w. Zero
is assumed when this option is not used.
- -s size
- Number of blocks to perform
operation on
(see -o).
- -d
- Turn on verbose debug mode. This will cause fdisk to print
its state on stderr as it is used. The output from this option should not
be used with -F.
- -h
- Issue verbose message; message will list all options and
supply an explanation for each.
- /dev/rdsk/c0t0d0p0
- Raw device associated
with the fixed disk.
- /usr/platform/platform-name/lib/fs/ufs/mboot
- Default master boot program.
uname(1)
, fmthard(1M)
, prtvtoc(1M)
Most messages will be self-explanatory. The following may appear
immediately after starting the program:
- Fdisk: cannot open <device>
- This
indicates that the device name argument is not valid.
- Fdisk: unable to get device parameters for device <device>
- This indicates
a problem with the configuration of the fixed disk, or an error in the
fixed disk driver.
- Fdisk: error reading partition table
- This indicates that
some error occurred when trying initially to read the fixed disk. This
could be a problem with the fixed disk controller or driver, or with the
configuration of the fixed disk.
- Fdisk: error writing boot record
- This indicates that some error occurred
when trying to write the new partition table out to the fixed disk. This
could be a problem with the fixed disk controller, the disk itself, the
driver, or the configuration of the fixed disk.
Table of Contents