The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

18.1.1 Managing Partition Tables Using fdisk

Caution

If any partition on the disk to be configured using fdisk is currently mounted, unmount it before running fdisk on the disk. Similarly, if any partition is being used as swap space, use the swapoff command to disable the partition.

Before running fdisk on a disk that contains data, first back up the data on to another disk or medium.

You cannot use fdisk to manage a GPT hard disk.

You can use the fdisk utility to create a partition table, view an existing partition table, add partitions, and delete partitions. Alternatively, you can also use the cfdisk utility, which is a text-based, graphical version of fdisk.

You can use fdisk interactively or you can use command-line options and arguments to specify partitions. When you run fdisk interactively, you specify only the name of the disk device as an argument, for example:

# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help):

If you disable DOS-compatibility mode, fdisk aligns partitions on one-megabyte boundaries. It is recommended that you turn off DOS-compatibility mode and use display units of 512-byte sectors by specifying the -c and -u options or by entering the c and u commands.

Enter c to switch off DOS-compatibility mode, u to use sectors, and p to display the partition table:

Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002a95d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

The example output shows that /dev/sda is a 42.9 GB disk. As modern hard disks support logical block addressing (LBA), any information about the numbers of heads and sectors per track is irrelevant and probably fictitious. The start and end offsets of each partition from the beginning of the disk are shown in units of sectors. The partition table is displayed after the device summary, and shows:

Device

The device that corresponds to the partition.

Boot

Specifies * if the partition contains the files that the GRUB bootloader needs to boot the system. Only one partition can be bootable.

Start and End

The start and end offsets in sectors. All partitions are aligned on one-megabyte boundaries.

Blocks

The size of the partition in one-kilobyte blocks.

Id and System

The partition type. The following partition types are typically used with Oracle Linux:

5 Extended

An extended partition that can contain up to four logical partitions.

82 Linux swap

Swap space partition.

83 Linux

Linux partition for a file system that is not managed by LVM. This is the default partition type.

8e Linux LVM

Linux partition that is managed by LVM.

The n command creates a new partition. For example, to create partition table entries for two Linux partitions on /dev/sdc, one of which is 5 GB in size and the other occupies the remainder of the disk:

# fdisk -cu /dev/sdc
...
Command (m for help): n
Command action
    e    extended
    p    primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-25165823, default 2048):  2048
Last sector, +sectors or +size{K,M,G} (2048-25165823, default 25165823): +5G

Command (m for help): n
Command action
    e    extended
    p    primary partition (1-4)
p
Partition number (1-4): 2
First sector (10487808-25165823, default 10487808): <Enter>
Using default value 10487808
Last sector, +sectors or +size{K,M,G} (10487808-25165823, default 25165823): <Enter>
Using default value 25165823

Command (m for help): p

Disk /dev/sdc: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders, total 25165824 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe6d3c9f6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    10487807     5242880   83  Linux
/dev/sdc2        10487808    25165823     7339008   83  Linux

The t command allows you to change the type of a partition. For example, to change the partition type of partition 2 to Linux LVM:

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e

Command (m for help): p
...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    10487807     5242880   83  Linux
/dev/sdc2        10487808    25165823     7339008   8e  Linux LVM

After creating the new partition table, use the w command to write the table to the disk and exit fdisk.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

If you enter q instead, fdisk exits without committing the changes to disk.

For more information, see the cfdisk(8) and fdisk(8) manual pages.