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

PyFat.mkfs() - volume label does not appear to be applied #18

Closed
dseeley opened this issue Feb 4, 2022 · 1 comment
Closed

PyFat.mkfs() - volume label does not appear to be applied #18

dseeley opened this issue Feb 4, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dseeley
Copy link

dseeley commented Feb 4, 2022

Attempting to create a volume using the new mkfs() function:

temp_file = open(file="test_mkfs.fat12", mode="w+")
temp_pyfat = PyFat()
temp_pyfat.mkfs(filename=temp_file.name, fat_type=PyFat.FAT_TYPE_FAT12, label="TSTLABEL", size=(1024 * 256))

It appears that on mounting, the volume label is not set:

$ sudo losetup /dev/loop0 ./test_mkfs.fat12
$ lsblk -o name,label,size,uuid
NAME   LABEL  SIZE UUID
loop0         256K 5444-8E7B

I get the same results with FAT16/32

A similarly created file using mkfs yields a label:

$ mkfs.fat -C -F12 -n "TSTLABEL" test_mkfs.fat12 256
$ sudo losetup /dev/loop0 ./test_mkfs.fat12
$ lsblk -o name,label,size,uuid
NAME   LABEL     SIZE UUID
loop0  TSTLABEL  256K A562-5D4B
@nathanhi
Copy link
Owner

nathanhi commented Feb 4, 2022

Seems like the special volume label file is actually required in some cases (and you just discovered one of them 🎉). I was under the impression that the special file is optional - at least with FAT16/32 I cannot remember that fsck ever complained about it. file and fatcat seem to work just fine without it, but lsblk/Linux is a bit more picky. 🙂

image

As a workaround you can add a new FATDirectoryEntry to the root directory with the FATDirectoryEntry.ATTR_VOLUME_ID set as an attribute. I'll need to investigate under which circumstances the special file is actually required first.

@nathanhi nathanhi added the bug Something isn't working label Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants