SCP Large File Shell migration

Source: Internet
Author: User
Tags disk usage scp command

In general, we are the most common command for copying data on the same server is CP, which can be used if you want to copy between different servers.

Now there are two servers, you need to migrate the files on the a server to B server, because the file is too large to open the shell, we need to run the SCP background, if we directly after the SCP command to add &, close the Shell session window, the copy will be back to stop, There are different ways to get the SCP to run in the background.

My first idea is to configure a-free login to B, after the SCP to join the & implementation, found that this does not work, after shutting down the terminal, the SCP will stop

Scp-r/data/fileupload/30.0.218.1:/upload & Found no way

When you think of the shell script

And then execute

# Nohup Bash scp.sh &

Then close the shell session window, reopen it, and a session window to discover that the SCP process is still

Use Df-h to view disk usage and find an increase in

One of the problems encountered:

Symptom: When using SSH [email protected] command to connect to the server, there are sometimes error prompts: Write Failed:broken pipe problem Cause: The remote server network connection instability causes this session to be interrupted, The simple way is to use SSH to try a few more solutions: 1, Client settings: ~/.ssh/folder add config file, and add the following configuration: Serveraliveinterval 602, the server/etc/ssh/sshd_config Add the following configuration: Clientaliveinterval 603, add parameters in the login command: ssh-o serveraliveinterval=60 [email protected] (usually one or two times on the login).

Two

When using NFS sharing, uninstall discovery

Umount.nfs:/mydata:device is busy

[Email protected]/]# umount/data/
Umount.nfs:/mydata:device is busy
To view the occupancy process number:
[Email protected]/]# fuser-m-v/data/
User Process number Permission command
/mydata/: Root 41331
www 41223.. C.. su
Kill the process above, then delete the mount.
[Email protected]/]# kill-9 41331 41223
[Email protected]/]# Umount/data
[Email protected]/]#

Another forced Unload method

# umount-l/data

Comments:

The-m parameter indicates that the specified path is a mount point showing all processes using the specified file system, followed by a mount point, and the-v parameter gives verbose output

Use the following command to kill all processes that occupy the directory/DSG:

$ fuser-m–k/data

So umount:/data:device is busy this problem can be solved.

Fuser can also be used to find out which processes are using the specified port (network port).

Fuser Common Scenarios

Fuser is usually used in the "resource busy" problem of the diagnostic system, usually when you want to umount the specified mount point. If you want to kill all processes that are using a specified file system or sockets, you can use-k option.

# Fuser–k/path/to/your/filename

The fuser will then send Sigkill to the process that is using/path/to/your/filename. If you want to be prompted before sending, you can use the-i option.

# Fuser–k–i/path/to/your/filename

SCP Large File Shell migration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.