BIO_DELETE equivalent for file on FFS filesystem

Pieter de Goeje pieter at degoeje.nl
Sat Jun 16 13:07:15 UTC 2012


On Thursday 14 June 2012 06:48:14 Wojciech Puchar wrote:
> >> file to take 900MB or... can i call some system function to "punch"
> >> holes?
> > 
> > I think you can only truncate the file at this time, pretty much like
> > brk() works for memory.
> 
> BAD. suppose i keep windoze VM image on filesystem which takes 10GB but
> uses 5GB.
> 
> i could write simple program to find out what blocks are unused and
> then...do nothing.

Actually you can. Use dd if=infile of=outfile conv=sparse to convert a file to a 
sparse file. This obviously only works on filesystems supporting sparse files, 
such as UFS.

Regards,
Pieter


More information about the freebsd-hackers mailing list