Fixing scp –stalled– problem

networkstallHave you ever been trying to move a file especially a large file from one host to another and  the connection stalls, this is because scp is trying to get as much bandwidth as it can and it stalls somewhere, the fix to this is to limit the amount of bandwidth scp should use.

[user2@host2 ]$ scp -r user1@host1:/var/tmp/file1.tar.gz .
Are you sure you want to continue connecting (yes/no)? yes
user1@host1’s password:
file1.tar.gz  0% 2704KB 0.0KB/s – stalled –

Step 1:

Check for interface errors on both sides of the connection, if you have error it is most likely a duplex problem in my case i didn’t have interface errors

[user1@host1]$ netstat -in
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 243123485 0 0 0 226542235 0 0 0 BMRU
lo 16436 0 2693502 0 0 0 2693502 0 0 0 LRU
[user1@host1]$

[user2@host2 ~]$ netstat -in

Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 2973515 0 0 0 3237434 0 0 0 BMRU
lo 16436 0 1968844 0 0 0 1968844 0 0 0 LRU
[user2@host2 ~]$

step2

Re-initate scp with a fixed bandwidth limit using the -l option in scp

[user2@host2]$ scp -l 81920 -r user1@host1:/var/tmp/file1.tar.gz .

Are you sure you want to continue connecting (yes/no)? yes
user1@host1’s password:

file1.tar.gz 10% 1313MB 9.7MB/s 19:33 ETA

And it is done!

Simon Peter

@clarsp

ugrocks!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s