You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stat returns the file size in bytes, whereas fdisk wants sectors. You have the debug line in there to multiply by 2 on line 122, so that with the truncation on line 116 (division by 1000), the effect is a division by 500.
So, we're assuming the flash drive target uses 512 byte sectors, and it all works out, but if you want to clean it up and make the code more transparent to a reader, those 8 lines could be replaced by something like:
# get iso size, pad by 10%, and convert to 512B sectors
isoSize=$(stat -c%s "$isofn")# in bytes
isoSize=$(($isoSize*110/100/512))echo$isoSize
The text was updated successfully, but these errors were encountered:
About the isoSize calculation: lines 114 to 122.
stat
returns the file size in bytes, whereasfdisk
wants sectors. You have the debug line in there to multiply by 2 on line 122, so that with the truncation on line 116 (division by 1000), the effect is a division by 500.So, we're assuming the flash drive target uses 512 byte sectors, and it all works out, but if you want to clean it up and make the code more transparent to a reader, those 8 lines could be replaced by something like:
The text was updated successfully, but these errors were encountered: