Add flag for sparse copying of files
Submitted by Isak Savo
Link to original bug (#530094)
Description
NOTE: I'm on ubuntu 8.04, gnome 2.22 so I assume nautilus is using GIO.
When nautilus (or rather, the underlying mechanism - gio/gnomevfs) is copying a sparse file (http://en.wikipedia.org/wiki/Sparse_file), the resulting copy will be as large as the file size of the original file - even if the original file didn't actually use all those blocks. (confusing I know, but see below what I mean :)
This makes the copy procedure unneccessary long if the diff between allocated block size and file size is big.
At least Azureus uses sparse files while downloading torrents. But wikipedia suggests its also commonly used for databases, log files and scientific apps.
For an almost empty file (few blocks allocated, ~a few kb) with a size of 350MB the difference is quite noticable: $ time cp my-sparse-file my-copy real 0m0.930s user 0m0.112s sys 0m0.764s $ time gnomevfs-copy my-sparse-file my-copy-2 real 0m6.874s user 0m0.148s sys 0m2.712s
Procedure to reproduce: $ cd /tmp $ dd if=/dev/zero of=my-sparse-file count=1 bs=1 seek=1M $ ls -lsh my-sparse-file 8,0K -rw-r--r-- 1 isak isak 1,1M 2008-04-26 19:23 my-sparse-file $ cp my-sparse-file copy-using-cp $ (do copy in nautilus or using: gnomevfs-copy my-sparse-file copy-using-nautilus) $ ls -lsh total 1,1M 0 -rw-r--r-- 1 isak isak 1,1M 2008-04-26 19:33 copy-using-cp 1,1M -rw-r--r-- 1 isak isak 1,1M 2008-04-26 19:33 copy-using-nautilus 8,0K -rw-r--r-- 1 isak isak 1,1M 2008-04-26 19:23 my-sparse-file
Version: 2.15.x