[SOLVED] difference between partition type and file system
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
while working with my usb drive, i first used fdisk and used "l" option to show the known partition type and opted ntfs volume set from the list. After being done with fdisk tool, i used mkfs to to create a new file system. i am now confused between the partition type that i created so that the usb drive can be used in windows 8 os and choose vfat as file system. so please clarify between partition type and file system....
I do not really understand your question, but probably: partition type is stored within the partition table, and may be modified without altering the filesystem used on the given partition (even, you may not need valid filesystem). And also you can create filesystem on any partition. Probably mkfs/formatting will set partition type too, but I'm not really sure about that, just I guess.
In addition, the partition type is a label that is used by Windows to identify the type of filesystem. I have not tested this in Windows lately to see if this is still true.
linux does not care and as a frame of reference all regular linux filesystems use type 83. Formatting via linux does not change the partition type.
Yes, Windows does care about partition types. That's why it is straightforward to hide a Windows partition for the case when you have more than one Windows installation on a disk.
Linux mostly doesn't care. For legacy MBR partitioning, there are about a dozen types that can contain subpartitions (the three "extended" partition types being the most familiar), and the kernel does treat those specially. There is also the (deprecated) "Linux RAID autodetect" type (0xfd). Other than those, the partition type does not matter to Linux. Linux looks for the various magic numbers (as with the "file" command) in the data to determine what a partition contains.
Depending on version of fdisk both of these may show up at ntfs volume.
So we'd need to know if you selected one of these of 7
86 FAT16 volume set
Legacy Fault Tolerant FAT16 volume. Windows NT 4.0 or earlier will add 0x80 to the partition type for partitions that are part of a Fault Tolerant set (mirrored or in a RAID-5 volume). Thus, one gets types 86, 87, 8b, 8c. See also Windows NT Boot Process and Hard Disk Constraints.
They are completely different. The partition type is a byte of data in the partition table that is supposed to identify the filesystem for that partition. The filesystem is how data is data is stored and retrieved on storage medium. As stated above linux does not use the partition type to determine the filesystem so it really does not mater unless you are dual booting.
As an example the partition type for any linux regular linux filesystem is 83h. By any regular linux filesystem we mean ext2, ext3, ext4, xfs, reiserfs, btrfs, jfs and so on.
Question: What is the difference between the label on a file cabinet drawer and the content of that drawer?
Answer: While there is probably some correlation, there is no necessarily relationship, and the drawer labeled "O - Z" might actually contain someone's lunchbox and no file folders at all.
To Linux, the partition type is just "the label on the drawer." It's going to open the drawers and look to determine the contents.
At a predictable place on the disk, there is a "disk label" of sorts, which contains (among other things) a "partition table." This table allows you to carve out four (or more) fixed regions of space on the drive.
Part of each partition-record is a partition type code, which simply clues the operating system as to what sort of data it should expect to find there ... and whether it should instead ignore that area completely. ("If you don't know what it is, don't mess with it!")
For example: a partition coded as "Linux swap" would not be expected to contain "a file system" at all. It would be expected to contain the on-disk data structure used by the Linux virtual memory manager. Likewise, the Linux virtual memory manager would consider only partitions that had been tagged with this particular partition-type code ... lest it somehow mis-identify its content and thereby "royally(!) screw things up."
If the partition table cues Linux that such-and-such area on the disk "should contain a file system," Linux will now look for it ... beginning with another "label record" which it expects to find at a particular place and to contain recognizable content. Specifically, Linux will attempt to identify (and load) an appropriate file-system driver (which may be a resident part of the kernel, or a loadable module), expecting it then to know how to handle the content of the partition.
The kernel mechanisms that are responsible for making this identification are called "coldplug" and "hotplug." The latter is responsible for removable devices.
By mutual agreement, the designers of all operating systems cooperate on these standards so that they can create software that works properly among various OSes, without stomping on each others' toes.
Last edited by sundialsvcs; 01-16-2017 at 01:54 PM.
For example: a partition coded as "Linux swap" would not be expected to contain "a file system" at all. It would be expected to contain the on-disk data structure used by the Linux virtual memory manager. Likewise, the Linux virtual memory manager would consider only partitions that had been tagged with this particular partition-type code ... lest it somehow mis-identify its content and thereby "royally(!) screw things up."
If the partition table cues Linux that such-and-such area on the disk "should contain a file system," Linux will now look for it ... beginning with another "label record" which it expects to find at a particular place and to contain recognizable content. Specifically, Linux will attempt to identify (and load) an appropriate file-system driver (which may be a resident part of the kernel, or a loadable module), expecting it then to know how to handle the content of the partition.
Sorry, but no. Only the partition types that can contain subpartitions (e.g., the "Extended" types) have any special treatment at all. Other than that, you can use any type for anything. You can run mkswap on a 0x83 ("Linux") partition and use it for swap. Likewise, you can run mkfs.ext4 on a 0x82 ("Linux swap") partition and use it for a filesystem. The virtual memory manager will try to use any partition you specify in a swapon command (or, with "swapon -a", have identified as "swap" in /etc/fstab). It of course will fail if the actual content of that partition does not begin with the swap header placed there by the mkswap command. The partition type does not matter.
I actually had a system that was running for years with swap on a type 0x83 partition, until one day I noticed and changed the type to 0x82 just to avoid confusing me. The Linux kernel and OS were not upset by that at all.
Pardon me ... I fear that I took the "'extended partition' exception" for granted in my previous comment.
Yes, the original set of partition-type codes was fixed. ("Think: MS-DOS on an 8086.") The "Extended" type-code was the original (and necessary) escape valve.
And, I will most-graciously grant your most-kindly correction "that the present-day logic no longer considers the 'partition-type' code."
(I confess that I am not surprised, although I have not myself lately studied the source-code. Thank you.)
Last edited by sundialsvcs; 01-16-2017 at 03:21 PM.
@OP: Hi! Great to see you studying 'concepts'! (WikiPedia is great for concepts)
Tip: put 'wiki' in front of <concept> web-search, like: (DuckDuckGo/Google/etc)
Quote:
wiki file system
p.s. @Mod: maybe move to NewbieForum[?]... @LQgurus: ?
Well, you learn something every day! I had always been under the impression that partition type and filesystem have to agree or there will be trouble somewhere.
Well, you learn something every day! I had always been under the impression that partition type and filesystem have to agree or there will be trouble somewhere.
You just need to be careful with Windows filesystems and partition types. If you put a Linux filesystem on one of the partition types that Windows recognizes (e.g., 7 "HPFS/NTFS", or 0x0c "W95 FAT32 LBA"), Windows is going to suggest that it needs to be formatted. If you put an NTFS or FAT filesystem on a partition type that Windows does not recognize, Windows won't see it.
There are, of course, many very-good reasons why the partition-type code should indicate the actual content and purpose of the partition, especially when multiple operating systems may be involved, e.g. "dual booting."
If someone goes to diagnose a disk problem, the first thing they're going to look at is the partition table, and the contents of that table should be descriptive and appropriate. If you "get cute" and stick a file system on what's labeled to be a swap partition, a technician might see that it "isn't a valid swap partition" and run mkswap on it ... ... because you led him to anticipate that this is what the partition really contains! In fact, it's what you said it contains!
Last edited by sundialsvcs; 01-17-2017 at 09:29 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.