raw file issue

tincboy

Renowned Member
Apr 13, 2010
466
6
83
While I'm trying to download a raw files which was copied from a KVM VM, to my other server in same data center I can see that a raw file with size of 2 GB become a useless file with 26 GB size in the second server.
Any suggestion about fixing this issue?
 
While I'm trying to download a raw files which was copied from a KVM VM, to my other server in same data center I can see that a raw file with size of 2 GB become a useless file with 26 GB size in the second server.

What? I do not understand that question.
 
sorry for my bad explanation.
When I transfer a RAW file from server A to server B ( via sftp ) the RAW file size changes ( from 2 GB to 26 GB ) and the file seems to be corrupted.
Don't you have any similar experience?
 
sorry for my bad explanation.
When I transfer a RAW file from server A to server B ( via sftp ) the RAW file size changes ( from 2 GB to 26 GB ) and the file seems to be corrupted.

Then your sftp is broken. What command do you use exactly (why don't you use 'scp' ?)
 
I've the same issue with SCP, please consider that the RAW file size was 25 GB when I've build it with Proxmox but while I use "ls -hs" it shows only 2 GB is used and after transfering it to the other server the "ls -hs" show about 26 GB.
 
RAW files are sparse files. You'll need to use 'tar' in the process to handle the sparse file. To copy my Fedora 14 virtual machine out of the /virt directory on system 'remoteserver' to the /virt directory on my local server, I'd do this:

ssh remoteserver tar -czSf - /virt/fedora14 | ( cd /virt ; tar --strip-components=1 -xzf - )

Leave off the 'z' if on a LAN, since gzip compression will bring even a Core I7 to its knees and thus is only useful if you're trying to shove the data through a tiny DSL pipe.

If you try to read sparse files using just plain 'cat', as 'scp' does, the sparse sectors will read as all-zeros. Using the -S option when creating a tar file tells GNU Tar to treat all-zero sectors as sparse sectors, which will not get put into the archive and which will not get written when you untar the file (instead they will get seeked over to make it a sparse file).
 
You are talking about sparse files? If so, try

# rsync -a --sparse local-file remote-host:remote-file