How to create a new file or directory in a file generated using LFS?
I only found a way to create a new LFS file in the example, without adding content to the existing LFS file, I think this should be achievable, If possible, please give me a demonstration. Thank you
I have found a way to manipulate the contents of the lfs file. I export the data from the LFS partition on the device to bin and put it into this library. The library can correctly recognize the files in bin, and then I use the library to add files to bin. When I recognize it again, it shows that it has been successfully added, which means that this bin contains both the device's own files and the newly created files using the library. Next, I will rewrite this bin into the device's flash. When I start the device, it prompts a mount failure and receives an -84 error code. Why did this issue occur
What version of littlefs are you running on your microcontroller? Newer version of littlefs are not backwards compatible with older versions (~1yr old).
2.5.0,I tried to upgrade the device's LFS to 2.9.0 today, which is the same as the version of this library, but it still failed In addition, my previous tests were not completely unsuccessful. There were a few times when the LFS on the device could recognize the files and data contained in the library generated files, but only those few times. Afterwards, either the mount failed or the mount succeeded but the files inside were not recognized I took a look and the biggest difference is that in the files generated by the library, the operation records start from super block 3, while the device's LFS starts recording operations from super block 2. I tried to have the device write data repeatedly, bring the operation records to super block 3, and then rewrite them to flash, but it still failed These are the two LFS files I am using. Can you help me analyze this issue? thank you bin.zip
what is the block_size that created these files?
4096
I was unable to unpack the Library generated.bin you uploaded. I unpacked the device-generated and repacked it, does the following work for you? The contents should be (all 0 bytes in size):
111.bin
2222.hex
33333.jpg
related: I just opened a PR reworking the CLI to be a bit more intuitive, you can try playing around with it if you'd like:
https://github.com/jrast/littlefs-python/pull/96
I was unable to unpack the
Library generated.binyou uploaded. I unpacked the device-generated and repacked it, does the following work for you? The contents should be (all 0 bytes in size):111.bin 2222.hex 33333.jpg
I wrote this bin into the device's flash, but it still returns -84. The super block number in this bin still starts from 3. Do you have a way to make it start from 2? Because my device starts recording from Super Block 2, which can also be seen in the bin I uploaded
@pine-fish did you ever resolve your issue?