Moving from another provider, or from your App Hosting service to a dedicated server? Copy the data straight from server to server: it is much faster than downloading everything to your computer and uploading it again. This page shows rsync for servers you can reach over SSH, and lftp for servers that only offer FTP. The commands were tested on Ubuntu 26.04 LTS, with two other servers as the source.


1. Before You Start

  • You need the details of the old server: the address, the user name, the password, and whether it offers SSH/SFTP or only FTP. Your old provider shows them in its panel.
  • Check that your new server has enough free space: df -h (What Fills the Disk and What Loads the Server). On the old server, du -sh folder shows how much there is to copy.
  • Large copies take hours. Start them inside tmux, so that they keep running when you close the SSH window: Keep a Program Running on Linux.

The examples copy into /srv/data on the new server; create it first with mkdir -p /srv/data, or use any other folder.

2. From a Server With SSH: rsync

rsync is already installed on Ubuntu. Run it on the new server; it fetches the files from the old one:

rsync -ah --partial --info=progress2 user@old.example.com:movies/ /srv/data/movies/
  • user@old.example.com: your user name and the address of the old server.
  • movies/: the folder on the old server, from your home folder there; a path starting with / is a full path. The slash at the end copies the contents of the folder into /srv/data/movies/.
  • -a keeps dates and permissions, -h shows sizes in MB and GB, --info=progress2 shows the progress of the whole copy.

At the first connection, SSH asks whether you trust the old server: type yes. Then enter the password of the old server. If it uses another SSH port than 22, add -e "ssh -p 2222" with the right port.

Stopped in the Middle? Run It Again

If the copy stops, run exactly the same command again. rsync skips the files that are already complete and, thanks to --partial, continues a file that was cut off. For example, when a copy of 94 MB stops at 31 %, the second run reuses the 34 MB that have arrived and copies only the rest.

Check the Copy

This compares every file by its content, without copying anything (-n):

rsync -ahn --checksum --itemize-changes user@old.example.com:movies/ /srv/data/movies/

If it prints no file names, the copy is complete and identical. On large data this takes a while, because both servers read all files.

Owner of the Copied Files

When you run rsync as root, the files keep the owner of the old server, shown as a number such as 1001 in ls -l. Give them to your user on the new server, for example alex:

chown -R alex:alex /srv/data/movies

To leave bandwidth for other programs, limit the speed, for example to 20 MB/s: --bwlimit=20m.

3. From a Server With FTP Only: lftp

If the old server offers only FTP, use lftp. Install it on the new server:

apt install lftp

Connect; lftp asks for the password:

lftp -u user ftp://old.example.com

At the lftp prompt, copy a whole folder with four files at a time, then leave:

mirror --parallel=4 movies /srv/data/movies
quit

mirror recreates all subfolders. Run it again after an interruption: it copies only what is missing or changed, and nothing when the copy is complete. The same works over SFTP: connect with sftp://old.example.com instead of ftp://.

4. After the Copy

  • Compare the size on both servers: du -sh /srv/data/movies here and du -sh movies on the old server. They can differ slightly between file systems; the number of files should match: find /srv/data/movies -type f | wc -l.
  • Delete the data on the old server or cancel it only when you have checked the copy.
  • Coming from a torrent client? Copy the data first, then add the torrents on the new server with the same folder, so that the client checks the files instead of downloading them again.

Related Guides

View all Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)