fdisk man page on OpenIndiana

Man page or keyword search:  
man Server   20441 pages
apropos Keyword Search (all sections)
Output format
OpenIndiana logo
[printable version]

fdisk(1M)		System Administration Commands		     fdisk(1M)

NAME
       fdisk - create or modify fixed disk partition table

SYNOPSIS
       fdisk [-o offset] [-s size] [-P fill_patt] [-S geom_file]
	    [-w | -r | -d | -n | -I | -B | -t | -T | -g | -G | -R | -E]
	    [--F fdisk_file] [ [-v] -W {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

DESCRIPTION
       This command is used to do the following:

	   o	  Create and modify an fdisk partition table on x86 systems

	   o	  Create  and  modify  an  fdisk  partition table on removable
		  media on SPARC or x86 systems

	   o	  Install the master boot record that is put in the first sec‐
		  tor of the fixed disk on x86 systems only

       This  table is used by the first-stage bootstrap (or firmware) to iden‐
       tify 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 interac‐
       tive  mode. In interactive mode, the program displays the partition ta‐
       ble as it exists on the disk, and then presents	a  menu	 allowing  the
       user to modify the table. The menu, questions, warnings, and error mes‐
       sages 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 speci‐
       fying the initial table values. The default partitioning allocates  the
       entire  disk for the Solaris system and makes the Solaris system parti‐
       tion 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. In this mode, (x86 only) when  creating  an	 entry
       for a non-EFI partition on a disk that is larger than 2 TB (terabytes),
       fdisk warns that the maximum size of the partition is 2 TB. Under these
       conditions percentages displayed by fdisk are based on 2 TB.

       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.

       Note -

	 The  third  mode of operation is not currently supported for extended
	 partitions

       When fdisk creates a partition, the space is  allocated	in  the	 fdisk
       partition  table,  but  the  allocated  disk  space is not initialized.
       newfs(1M) is required to create and write file system metadata  to  the
       new  partition, and format(1M) is required to write the VTOC or EFI/GPT
       metadata.

   Menu Options
       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	parti‐
	   tion. Note that this will destroy all data in that partition.

       Change between Solaris and Solaris2 Partition IDs

	   This	 option	 allows	 the  user to switch between the current fdisk
	   operating system partition identifier and the  previous  one.  This
	   does	 not affect any data in the disk partition and is provided for
	   compatibility with older software.

       Edit/View extended partitions

	   This option provides the extended partition menu to the  user.  Use
	   the	extended  partition  menu  to  add  and delete logical drives,
	   change the sysid of the logical drives, and display	logical	 drive
	   information.	 To commit the changes made in the extended partition,
	   you must return to the main menu using the extended partition  sub‐
	   menu	 option	 r.  There  is	also  an option to display the list of
	   options that the extended partition submenu supports.  Given	 below
	   is the list:

	   a	Add a logical drive.

		Use  this  submenu  option  to	add a logical drive. There are
		three pieces of information that are required:	The  beginning
		cylinder,  the	size (in cylinders or in human readable form -
		KB, MB, or GB), and the partition  ID.	While  specifying  the
		partition  ID, there is an option (I) that you can use to list
		the supported partitions.

	   d	Delete a logical drive.

		Use this submenu option to delete a logical  drive.  The  only
		input  required	 is the number of the logical drive that is to
		be deleted.

	   h	Display the help menu.

		This submenu option displays the supported operations  in  the
		extended partition submenu.

	   i	Change the id of the logical drive.

		Use  this submenu option to change the system ID of the exist‐
		ing logical drives. A list of supported	 system	 IDs  is  dis‐
		played when you use the I option when in this submenu.

	   p	Display the logical drive layout.

		Displays  the logical drive information to stdout. This output
		reflects any changes made during the current run of the	 fdisk
		program.  The  changes	are  not  committed  to the disk until
		return to the main menu (using the submenu r) and  choose  the
		option to commit the changes to the disk.

	   r	Return to the main fdisk menu.

		Exit  the  extended  partition	submenu and return to the main
		menu.

	   Note the dynamic nature of the numbering  of	 extended  partitions.
	   For	example, consider a Solaris system with the partitions p1, p2,
	   p3, and p4. Following creation of an extended partition,  the  same
	   system has a logical device node, p5, and successive nodes numbered
	   consecutively up to a maximum of  p36.  If  one  logical  drive  is
	   deleted,  say,  p8, then all nodes following p8 (p9 up to p36) move
	   up one in the list of  partitions,  so  that	 p9  becomes  p8,  p10
	   becomes p9, and so forth.

       Use  the	 following options to include your modifications to the parti‐
       tion table at this time or to cancel the session without modifying  the
       table:

       Exit	 This  option writes the new version of the table created dur‐
		 ing this session with fdisk out to the fixed disk, and	 exits
		 the program.

       Cancel	 This option exits without modifying the partition table.

OPTIONS
       The following options apply to fdisk:

       -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). Use of this option will zero out the VTOC on
	   the Solaris partition if the fdisk table changes.

       -b master_boot

	   Specify  the	 file  master_boot  as	the  master  boot program. The
	   default master boot program is /usr/lib/fs/ufs/mboot.

       -B

	   Default to one Solaris partition that uses the whole	 disk.	On  an
	   x86	machine,  if  the  disk	 is  larger than 2 TB (terabytes), the
	   default size of the Solaris partition will be limited to 2 TB.

       -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.

       -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! Use	of  this  option  will
	   zero	 out  the  VTOC	 on  the  Solaris partition if the fdisk table
	   changes.

       -E

	   Create an EFI partition that uses the entire disk.

       -F fdisk_file

	   Use fdisk file fdisk_file to initialize table. Use of  this	option
	   will	 zero out the VTOC on the Solaris partition if the fdisk table
	   changes.

	   The fdisk_file contains four specification lines  for  the  primary
	   partitions  followed by specification lines for the logical drives.
	   You must have four lines for the primary partitions if there is  at
	   least  one  logical	drive.	In this case, if the number of primary
	   partitions to be configured is less than four, the remaining	 lines
	   should be filled with zeros.

	   Each	 line  is composed of entries that are position-dependent, are
	   separated by whitespace 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. For logical drives, this flag will
		      always be set to 0 even if specified as 128 by the user.

	   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. For logical
		      drives, you must make sure that there are	 at  least  63
		      free  sectors  before  the rsect specified for a logical
		      drive.

	   numsect    The size in sectors of this disk partition. This must be
		      specified	 and  can  be  used  by fdisk to fill in other
		      fields.

       -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).

       -h

	   Issue verbose message; message will list all options and supply  an
	   explanation for each.

       -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).

       -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.

       -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.

       -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).

       -r

	   Read from disk and write to stdout. See -o and  -s,	which  specify
	   the starting point and size of the operation.

       -R

	   Treat disk as read-only. This is for testing purposes.

       -s size

	   Number of blocks to perform operation on (see -o).

       -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 (0fR). 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.

       -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.

       -v

	   Output  the	HBA (virtual) geometry dimensions. This option must be
	   used in conjunction with the -W flag. This  option  will  work  for
	   platforms which support virtual geometry. (x86 only)

       -w

	   Write to disk and read from stdin. See -o and -s, which specify the
	   starting point and size of the operation.

       -W −

	   Output the disk table to stdout.

       -W fdisk_file

	   Create an fdisk file fdisk_file from disk table. This can  be  used
	   with the -F option below.

FILES
       /dev/rdsk/c0t0d0p0	Raw device associated with the fixed disk.

       /usr/lib/fs/ufs/mboot	Default master boot program.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌─────────────────────────────┬─────────────────────────────┐
       │      ATTRIBUTE TYPE	     │	    ATTRIBUTE VALUE	   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Architecture		     │x86 and SPARC		   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Availability		     │SUNWcs			   │
       └─────────────────────────────┴─────────────────────────────┘

SEE ALSO
       uname(1),     fmthard(1M),    format(1M),    newfs(1M),	  prtvtoc(1M),
       attributes(5)

DIAGNOSTICS
       Most messages will be self-explanatory. The following may appear	 imme‐
       diately 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.

SunOS 5.11			  11 Nov 2009			     fdisk(1M)
[top]

List of man pages available for OpenIndiana

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net