8

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

  • Honestly, just use gparted and save yourself the confusion. – user606723 Aug 1 '11 at 17:00
  • 3
    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 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
14

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?

  • 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 Nguyen Aug 1 '11 at 17:27
  • 4
    NTFS is the filesystem. – Lance Roberts Aug 1 '11 at 17:32
  • 1
    @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
13

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.

  • Does and can an operating system such as Windows only the partition type and not proceed further? If yes, does this mean that the contents would remain inaccessible until the partition type is updated? – Motivated Dec 27 '18 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.