How does operating system know what filesystem a partition is using? In other words, how are FAT16/32, NTFS, ext2/3 etc. distinguished from each other?
If you're using Win32 APIs on Windows, then you can call GetVolumeInformation (http://msdn.microsoft.com/en-us/library/aa364993.aspx) to determine the type of file system present on a given mounted volume.
For example, if you're trying to detect the file system present on D:, then you can call:
WCHAR FSType[512];
if (GetVolumeInformationW(L"D:\\", NULL, 0, NULL, NULL, NULL, FSType, ARRAYSIZE(FSType))) {
wprintf(L"FS type = %s\n", FSType);
}
This will only work, however, if the file system is "recognized" and "mountable" by the running operating system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With