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
mkfs.vfat 4.2 on a whole block device adds bogus partition table #161
Comments
I bisected this to commit 5e936c9. The change seems quite complicated. I wasn't able to revert it to be completely sure that the bisection is correct since the code in |
A simple and safe reproducer is:
Check if the hexdump output contains the bogus PTE at 0x1b0-0x1c0. |
And what is the issue? Are you unable to mount fat formatted /dev/sda disk? I have done lot of tests and mounting /dev/sda is working fine. If you do not have loaded vfat.ko it is needed either to run mount with Also partition table on /dev/sda is valid and you should be able to mount /dev/sda1 without any special option. |
The issue is the partiition table is wrong, it's a partition table containing a partition which references itself. This causes trouble with some tools we use for creating filesystems which don't expect incorrect PTs. The second issue is it's inconsistent - creating a filesystem in a file does the right thing. |
My colleague noticed the |
Well, I do not see nothing wrong with it. Kernel correctly handles it and also other standard tools. This was added in 4.2 for compatibility with Windows kernel as it cannot access FAT filesystem on non-removable disk without MBR/GPT partition table. Same behavior is already implemented in mformat utility (alternative FAT format utility) from Linux mtools project for a long time. And also in mkudffs (UDF format tool) from udftools project.
So I think these tools needs to be fixed as they are incompatible also with mtools and udftools. Anyway, this behavior is documented in mkfs.fat manual page and can be changed by --mbr option.
This is also documented. That MBR table is created only on non-removable disk block devices and via --mbr option you can change it. It is because when formatting filesystem in a file, it is not known if you are going to copy this image into partition or to a whole disk. Also this change is mentioned in 4.2 release notes. If you think that documentation in manpage is not enough or can be extended or better explained, please let me know. |
So, are you unable to mount fat formatted /dev/sda disk or /dev/sda1 device? Or is not kernel correctly parsing this partition table? Or is documentation incomplete and needs to be extended? Please provide more information as I do not see nothing bogus or broken on this partition table. Existing tools like fdisk can correctly handle / read it. Also same behavior has for a long time mformat and is present already in mkudffs. |
We're going to use |
In response to #161 (comment) @pali
|
https://bugzilla.redhat.com/show_bug.cgi?id=1931866
You can no longer use this command on a whole device to create a filesystem:
Previously this would do the obvious. Now it creates a bogus partition table which has a single partition that overlays the whole device:
(Notice the partition start/end)
Diffing the filesystem that is created before and after shows the new partition table entry at 0x1be-0x1cd which was all zeroes before:
Curiously it still works fine if you run mkfs on a local file.
This is a regression somewhere between versions 4.1 and 4.2.
The text was updated successfully, but these errors were encountered: