FreeBSD and sparse files

Skud

Gawd
Joined
Sep 4, 2002
Messages
587
I'm not sure if this belongs here, but...

Does anyone know of a way to properly copy thin-provisioned (sparse?) iSCSI file extents in FreeNAS 8.3/FreeBSD?

I have a 6TB thin-provisioned file extent inside a ZFS file system along with a number of other extents. I'd like to move the 6TB extent into its own ZFS file system so I can apply different replication and snapshot rules to it.

My issue lies in copying the extent. Currently, there is about 3.4TB/6TB used, however I can't find a reliable way to copy the extent and maintain the thin-provisioned state (sparseness?). Apparently, FreeBSD's version of cp doesn't handle sparse files (unlike GNU cp) and the resulting copy takes up a full 6TB of disk space. I've tried:

- cp, but sparse files are not supported in FreeBSD.
- dd with "conv=sparse". Same results as cp.
- rsync with the "--sparse" option, but it's so slow (less than 5MB/s locally).

If I have to, I'll move the data to another machine and back, but I'd like to do this locally as it will be faster.

Thanks!!
Riley
 
It's possible - I think. Do you know what the implications would be?

It looks like it's available in the coreutils package, but I don't want to mess up my FreeNAS box as it's running some important tasks at the moment.

Riley
 
the implications are nothing.

all of the commands are installed like gcp or something to avoid conflicts.
 
I've used gcp numerous times ...
...
# /usr/ports/distfiles
for f in $(find . -type f -name "*.zip" ); do (gcp -Rvu "$f" /thumbdrive/ports/distfiles && sleep 1 ); done
...
I found the -Rvu to be less disk-intensive than other copying methods for some reason, and achieves
the same result (does not copy files without reason...)
 
Seems to be working fine.. I did:

"mount -uw /" (to remount the root file system read-write)
"pkg_add -r coreutils" (to install the package, there were a few errors, but they looked harmless enough"

Afterwards, I tried to remount the root read-only, but it was continually in use. I ended up rebooting the machine anyway as I think that was the easiest and quickest way to resolve that issue.

We'll see if it works. It's moving along pretty fast (about 180MB/s). I used "gcp -v --sparse=always source dest", so we'll see how it works out.

Thanks!!
Riley
 
Follow up:

Well, it appears gcp worked. The resulting file is 6TB is size, but only 3.4TB are allocated.

Riley
 
Back
Top