---
title: "Copying data from one dedicated server to another using rsync"
description: "As part of a migration or backup process, you may find that you need to copy the data stored on one dedicated server and move it to another."
url: https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/copying-data-from-one-dedicated-server-another-using-rsync
lang: en
---
> For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt.

# Copying data from one dedicated server to another using rsync

As part of a migration or backup process, you may find that you need to copy the data stored on one dedicated server and move it to another.

Distributed under the GNU GPL license, rysnc (short for “remote synchronization”) is a free file syncing software program that can perform unidirectional synchronization, i.e., copying files from a source server to a target server.

**Warning:**

**NOTE:** OVHcloud provides services for which you are responsible for their configuration and management. You are therefore responsible for their proper functioning.\
\
This tutorial is designed to help you as much as possible with common tasks. If you are having difficulty performing these actions, please contact a specialized service provider. OVHcloud cannot provide you with technical support in this regard.

 

## Requirements

**What you need to know:**

- Knowledge of Linux administration
- Knowledge of how to install new packets
- SSH access

**What you need to have:**

- At least two OVHcloud dedicated servers working with a GNU/Linux distribution
- _Root_ access to the source server
- _SSH_ access to the target server

 

## Instructions

### Step 1: Install rsync.

The source server used for this tutorial has Debian 9.4 installed. This distribution has rsync natively in its repositories, so it does not need to be added, and rsync can be installed directly.

To do this, log in via SSH as a superuser (or root user) on your source server, then install rsync via the following command:

```
apt-get update && apt-get install rsync
```

 

### Step 2: Launch the transfer.

#### If you do not want to exclude any folders in your copy

With rsync, you can copy all of the folders, sub-folders, and files included in the path entered, and move them to another server.

To do this, the general structure of the command used in this tutorial will be: `rsync -av source/ destination/`.

Since rsync uses SSH protocol to connect to the target server, you will need to add the required login details. The structure of the command will be as follows: `rsync -av *YourLocalFolder*/ login@server:/*DestinationFolder*/`

Also, if you have changed the SSH port and it is not set to port 22, you will need to specify the port number to use to establish the SSH connection by adding `-e 'ssh -p X'` to your order. **Please note that ‘X’ should be replaced with the SSH port number to be used.**

Then you will need to run the following command to copy your data from one server to another via rsync:

```
rsync -av -e 'ssh -p X' YourLocalFolder/ login@server:/DestinationFolder/
```

**Note:**

By default, there are no indicators that can accurately monitor the progress of the copy. To track progress easily (with detailed statistics, expression in MB, GB, etc.) and get real-time tracking of the transfer progress, we recommend adding the following argument to the command: `-P --stats --human-readable`. This means it will look like this:

`sh rsync -av -P --stats --human-readable -e 'ssh -p X' YourLocalFolder/ login@server:/DestinationFolder/`

 

#### If you want to exclude one or more folders in your copy

If rsync can be used to transfer all of the folders from a server, you can exclude certain folders or sub-folders from the copy that you are getting ready to create. If you would like to do this, list the folders, sub-folders, and their names on your server.

And generally, we recommend excluding the transfer of temporary caches and system files from the source server to avoid any conflict on the target server.

Here is a non-exhaustive list of some of the folders that can contain temporary caches and system files on a server with a GNU/Linux distribution:

- /dev/\*
- /proc/\*
- /sys/\*
- /tmp/\*
- /run/\*
- /media/\*
- /lost+found

Once you have finished listing the files you want to exclude, use the `--exclude` argument for rsync to ignore these files during the copy.

This argument can be repeated as many times as there are folders and sub-folders to exclude, and is added to the end of the command. The general structure of a command like this is: `rsync --exclude="Folder_Name" --exclude="Other_Folder_name" source/ destination/`

**Note:**

Please note that the folder location must be expressed in its relative location because rsync does not take absolute paths into account. So if one of the folders to exclude is located in ‘/home/user/test’, and you are currently in ‘/test’, simply add ‘--exclude="test"’ (relative path), rather than ‘--exclude="/home/user/test"’ (absolute path).

By taking into account the elements that are already exposed, the transfer command will be as follows:

```
rsync -av -P --stats --human-readable -e 'ssh -p X' --exclude="Folder_Name" --exclude="Other_Folder_name" YourLocalFolder/ login@server:/DestinationFolder/
```

 

## Go further

Browse all the [Dedicated Servers guides](https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/landing-page-dedicated-servers.md).

Browse the rest of the [OVHcloud US documentation](https://docs.us.ovhcloud.com/en/index.md) for guides on our other products and services.

Learn more about [Dedicated Servers](https://us.ovhcloud.com/bare-metal/) on the OVHcloud US website.
