Welcome to the Slackware Documentation Project

This is an old revision of the document!


How to copy files \ directories \ filesystems via network.

The article describes ways of copying content over network.

When upgrading a home server, I copy all the data from the old server to a new system. In the examples below, I work from the new server and both servers are on the same subnet:

  • New server (IP: 192.168.0.14)
  • Old server (IP: 192.168.0.1)

Both the ssh and scp commands communicate over a secure connection (TCP port 22). Please note that you need to enable the sshd daemon on the remote host.

Files \ single folder copying

If you need a copy of standalone files or folders, you can use an scp util:

scp -r -v -p root@192.168.0.1:/etc /From_Old_Server

There:

  • -r key do recursive , copy all data in “/etc” folder and all its subfolders.
  • -p key preserve file attributes, like a creation, modification times.
  • -v gives us verbose output.

In there example we copy “/etc” folder from 192.168.0.1 computer ( actually, “Old” server), to folder “/From_Old_Server” in local computer ( “new” server).

Sadly, but that command ( scp ) cannot copy whole system disk, contains “/proc”, “/dev” and even “/lost+found” catalog, who is it in every mounted extX filesystem partition - at that places “scp” stuck and stops.

Thanks to Patrick, “Volkerdi” gives us workaround for that situation:

Copy whole filesystem

command

ssh root@192.168.0.1 "(cd / ; tar cf - . )" | (mkdir -p /From_Old_Server ; cd /From_Old_Server ; umask 000 ; tar xvf -)

help us transfer full filesystems without stuck and pain from “old” to “new” computer.

Sources

  • Originally written by John Ciemgals 2013/02/10 03:51
  • With help from Patrick Volkerding


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:general_admin:files_filesystem_copying_over_network (generated for current page)