improve the truncating and expanding of files and add
_FILE_OFFSET_BITS=64 for 32-bit systems