file size changed after SCP

Hi All,

I am having a scriptin that the SCP command is performed . The scp is transfering one file from one location to other.

But after SCP i see the file size is changed from original size . What might be the reason.

Thanks in advance,
Arunkumar

scp won't modify file content, like adding headers for example. Double check file sizes on both sides, and run md5sum check against both files.

I am having the status file which shows the size of source file . But he actual source file is removed .

I am not able to compare these two files :confused:

if transmitted in ascii mode, then it may be the conversion of end-of-line characters from one type system to another.

if transmitted in binary, should be the same size.

Well transmit another file, preferably something with a checksum before and after. This should not be happening, its like world crumbling bad news.

Not too much info here. :stuck_out_tongue: We need to know how big the source file was and how big the destination files was. And we need to know exactly how you obtained what you think is the file size. I think the most probable answer is that you have a bug your script. Even if your script transfered the file correctly, deleting the source file and then checking to see if the destination file is ok seems backwards.

If the file sizes really are different, I would expect the destination file to be smaller. This would mean that the transfer did not complete and would probably be caused by one of the boxes involved in the transfer rebooting or something like that. Or maybe you ran out of disk space. Stuff like this is the only way I have scp partially transfer a file but ultimately fail.

Also, files have two sizes: how much data is stored and how much disk space was used to store it. Minor changes in the second metric can be caused by using differing file systems. A one byte file could consume 4k of disk space on one box but only 1k of disk space on another. This does not indicate a problem in the transfer. This is why we need to know what numbers you are comparing.

Thanks all ..

Please find the information below

*) I am transfering the file from UNIX to LINUX

This is the output of BDF command when i run it . SO it is having more space

lnx102:sndus:load>) bdf .
Filesystem 1K-blocks Used Available Use% Mounted on
10.8.7.20:/vol/prod/sf_buffer
1258291200 6111328 1252179872 1% /sf/buffer

The size of source file that i am trying to transfer is
164283776 in unix

The file that trasfered to linux is with size
11928673

I found the wc -l of the transfered file and the total line transfered is 187311
lines .
I have taken the 187311 from source file and comapred the lined all are one and same but the file is not transfered completely .

What might be the possible reason ?..

Thanks,
Arun

So you're trying to transfer a file about 156 MB but only 11MB or so made it over. I have not seen a bdf command on Linux, I hope you are showing the disk space on the destination file system. I suspect that bdf was run on HP-UX. Could you just do a simple cp and let NFS transfer the file?

But as to what could cause your problem... maybe someone killed your process on one of the systems. Maybe a network problem happened. It's pretty much got to be one of those.

If NFS is not an option, maybe you could split the file in chunks and reassemble the chunks after the transfer. "split" can split and "cat" can reassemble.

Thanks perebrabo...

So can i take like this ,In SCP we cannot transfer a large files ?.. If not, is there is any command that can do a transfer of large files ?...

ftp will transfer files up to the limit imposed by the filesystems on both ends of the transaction. Normally you can expect up to 4GB will be okay.

EXACTLY how are you getting file sizes? Run q uuick test. Use ls -l on the source file before you copy. use ls -l on the destination file. bdf is NOT the same as ls -l.
You can also use a cksum.

Did you check to be sure the filesystem you were copying to had enough space for the new file?

Thank you ..
Yes i am using ls -l to find the size of the file . The checksum is also different . Ya i do check the space in the system . It has enough spaces .

156 MB is not an issue for scp, I've been dealing with 150-200 GB recently. So, since the checksum is different, it means that during the transmission, file gets filled with something, i.e. file size grows, is that right ? I'd think of network issue, or SSH protocol mismatch. Try sftp client and see if that solves the issue. Does the underlying network implements / uses MPLS ? I've seen malformed packets of such setup resulting in wrong checksums.
If possible, post the results of commands before and after file transfer, e.g. - "ls -la file-name, md5sum file-name"