How to Use Fdisk Format Partition in Linux [2023 Ultimate Guide]

Updated by Daisy on Nov 29, 2022
Written by Cici
  | Computer Instruction

Do you know how to use fdisk format partitions in Linux? Fdisk is included in all versions of MS-DOS and earlier versions of Windows and is also present in Linux. But it has been replaced by the Diskpart command in Windows. So, some users may not be aware of fdisk. This article will briefly introduce fdisk and guide users on how to use fdisk to format partitions in Linux. Continue to read. 

What Is Fdisk in Linux?

Do you know what is fdisk in Linux? Here is the definition of it by Wikipedia:

In computing, the fdisk command-line utility provides disk-partitioning functions, preparatory to defining file systems. In versions of the Windows NT operating system line from Windows 2000 onwards, fdisk is replaced by a more advanced tool called diskpart. Similar utilities exist for Unix-like systems. – by Wikipedia

Fdisk is a text-based utility that comes pre-installed on Linux distributions. It can be used to view and manage partitions on Linux. It can: 

  • Create, edit, and delete partitions
  • Copy or move data to new disks (partitions)
  • Delete, change, resize and organize space for partitions
  • Support for all major partition tables, including GPTMBR, Sun, SGI, and BSD

Using fdisk, you can divide a disk into a primary partition and multiple logical partitions. If you create a new partition, you need to format the partition and assign a file system to it. Next, I will describe the detailed steps to use the fdisk format partition in Linux.

How to Use Fdisk Format Partition in Linux?

For managing disk partitions, fdisk is a command line partition editor. And fdisk provides an interactive mode. It offers more control and security over partition formatting operations. This guide will manage partitions with fdisk and format them with the mkfs utility. Next is a detailed step-by-step procedure.

Step 1. Type "sudo fdisk -l" to list all the partitions and see their /dev names. For example, /dev/sda, /dev/sdb or /dev/sdc.

fdisk-see-all-partitions

Step 2. Use the "sudo fdisk /dev/sda" to view all fdisk commands.

fdisk-view-all-commands

Step 3. Type "m" to view all actions performed on /dev/sda.

Step 4. Use the command: "sudo fdisk /dev/sda" to access the partition. And then, you can type "n" to create a new partition. 

fdisk-create-partition

Step 5. Run the "w" command to write the changes and reboot the system.

Step 6. Type "t" to change the partition type.

Fdisk-change-partition

Step 7. Format the partition with the mkfs command. For example: "sudo mkfs.ext4 /dev/sda5". This command will format the fifth partition using the ext4 file system.

fdisk-format-partition

Step 8. Type " lsblk -f" to verify the file system change.

Step 9. Find the partition and make sure it uses the ext4 file system.

fdisk-verify-ext4

Tip
You can also format partitions with FAT32 and NTFS file systems. You need to change the command to FAT32 or NTFS. For example: sudo mkfs -t vfat /dev/sdb1. 

These are the specific steps for using the fdisk format a disk in Linux. You can click the link below if you still want to know how to run fdisk in Windows.

related articles

How Do I Run Fdisk on Windows 10/11: A Beginner's Guide

Do you want to learn how to run fdisk on Windows 10/11? If yes, then you are landed on the right page. Today, we will give you detailed information regarding fdisk, its uses, and other relevant information.

run-fdisk-on-windows

Bonus Tip: The Overview of Linux File System Format 

Linux can support multiple file systems. And different type of file system format has the different file size and system compatibility. Here are the most commonly used file systems.

 File System Format File Size Compatibility  Usage
EXT4 16 GiB – 16 TiB Windows, Mac, Linux For large files 
NTFS 16 EiB – 1 KB Windows, Linux  For Windows files 
FAT32 Up to 4 GB Windows, Mac, Linux For maximum compatibility

Linux systems have some other system formats, such as JFS File System, XFS File System, and Btrfs File System, but the FAT32 format is the most compatible, and you can operate it on a wide range of systems. You can convert NTFS to FAT32 to better fit Linux systems. Besides, if you want to know more file system format on Linux, you can click the button to search for the differences of Ext2/Ext3/Ext4 File System Format.

Conclusion 

Formatting a partition is helpful for computer performance. Fdisk is a good solution for the command line interface. After studying the step-by-step guide in the passage, you should be able to understand what fdisk is and be able to use fdisk format partitions in Linux. This article provides detailed steps to create and format partitions with a fdisk.

FAQs About Fdisk Format Partition in Linux

In addition to the detailed steps about using fdisk format partitions in Linux, here are some frequently asked questions about partitions.

1. What is the use of the fdisk command in Linux?

Fdisk is a command in Linux for creating and manipulating disk partitions. It can directly view, complete, and delete partitions. And it can change the size of partitions and copy and move partitions.

2. How do I format a partition in Linux?

You can format the partition with the NTFS file system in Linux.

Step 1. Run the mkfs command and specify the NTFS file system to format the disk: sudo mkfs -t ntfs /dev/sdb1

Step 2. Use the lsblk-f command to verify the file system changes

Step 3. Locate the partition to confirm the use of the NFTS system.

3. How can I see all partitions in Linux?

You can use the fdisk command to see all partitions in Linux. It is used for viewing and manipulating disk partitions. For example, you can type "fdisk -l" at the command prompt and see the partitions.

Was This Page Helpful?

 
 
 

NEW Released

EaseUS
DriverHandy

Get It

EaseUS Data Recovery Services

Request a free evaluation >>

EaseUS data recovery experts have uneaqualed expertise to repair disks/systems and salvage data from all devices like RAID, HDD, SSD, USB, etc.