Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a little bit confused with partitioning the filesystem in Linux.

Please tell me the difference between creating the file system with fdisk and mkfs (when formatting the disk).

I can't clearly tell my problem, so please look at this picture: enter image description here

share|improve this question
Honestly, just use gparted and save yourself the confusion. – user606723 Aug 1 '11 at 17:00
Well, there're so many tools that I can use to handle these problems. But here I just wanna understand a bit more about the inside =))) – Hieu M. Nguyen Aug 1 '11 at 17:24
In that case, you should've said that in your question. Currently it sounds you're having an issue setting up your partitions.. not that you want to understand whats going on. There is a difference. – user606723 Aug 1 '11 at 17:27
Thanks for reminding that =) – Hieu M. Nguyen Aug 1 '11 at 18:10
up vote 10 down vote accepted

Fdisk partitions your hard drive. It sets up partitions on the disk by creating a partition table.

mkfs formats the partition after it has been created. It formats it based on a specific filesystem like NTFS, FAT32, Unix ext2 & ext2.

So fdisk isn't really creating a filesystem, it's setting up the hard drive so that a filesystem can be created on it. I'm not sure I see a problem in your picture, did you not want NTFS?

share|improve this answer
So fdisk does not create the file system, right? I use fdisk to create a partition with ext4, ext2,.. types and I use mkfs.ntfs to format the disk. I wonder, which is actually the file system? ext4 or ntfs? – Hieu M. Nguyen Aug 1 '11 at 17:27
NTFS is the filesystem. – Lance Roberts Aug 1 '11 at 17:32
@Hieusun2011: if you're familiar with DOS, mkfs in Linux is like FORMAT in DOS, and fdisk in Linux is like FDISK in DOS. If you're familiar with the Disk Mgmt tool in Windows, it has one GUI for both but partitioning a disk and formatting a partition are still separate steps there. The basic concepts are the same, and this was intentional, to support dual-booting. – gatkin Aug 1 '11 at 17:53

To use an analogy, think of fdisk as setting up the fences around your garden with small fences separating the areas that you want to have for grass, fruit trees and vegetables. While it sets up these walls (partitons) for you it does not actually put anything in those spaces.

Then you use mkfs to format those areas into the ways that you are wanting, you choose your filesystem (be it grass, fruit or vegetable) and mkfs puts it all in place and makes it usable.

What you are seeing in "partition type" is a legacy identifier that tells the system what type of operating system is likely to be able to read the contents, this is mainly so that an operating system such as Windows can quickly look at the partition type and (if it is a type it does not understand) then it can quickly move to the next partition to check that for filesystems. This does not stop the operating system from going further and actually checking the filesystem itself to see if it can read it, it just gives the OS an idea what to expect.

You can still put a Windows filesystem (NTFS) in a Linux (type 83) partition as you have done but whether or not any operating system chooses to read or ignore it is up to the designers of that operating system.

share|improve this answer
+1 for an excellent explanation. Thank you. – user1527227 Feb 3 '14 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .