Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howtos:general_admin:files_filesystem_copying_over_network [2013/02/10 14:22 (UTC)]
wisedraco [Copy whole filesystem]
howtos:general_admin:files_filesystem_copying_over_network [2013/02/10 17:00 (UTC)] (current)
sycamorex [Copy Files / Directories]
Line 1: Line 1:
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
 ====== How to copy files \ directories ​ \ filesystems via network. ====== ====== How to copy files \ directories ​ \ filesystems via network. ======
-That small article ​give a view of content ​copying task via network.\\  +The article ​describes ways of copying ​content ​over network. ​
-I want do this on my homeserver upgrade, copy all info from working "​old"​ server, to "​new"​ server partition, for can make access a data and config files, for bring "​new"​ server in state it looks be similar of "​old"​ one, before switch "​old"​ off, and set "​new"​ instead it.\\  +
-In examples, i work from "​new"​ server CLI, it has IP 192.168.0.14 \\ +
-"​Old"​ server has IP 192.168.0.1,​ both in in one subnet.\\ +
-Both, "​ssh"​ and "​scp"​ commands work via secure shell ( ssh ) protocol, port 22, and must be enabled "​sshd"​ on computer where we connect.+
  
 +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: +====== Copy Files / Directories ====== 
-  ​* ​ -r key do recursive , copy all data in "/​etc"​ folder and all its subfolders. +If you need to copy single files or directoriesyou can use the ''​scp''​ command:\\ 
-  *  -p key preserve file attributeslike 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).\\ +<​code>​ 
 +scp -r -v -p root@192.168.0.1:/etc /​local_dir 
 +</​code>​ 
 + 
 +Flag explanation:​ 
 +  *  -r: recursive ​(copy all the content of ''/​etc''​ including its subdirectories) 
 +  *  -p: preserve file attributes (egfile creation or modification times) 
 +  *  -v: verbose output
  
-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.\\ +In the example above we copy the ''/​etc''​ directory located on a remote host (the old server: 192.168.0.1to ''​/local_dir''​ on the local host ("new" ​server)
  
-Thanks to Patrick"​Volkerdi"​ gives us workaround ​for that situation:+Please note that the ''​scp''​ command cannot copy the whole file system hierarchy including ''/​proc''​''/​dev''​ or ''/​lost+found''​. Fortunately,​ there is a workaround ​which was [[http://​www.linuxquestions.org/​questions/​slackware-14/​copy-whole-filesystem-via-scp-4175449321/#​post4887869|provided]] by Patrick Volkerding.
  
-====== Copy whole filesystem ======+====== Copy whole filesystem ​hierarchy ​======
  
-command ​+The following ​command ​should successfully copy a whole filesystem hierarchy: ​
 <code bash> <code bash>
-ssh root@192.168.0.1 "(cd / ; tar cf - . )" | (mkdir -p /From_Old_Server ​; cd /From_Old_Server ​; umask 000 ; tar xvf -)+ssh root@192.168.0.1 "(cd / ; tar cf - . )" | (mkdir -p /local_dir ​; cd /local_dir ​; umask 000 ; tar xvf -)
 </​code>​ </​code>​
  
-help us transfer full filesystems without stuck and pain from "​old"​ to "​new"​ computer. 
  
  
Line 44: Line 45:
 <!-- * Originally written by [[wiki:​user:​xxx | User X]] --> <!-- * Originally written by [[wiki:​user:​xxx | User X]] -->
 <!-- * Contributions by [[wiki:​user:​yyy | User Y]] --> <!-- * Contributions by [[wiki:​user:​yyy | User Y]] -->
- * Originally written by [[wiki:​user:​wisedraco|John Ciemgals]] 2013/02/10 03:51 \\ +  ​* Originally written by [[wiki:​user:​wisedraco|John Ciemgals]] 2013/02/10 03:51 \\ 
- * With help from Patrick Volkerding+  * With help from Patrick Volkerding
  
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 <!-- You must remove the tag-word "​template"​ below before saving your new page --> <!-- You must remove the tag-word "​template"​ below before saving your new page -->
-{{tag>​howtos ​template}}+{{tag>​howtos ​copy ssh}}

In Other Languages
QR Code
QR Code howtos:general_admin:files_filesystem_copying_over_network (generated for current page)