fdisk(ADM)


fdisk -- maintain disk partitions

Synopsis

fdisk [device]
fdisk -p [device]

Description

This command is used to create and modify the partition table that is put in the first sector of the hard disk. This table is used by the operating system (or systems) installed n the hard disk and by the first-stage bootstrap to identify parts of the disk reserved for different operating systems, and to identify the partition containing the second-stage bootstrap (the active partition).

In the first usage shown above, fdisk displays the partition table as it exists on the disk, and then presents a menu allowing you to modify the table. The menu, questions, warnings, and error messages are intended to be self-explanatory. See ``Menu Options'', below.

If there is no partition table on the disk, you are given the option to create a default partition or to specify the initial table values. The default partitioning allows 100% of the disk for the system, and makes the UNIX system partition active. In either case, when the initial table is created, fdisk also writes out the first-stage bootstrap code [see sd01(HW)] along with the partition table. After the initial table is created, only the table is changed; the bootstrap is not modified.

In the second usage, the -p option prints out the disk partition table, one partition to a line, and exits. For each partition, fdisk displays the following information:

   partition   start   stop   size   type   status

The start, stop, and size values are in disk tracks. If no partition is defined, fdisk displays zero for all values.

In either usage, the optional device can be used to specify the raw device associated with the hard disk; the default value is the raw device associated with the boot hard disk.

Menu options

The following are the menu options given by the fdisk program:

Create a partition
Allows you to create a new partition. The maximum number of partitions is 4. The program will prompt for the type of partition you want to make. You can select from the following types:
   1=UNIX System
   2=pre-5.0DOS
   3=post-4.0DOS
   4=System
   5=other
fdisk will then ask for the size of the partition as a percentage of the disk. The minimum UNIX system disk partition size is 60 MB for the first disk and 40 MB for the second disk. You may also enter the letter c at this point, and the program will ask for the starting cylinder number and size of the partition in cylinders.

Note: If you select type 4, (System), to create a System Configuration Partition, fdisk will not prompt you for a starting cylinder number because the System Configuration Partition is required to start at cylinder 0.

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
Allows you 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
Allows you to delete a previously created partition. Note that this will destroy all data in that partition. Use this option with extreme caution.

Overwrite system master boot code
Overwrites the in-core boot code portion of the boot sector with the UNIX system version of the master boot code. You will need to perform an update, using fdisk's update menu option, to have the master boot code written to the disk. You should use the overwrite menu option if you have had OS/2 installed on the disk previously, because the OS/2 master boot will not boot UNIX. However, the overwrite option is not necessary for machines that have had MS-DOS and then OS/2 installed on them.

Update
Writes the new version of the table created during this session with fdisk out to the hard disk, and exits the program.

Exit
Exits without modifying the partition table.

Errors

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 hard disk, or an error in the hard disk driver.

fdisk: error reading partition table
This indicates that some error occurred when trying initially to read the hard disk. This could be a problem with the hard disk controller or driver, or with the configuration of the hard disk.

This message may appear after selecting the Update option from the menu.


fdisk: error writing boot record
This indicates that some error occurred when trying to write the new partition table out to the hard disk. This could be a problem with the hard disk controller, the disk itself, the driver, or the configuration of the hard disk.

Files


/dev/rdsk/cCbBtTdDp0

References

disk(HW), vtoc(HW)

Notices

Cautions

Use caution when using the fdisk command. If you select the option to delete a partition, the data on that partition is lost and cannot be retrieved. If you delete a partition accidentally, you will need a tape or disk backup to restore the lost data.

Compatibility

fdisk is compatible with MS-DOS Versions 3.2, 3.3, 4.0, and 5.0. Partitions set up using the MS-DOS 4.0 fdisk command that are greater than 32 MB will appear in the UNIX system display as other. Partitions can be created at sizes greater than 32 MB for MS-DOS 5.0, and appear correctly as DOS partitions. Partitions created with MS-DOS at any release level that are less than 32 MB will appear correctly as DOS partitions.

The label of a created partition will be either DOS for MS-DOS 5.0 partitions or pre-5.0DOS for any version of MS-DOS lower than 5.0. Note, however, that the version of the partition can be pre-5.0DOS even when the operating system in use is MS-DOS 5.0. Therefore, do not depend on the partition label to determine which release of MS-DOS is running.

The DOS 4.01 fdisk program assumes it can store diagnostic information in cylinder 1020 on the hard disk. If a UNIX system partition is created that uses cylinder 1020, DOS 4.01 fdisk will be unable to create a DOS partition. Therefore, you must either create the UNIX system partition at the front of the disk so that cylinder 1020 is not used, or create the DOS partition using the UNIX System fdisk (not DOS fdisk) and never delete it.

When setting up a DOS 4.01 partition on the hard disk to co-reside with a UNIX partition that has already been set up, do not allow fdisk to create the largest possible partition and make it active (as the fdisk prompt requests). Instead, you should manually set it up to line up against the UNIX partition. Note that this applies to when you boot DOS 4.01 from floppy disk (not from within UNIX) and runs fdisk.

Also note that there was a previous version of the fdisk command, intended for use with the UNIX System bkrs (backup/restore) utility. The current version of fdisk is used only for partitioning disks.

As noted in the section describing fdisk's menu options, you need to use the overwrite option when installing UNIX on a disk that has had OS/2 installed on it. The Overwrite system master boot code option overwrites the in-core boot code portion of the boot sector with the UNIX system master boot code. This operation is necessary because the OS/2 boot code will not boot UNIX. The overwrite is not necessary, however, on systems that had MS-DOS and then OS/2 installed on them. To complete the overwrite, you need to use the update menu option in fdisk.

MS-DOS and certain other operating systems do not support disk partitions starting beyond or ending above cylinder 1023. These operating systems may not be able to activate a partition that starts beyond cylinder 1023. If a partition starts before cylinder 1023 and ends after cylinder 1023, the operating system may not be able to use the disk space above cylinder 1023. If the partition table is updated via the DOS fdisk command, inappropriate information may be recorded for these partitions. If this occurs, you may not be able to boot from these partitions again. This could also occur with certain other operating systems.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005