Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDISK reports no logical volumes when device is one volume starting with boot sector #77

Open
Eugeny1 opened this issue Nov 24, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@Eugeny1
Copy link

Eugeny1 commented Nov 24, 2020

See the subject. Sometimes FDISK displays incorrect (totally wrong, out of blue) partitioning information because it treats boot sector as a partition table. Can you please make FDISK checking sector 0 looking like boot sector, and display that the whole device is one big volume, taking volume configuration information from the boot sector? Current FDISK display misleads people saying the volume is empty (or badly partitioned) while it is having proper bootable volume.

@Konamiman
Copy link
Owner

This is a complex one.

In the past Nextor used to rely on the MBR signature (0x55, 0xAA as the two last bytes of the sector) to determine if there was a partition table in the physical boot sector of the device. But I removed that detection mechanism because it was misleading and sometimes gave false results (and I think it was yourself who reported that if I remember correctly?)

So now the only thing Nextor can do is to read the partition table and try to interpret it, just checking sector 0 to look like a boot sector wouldn't work because the MBR could contain a partition table AND also a boot sector (MegaSCSI, for example, used to partition devices this way).

I'm not sure how this could be solved; at most, perhaps a "hey the device seems to have a FAT boot sector in tthe MBR" message could perhaps be added. Anyway I'll leave the issue open and labeled as "enhancement" and I'm happy to accept further suggestions or related pull requests.

@Konamiman Konamiman added the enhancement New feature or request label Jul 20, 2021
@Eugeny1
Copy link
Author

Eugeny1 commented Jul 20, 2021

and I think it was yourself who reported that if I remember correctly?

Yes, it was me, and MBR as well as boot sector must contain 0xaa55 signature, so this could not be a reason for decision making.

MegaSCSI, for example, used to partition devices this way

I do believe there may be numerous ways to partition the device, but we must focus on contemporary ways of doing it. Not sure if someone is going to open megascsi volume using Nextor, and it seems megascsi does not contain Nextor kernel. Of course you can not satisfy everyone, so must choose a specific way.

"hey the device seems to have a FAT boot sector in tthe MBR" message

Message is good, but there must be a way to identify if the volume is partitioned or not.

  1. boot sector must contain 3 bytes of signature at the beginning. If machine is going to boot from this volume, it may validate the following data -- sector size=512, sector per cluster being power of 2. volume size versus device size, number of FATs to be 1 or 2, calculate FAT location and read first sector to check for matching media descriptor.
  2. look at table starting 0x1be and validate it - activity byte, partition type, starting/ending locations versus device size. Look down the chain to identify errors in partition tables.

Note that volume may just contain garbage (and I had this case) when, if kernel does not validate boot sector or MBR, the machine will go crazy, so you definitely need some validation for structures being correct before deciding on mounting the volumes.

It is not as tough as you think.

@ATroubleshooter
Copy link

AFAIK, fdisk doesn't have to process such volumes, on any system - it should report an error. For example, fdisk on linux reports: "Device does not contain a recognized partition table." in this case.

@ATroubleshooter
Copy link

AFAIK, fdisk doesn't have to process such volumes, on any system - it should report an error. For example, fdisk on linux reports: "Device does not contain a recognized partition table." in this case.

*it should report an error and propose to create MBR.

@ATroubleshooter
Copy link

ATroubleshooter commented Sep 8, 2021

well, actually I remember something, that under MSDOS fdisk has to do with filesystems, like FAT-formating partitions, but did it manage to do so on unpartitioned, single volume drive media?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants