If I have a sparse file representing a block device, then how can I efficiently restore the file over a network? Ideally, I'd use rsync -S host:file /dev/sdb, but rsync won't write to block devices. I am using ssh host dd if=file | dd of=/dev/sdb, but that's not efficient as the zero bytes will come over the network and be written to the device. Can I use tar -S or cp --sparse=always somehow? Can I do this without storing the file locally (even temporarily)? Can sshfs recognise sparse files?
|
|
|||
|
|
migrated from serverfault.com Aug 3 '12 at 12:57
|
I haven't tested it, but there is a |
|||
|
|
|
You can install the iSCSI Enterprise Target software and setup an iSCSI LUN from the sparse-file like so: In /etc/iet/ietd.conf:
Then initiate the target from the host you need to restore on. Since the target will show as a local device (eg. /dev/sdd), you can |
|||
|
Have you tried compressing/decompressing the data in flight? Batches of zeroes should compress well. Actually, having thought about it again, it's very simple. On the remote host, create a pipe with Tested on my installation and it does produce a sparse file on output. Thanks for a nice question! |
||||
|
|