Comparison of several methods for transferring files between Linux Hosts

Source: Internet
Author: User

Comparison of several methods for transferring files between Linux Hosts

1. scp Transmission

Scp-r/data/file root @ ip:/data/
Scp-C/data/sda. img root @ ip:/data/img/
#-R: Directory supported
#-C: Enable compressed Transfer

The scp transmission speed is slow, but the ssh channel ensures the transmission security.

Configure scp to transfer files between Linux and Unix without a password

Cp/scp command + scp command in Linux

CentOS cannot use scp command Solution

Copy files between two Linux Hosts using scp

2. rsync differential transmission (supports resumable data transfer and Data Synchronization)

Rsync-av/backup/-e ssh [email protected]:/bak
#-A: archive mode, indicating that the file is transmitted recursively, and all file attributes and links are kept, equal to-rlptgoD.

Rsync -- remote sync. Rsync is a file synchronization and data transmission tool in Linux. It uses the "rsync" algorithm to synchronize files between a client and a remote file server, you can also back up data from one partition to another in the local system. If data transmission is interrupted during the backup process, you can continue to transfer the inconsistent parts after recovery. Rsync supports full or Incremental backup. Its main features include:
1. images can be used to save the entire directory tree and file system;
2. It is easy to maintain the permissions, time, and soft links of the original file. The installation can be completed without special permissions;
3. data can be incrementally synchronized, and the file transmission efficiency is high, so the synchronization time is short;
4. You can use rcp, ssh, and other methods to transmit files. Of course, you can also use a direct socket connection;
5. Anonymous transmission is supported to facilitate website images;
6. Encrypted data transmission ensures data security;

Rsync for file backup Synchronization

Rsync synchronizes two servers

Remote synchronization of Rsync in CentOS 6.5

Use Rsync in Ubuntu Linux for data backup and Synchronization

Linux uses the Rsync client to synchronize directories with the server for backup

3. Pipeline transmission (reducing IO overhead)

Gzip-c sda. img | ssh [email protected] "gunzip-c->/image/sda. img"
# Use gzip for sda. img compression. The-c parameter indicates the output to stdout, that is, it is transmitted through the pipeline.
# "-" In gunzip-c-Indicates receiving sdtin transmitted from the pipeline

4. nc transmission (data stream redirection in a Network)

What nc does is to establish a tcp or udp link between two computers and transmit data streams between the two ports. It is a network-based data stream redirection.

# Using dd and nc commands to clone Disk Partitions
Host:
Dd if =/dev/vda | gzip-c | nc-l 50522
Waiting for recovery:
Nc 192.168.215.63 50522 | gzip-dc | dd of =/dev/sda

# Run the dd command to clone the/dev/vda disk and use gzip compression to redirect the data stream to port 50522 of the Local Machine. Use nc to connect to port 50522 of the host, then, you can receive the BIT data stream at Port 50522 of the host, decompress it using gzip, and restore it to the/dev/sda disk.

# The dd command reads the disk sector. Therefore, no matter the disk file system, partition table, or disk MBR information, dd can be copied. You can use the bs and count parameters to control the size of the disk to be cloned.
# For example, dd bs = 512 count = 1 if =/dev/vda of = mbr. img only copies KB of data in the first sector of the disk vda (Pilot Program and partition table)

5. Create a file server

In addition to the preceding centralized file transfer method, you can also use the resume file server and then mount the file through the network. This method is suitable for regular copying. The following is an example of mounting an ftp server.

Mount an ftp server
Yum install curlftpfs
Mkdir/data/ftp
Curlftpfs username: [email protected]/data/ftp

This article permanently updates the link address:

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.