Skip to content

MacOS fdisk command

The MacOS fdisk command is a versatile utility that allows users to manage disk partitions effectively. With fdisk, users can create, delete, and modify partitions on their system’s hard drive. This command is a powerful tool for organizing and optimizing disk space, making it easier to store and access files. By mastering the fdisk command, MacOS users can take full control of their storage solutions and customize their disk partitions to suit their specific needs.

fdisk Syntax:

Terminal window
sudo fdisk [options] [parameters]

Options:

OptionDescription
-eEdit the MBR partition tables.
-iInitialize the MBR partition tables.
-uDisplay units in sectors for some fields.

Parameters:

ParameterDescription
diskThe path to the disk you want to operate on.
typeThe type of the partition table (usually MBR).

fdisk Usage:

Create a new DOS disklabel

Terminal window
fdisk -i /dev/disk2

Initializes a new DOS disklabel on the disk named disk2.

Display partition information

Terminal window
fdisk /dev/disk3

Displays the partition information for the disk named disk3.

Remove an existing partition

Terminal window
fdisk -e /dev/disk4

Opens the interactive edit mode to remove existing partitions from disk4.

Update the MBR on a disk

Terminal window
fdisk -u /dev/disk5

Updates the Master Boot Record (MBR) on the disk named disk5.

How do I use fdisk in MacOS?

To use the fdisk command in MacOS, execute the following command:

Terminal window
fdisk /dev/disk0

What is the purpose of the fdisk command in MacOS?

The fdisk command in MacOS is used for partitioning disks and modifying the partition tables on a disk.

How can I list the partitions on a disk using fdisk in MacOS?

To list the partitions on a disk using fdisk in MacOS, run the following command:

Terminal window
fdisk -l /dev/disk0

How do I create a new partition using fdisk in MacOS?

To create a new partition using fdisk in MacOS, follow these steps:

Terminal window
fdisk -e /dev/disk0

Can I delete a partition with fdisk in MacOS?

Yes, you can delete a partition with the fdisk command in MacOS. To delete a partition, use the following command:

Terminal window
fdisk -i /dev/disk0

How do I change the partition type with fdisk in MacOS?

To change the partition type using fdisk in MacOS, you can use the following command:

Terminal window
fdisk -e /dev/disk0

Is it possible to resize a partition using fdisk in MacOS?

No, the fdisk command in MacOS does not have the capability to resize partitions. It is primarily used for partitioning disks and modifying partition tables.

Applications of the fdisk command

  • Creating and managing disk partitions
  • Displaying information about disk partitions
  • Setting up disk partition tables