-
Notifications
You must be signed in to change notification settings - Fork 53
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
how to create a packed img from a directory #62
Comments
Well, it depends on many things:
There are also some heuristics in volume formatting code that determine FAT type (FAT12/16/32), FAT size, cluster size, etc. and all those values affect the final size. Because of all that it would be very hard to calculate the optimal size. Perhaps implementing some heuristics that determines close-enough size would be okay for you use case. The simplest one would be to use experimentally determined size multiplier e.g. |
You can calculate the size of all data using following pseudo-code:
But of course you don't know CLUSTER_SIZE beforehand so I don't know if it's useful for you... Also it is only calculates length of data clusters, but there are also FATs which size cannot be easily calculated... |
Would it be possible to start by formatting with a size of 0xffff_ffff and then shrink the file system to the actual size? |
Looking into this a bit, I'm not quite sure how to estimate the number of sectors to provide during formatting so that a given directory can be stored in the file system with as little overhead as possible. The use case for this is creating apple disk images (dmg) with a FAT32 file system for distribution of appbundles, which currently requries playing around with the
total_sectors
parameter ofFormatVolumeOptions
.The text was updated successfully, but these errors were encountered: