I read the first sector of partition, then try to find some iconic bytes of some popular fs, in order to recognize the fs.But I don't think it's reliable.Is there any better ways?
By the way, I noticed the system id byte of the partition.Is it useful?
Is there any better ways to recognize the fs of partition?
-
- Member
- Posts: 27
- Joined: Wed Jun 29, 2022 2:17 am
- Libera.chat IRC: theflysong
Is there any better ways to recognize the fs of partition?
I'm a new man to develop operating system.
Re: Is there any better ways to recognize the fs of partitio
There’s some information here which might help: https://jdebp.uk/FGA/determining-filesystem-type.html
-
- Member
- Posts: 27
- Joined: Wed Jun 29, 2022 2:17 am
- Libera.chat IRC: theflysong
Re: Is there any better ways to recognize the fs of partitio
Thanks, but I can't access this page no matter whether I use the VPN.Can you give me a screenshot?Or other pages?iansjack wrote:There’s some information here which might help: https://jdebp.uk/FGA/determining-filesystem-type.html
I'm a new man to develop operating system.
Re: Is there any better ways to recognize the fs of partitio
I can’t reproduce the whole page as that would be a copyright breach, and it contains futher links. Can you get to https://jdebp.uk/FGA/ and follow the links from there?
Possibly there is some restriction on that site from your locality - where are you?
Possibly there is some restriction on that site from your locality - where are you?
Re: Is there any better ways to recognize the fs of partitio
The article talks about how various partition types map to various file systems. I wouldn't bother. Far better to just look at the data in the partition. Especially for MBR formatted drives, you have one byte, which is just not enough space to encode FS information reliably. Partition type 0x82 may be some FreeBSD partition, or a Linux swap partition, and the only way to tell is to look at the data. Type 0x83 may be any Linux FS, and Linux supports many file systems.
Best way to do it as far as I know is to attempt to mount the FS with all of your FS drivers. I mean, you must program your FS drivers such that the device data is not trusted, right? So you must verify that all input fields have sensible values. Yes, in the end this comes back down to guessing magic numbers, but far better than to trust that whatever partitioning tool set the partition types correctly, or that a sensible partition type even exists.
Best way to do it as far as I know is to attempt to mount the FS with all of your FS drivers. I mean, you must program your FS drivers such that the device data is not trusted, right? So you must verify that all input fields have sensible values. Yes, in the end this comes back down to guessing magic numbers, but far better than to trust that whatever partitioning tool set the partition types correctly, or that a sensible partition type even exists.
Carpe diem!
-
- Member
- Posts: 27
- Joined: Wed Jun 29, 2022 2:17 am
- Libera.chat IRC: theflysong
Re: Is there any better ways to recognize the fs of partitio
I come from China, and, you know, China has many Internet restrictions, in order to ban some illegal infomations, but also prevent us from accessing some technical pages, because they are didn't approved by goverments.So we sometimes use a VPN to access foreign websites, to look up some infomation.Strangely, I can't access this page no matter whether I use a VPN.I guess there are some special restrictions to it?iansjack wrote:I can’t reproduce the whole page as that would be a copyright breach, and it contains futher links. Can you get to https://jdebp.uk/FGA/ and follow the links from there?
Possibly there is some restriction on that site from your locality - where are you?
Luckily, I needn't a VPN to access this website.(the VPN was too expensive)
I'm a new man to develop operating system.
-
- Member
- Posts: 27
- Joined: Wed Jun 29, 2022 2:17 am
- Libera.chat IRC: theflysong
Re: Is there any better ways to recognize the fs of partitio
Thanks, I think it maybe the only way to deal with this problem.nullplan wrote:The article talks about how various partition types map to various file systems. I wouldn't bother. Far better to just look at the data in the partition. Especially for MBR formatted drives, you have one byte, which is just not enough space to encode FS information reliably. Partition type 0x82 may be some FreeBSD partition, or a Linux swap partition, and the only way to tell is to look at the data. Type 0x83 may be any Linux FS, and Linux supports many file systems.
Best way to do it as far as I know is to attempt to mount the FS with all of your FS drivers. I mean, you must program your FS drivers such that the device data is not trusted, right? So you must verify that all input fields have sensible values. Yes, in the end this comes back down to guessing magic numbers, but far better than to trust that whatever partitioning tool set the partition types correctly, or that a sensible partition type even exists.
I'm a new man to develop operating system.
Re: Is there any better ways to recognize the fs of partitio
Well, as well as partition types it also discusses the BPB and the magic numbers in the superblock that identify Unix-style filesystems. From the very start it emphasises that the partition type is not a reliable way to determine the filesystem. It has information that would be interesting to anyone wanting to identify a filesystem.nullplan wrote:The article talks about how various partition types map to various file systems. I wouldn't bother.
Why that page is inaccessible to China is a mystery.