LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 01-10-2017, 07:42 AM   #1
chinmaya5
LQ Newbie
 
Registered: Jun 2014
Posts: 17

Rep: Reputation: Disabled
Question difference between partition type and file system


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....

Last edited by chinmaya5; 01-10-2017 at 07:44 AM.
 
Old 01-10-2017, 08:07 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,684

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
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.
 
Old 01-10-2017, 08:14 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
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.
 
Old 01-10-2017, 10:22 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
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.
 
Old 01-10-2017, 05:18 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,937

Rep: Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619
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.

87 NTFS volume set

Legacy Fault Tolerant NTFS volume. HPFS Fault-Tolerant mirrored partition.


https://www.win.tue.nl/~aeb/partitio...n_types-1.html

https://unix.stackexchange.com/quest...ion-on-dev-sdx

Last edited by jefro; 01-10-2017 at 05:20 PM.
 
Old 01-16-2017, 11:46 AM   #6
chinmaya5
LQ Newbie
 
Registered: Jun 2014
Posts: 17

Original Poster
Rep: Reputation: Disabled
im still confused. the question that i want to ask is "what is the difference between partition type and file system?"
 
Old 01-16-2017, 12:03 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
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.

https://en.wikipedia.org/wiki/Partition_type

Last edited by michaelk; 01-16-2017 at 12:10 PM.
 
Old 01-16-2017, 12:58 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
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.
 
Old 01-16-2017, 01:49 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,609
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
Here we go . . .

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.
 
1 members found this post helpful.
Old 01-16-2017, 02:38 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by sundialsvcs View Post
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.
 
1 members found this post helpful.
Old 01-16-2017, 03:20 PM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,609
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
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.
 
Old 01-17-2017, 01:06 AM   #12
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
@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: ?

Last edited by Jjanel; 01-17-2017 at 01:10 AM.
 
Old 01-17-2017, 01:31 AM   #13
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,494
Blog Entries: 19

Rep: Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410Reputation: 4410
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.
 
Old 01-17-2017, 08:41 AM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by hazel View Post
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.
 
Old 01-17-2017, 09:25 AM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,609
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
size difference in partition and NTFS file system m4rtin Linux - Server 3 05-07-2012 10:31 AM
changing file system type to another filesystem type,does it effect on data? janakiramulu Ubuntu 1 02-04-2011 01:58 AM
Check file system type of a partition EmrldDrgn Linux - Newbie 3 07-11-2009 07:56 AM
PCLOS: Boot error: file system type is ext2fs; partition is 0x83, and error 13 dpeirce Linux - Distributions 3 09-29-2008 10:48 PM
How to know partition file system type? Hondro Slackware 4 11-28-2006 03:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration