-
Notifications
You must be signed in to change notification settings - Fork 198
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
Filesystem LABEL and UUID #59
Comments
Can you please tell how to assign label on squashfs partition? |
As filesystem LABEL and UUID is actually quite important for liveOS etc., it will be really good to have them. On the other hand, since squashfs binary format is somehow fixed, maybe these information can be stored as two special files in the root directory? i.e. mksquashfs will create two files, /.label and /.uuid. Then the two special files can be read in "squashfs_fill_super" to fill the relative information into fs/super_block. |
This feature is also very desirable for filesystem backups. The user should have the option to specify the UUID when the filesystem is created, not just generate a random UUID. |
Seems fair, though:
Some ideas where to put this two new chunks of information:
On the other hand, the UUID is just 16 bytes, and the label is a UTF-8 encoded string. Since the squashfs images are most frequently padded to the nearest 4KiB boundary, we could store this info at the end of all the *tables as a new simplistic structure:
Procedure to read UUID/LABEL would be:
Care should be taken to see if it won't break at least the kernel mounting such a structure, especially if the UUID+LABEL block would exceed the size required to pad FS to the nearest 4-KiB boundary. In that case, some additional gap could be introduced between other filesystem structures, so that we could fit in the padding to the next 4-KiB block. However, limited testing shows that kernel probably doesn't care much about squashfs trailing information, as long as it is 4-KiB padded, and unsquashfs doesn't care at all. That would give us an option to have UUID and LABEL at no additional cost (I mean: fully backward compatible solution), that could easily be read, extracted, and modified if necessary. |
+1, having support for UUID and label would be very useful. |
NixOS/nixpkgs#236656 changed NixOS's qemu-vm disk-finding mechanism to use filesystem labels. squashfs doesn't support filesystem labels (see plougher/squashfs-tools#59 ). So we can't use squashfs anymore. :( The simple test's nix store image is 240M as squashfs and 1.3G as ext4.
Please see this patch (context) for a concrete example of the ad hoc workarounds that squashfs's lack of label support causes. |
I'd added squashfs label & uuid capabilities for a project a few years back. I did it via a superblock flag, and then (when that flag is present), an extra_info metadata block appears after the compression options metadata block. It seemed to work quite nicely, with no changes needed to the linux kernel or other tools for backwards compatibility for mounting or extracting a squashfs with this extra info present. The extra_info block is populated with (tag, length, value) triplets to be future proof, with tags defined for UUID and Label, I cleaned it up a bit, and will create a pull request for comments - to see if this or something like it would be acceptable to merge upstream Example of it in use:
Example of building and deploying it (in a fresh Ubuntu 22.04 VM)
|
Label and UUID are extremely useful in automated failover scenarios. Could those be considered for next major release?
The text was updated successfully, but these errors were encountered: