File getting 10x bigger without explanation

Hello and sorry if the title is a bit vague but let me explain.

Today i downloaded IRIX UNIX on freebsd for virtualization reasons.
the file was 645MB. However when i tried copying it to usb it errored out. Then i just force umounted and tried again and this time it succeded.
However i noticed that the .ISO IRIX file was 15.somethingGB. I was really confused and don't have a clue why this could have happened.
I redownloaded it and moved it to the usb this time with success and file size remaining exactly the same.
I don't understand how a .iso file can get this big from just trying to copy to a usb and not touching/mounting it.
 
It would help considerably if you identified the name and source of the file you downloaded, and the exact processes you used.

In general, on Unix-like systems, files are permitted to be sparse. Meaning that a continuous string of binary zeros, sufficient to occupy at least one "disk block" does not have to be written to disk, or occupy the space normally required. Pointers held in the metadata are sufficient to define the sparse region. When a file expands on being copied, the usual reason is that the original was sparse, and the copy is not.

You can create a sparse file with this pseudo code:
  1. open a new file;
  2. write one byte;
  3. seek to 1 gigabyte;
  4. write another byte;
  5. close the file.
The file created will occupy two data blocks (or frags), plus the metadata (which is not normally counted in the size of the file) yet it will show up as being ~1GiB on disk using utilities like ls(1).

When you read such a file, the kernel will manufacture data blocks full of binary zeros to deliver the contents of the sparse region.

The easiest simple way I know of to copy a sparse file (or to create one, where possible) is to install the sysutils/coreutils package and use gcp --sparse=always.
 
Back
Top