-
Notifications
You must be signed in to change notification settings - Fork 13
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
Changes in "util-linux" (blkid) -> LABEL vs. LABEL_FATBOOT #30
Comments
Hi @flipsa, thanks for this report though I must admit I'm a bit puzzled. The only FAT-related field might be the |
Hey @natevw Maybe I misunderstood how fatfs works, or how it's being used by Xen Orchestra, but after skimming their code I was under the assumption that they write the label into VolLab. I'm not too familiar with the XO codebase, but I think this is the relevant piece of code: |
Yes, it looks like they do use one of this libraries structs directly to format the volume from xo-server itself, and set the VolLab in the boot header. The summary at https://lkml.org/lkml/2017/10/4/512 is helpful and clarifies that the boot structure value is usually not used. I'm assuming that would be the In order to set the other entry which I presume is the This library doesn't usually do anything with this kind of entry except to ignore it when iterating through through a directory listing. However, studying the file entry handling code it looks like it might be possible to set the |
Actually, correction: The From the public interface of |
@natevw Hey I'm looking into it but I have to say that I don't see how to do it, would it possible for you to give me a small example? 🙂 |
@julien-f Sorry been busy with other projects and I have to admit I'm myself rusty on the details of this library. Basically you would need to do something like what
Or more simply, create a file in the root directory of the volume using the normal API and then do what Does that help a bit? Ultimately, since iirc the original XO code where this is getting used is formatting a brand new volume, much more assumptions could be made and it might be possible to sort of "hardcode" all the offsets/entries a bit more since this would be the only directory entry to worry about at that point. This is unnecessarily complicated because the public API of fatfs prevents this in its attempt to be compatible with the real node.js filesystem API. Specifically |
Taking a step back: I suspect it would be helpful to add a public "format volume" helper method that does everything needed here? That doesn't totally solve the general case (i.e. wouldn't allow changing the label later, etc.) but might help XO be less dependent on the gory internals here. This would be a top-level API, sibling to the current Specifically, this would move the work started at https://github.com/vatesfr/xen-orchestra/blob/ad58f6a14795feebe3caf9b1db5f05b593586f6d/packages/xo-server/src/fatfs-buffer.js#L27 into a public method on this library. But make it a bit more generic: using a volume driver rather than initializing own buffer, and un-hardcoding configuration stuff using on |
No problem, I'm also rather busy, I'll take a look at your answer in the coming weeks when I have more time, thank you so much! 🙂 |
So yesterday and today I was researching this and I've discovered few interesting things:
I've managed to add hacky support by replacing if ('firstCluster' in newStats) {
entry.FstClusLO = newStats.firstCluster & 0xFFFF;
entry.FstClusHI = newStats.firstCluster >>> 16;
entry._firstCluster = newStats.firstCluster;
} with entry.Attr.volume_id = true
if ('firstCluster' in newStats) {
entry.FstClusLO = newStats.firstCluster & 0xFFFF;
entry.FstClusHI = newStats.firstCluster >>> 16;
entry._firstCluster = newStats.firstCluster;
}
entry.FstClusLO = 0
entry.FstClusHI = 0 in UPDATE1: UPDATE2: replace var _snInvalid = /[^A-Z0-9$%'-_@~`!(){}^#&.]/g; name = name.toUpperCase().replace(/ /g, '').replace(/^\.+/, ''); with var _snInvalid = /[^A-Za-z0-9$%'-_@~`!(){}^#&.]/g; name = name.replace(/ /g, '').replace(/^\.+/, ''); in helpers.js |
Lower/Upper case is not an issue, because cloud-init works with both |
Hey @natevw
I just ran into a problem with software that relies on fatfs. See this Xen Orchestra issue.
I am not sure if you are aware of it, but util-linux > 2.33-rc1 now uses "LABEL_FATBOOT" instead of "LABEL" for labels written to the boot sector of a disk. Is it possible to change this in fatfs, or maybe set both LABEL and LABEL_FATBOOT (to the same value)?
The text was updated successfully, but these errors were encountered: