Copying/Moving Sparse (thin provisioned) files

Status
Not open for further replies.

Skud

Dabbler
Joined
Mar 26, 2013
Messages
15
Hi All!

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
 
J

jpaetzel

Guest
jpaetzel@roadrash /home/jpaetzel ->dd if=/dev/zero of=2 seek=1000 count=1 bs=1m
1+0 records in
1+0 records out
1048576 bytes transferred in 0.017854 secs (58730674 bytes/sec)
jpaetzel@roadrash /home/jpaetzel ->ls -lah 2
-rw-r--r-- 1 jpaetzel jpaetzel 1G Mar 27 20:00 2
jpaetzel@roadrash /home/jpaetzel ->du -sh 2
1.0M 2
jpaetzel@roadrash /home/jpaetzel ->dd if=2 of=3 conv=sparse
load: 0.45 cmd: dd 10119 [running] 22.84r 0.38u 22.45s 94% 1620k
750858+0 records in
750858+0 records out
384439296 bytes transferred in 22.825777 secs (16842331 bytes/sec)
2050048+0 records in
2050048+0 records out
1049624576 bytes transferred in 60.754868 secs (17276386 bytes/sec)
jpaetzel@roadrash /home/jpaetzel ->ls -lah 3
-rw-r--r-- 1 jpaetzel jpaetzel 1G Mar 27 20:01 3
jpaetzel@roadrash /home/jpaetzel ->du -sh 3
132k 3

At first blush it appears that dd works. I'll do more testing.
 

Skud

Dabbler
Joined
Mar 26, 2013
Messages
15
I had high hopes for dd as well, unfortunately, it didn't stop until it filled up my pool. I have roughly 5.7TB free which is plenty of space to copy the 3.4/6TB sparse file and delete the original.

I've since installed coreutils which will give me the GNU version of cp. It seems to have worked just fine and the resulting file shows 6TB in size, but only 3.4TB allocated.

Thanks!!
Riley
 
Status
Not open for further replies.
Top