?
Solved

How to move Directories and files between linux systems?

Posted on 2007-12-05
9
Medium Priority
?
1,756 Views
Last Modified: 2013-12-16
Hi,
I am new to Linux administration. I have to transfer a huge directory and its contents from one linux server to another linux manchine. Similar to DOS xcopy command. Please be gentle with me by guiding step by step..;) having a little search i could see many suggestions like SCP, SFTP etc..Dont know whats the common and fast solution to accomplish this.

Thanks for your help
0
Comment
Question by:Basheerpt
  • 4
  • 3
  • 2
9 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 20417775
Depends on if you want to preserve all the ownership/group and permissions.  If not, then a simple

scp -rp /path/to/dir user@remoteserver:/some/path

will work, otherwise you can use rsync, eg:

rsync -e ssh -av /path/to/dir user@remoteserver:/some/path

or

tar cf - /path/to/dir | ssh user@remoteserver "tar xvf -"
0
 
LVL 5

Author Comment

by:Basheerpt
ID: 20417793
Thanks, before i give it a try, pls clarify..

Will the first two commands copy all the contents of the floder and preserve folder structures? (including empty)
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20417845
All three commands will copy everything under the folder (including sub-folders, files etc).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:Basheerpt
ID: 20417908
Thanks, I tried the first command to a mounted volume in the target system. Its almost 400 Gb is free there. But, When i try to copy an 80 Gb here, the files started copying after some time gives the error not enough space!

Is there anything have i to do to overcome this?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20417948
Hi,

If you have FTP open between the two m/cs you may use:

wget -r -nH ftp://username:userpassword@remotehostname/dir

The above command to pull files

This is faster in transferring files since it does not involve encryption
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20417999
Please post the exact scp command you used and the output of

df  -h

on the remote system.
0
 
LVL 5

Author Comment

by:Basheerpt
ID: 20418067
df -h
File system                  size                 used              avail            used %           mounted on
/dev/sda5                     20G                  20G                  0                 100                      /
none                             16G                     0                  16G                0                   /dev/shm
/dev/sda8                    480G                 105M              456G              1%                /u01

The command I executed from the source machine:
scp -rp /u01/sourcedir root@192.168.1.2:/u01/destdir

It asked me password in the destination server and it passed. It displayed copying files  after little long, it gives the error. As you can see, my /u01 has plenty of space.

Thanks again
                               
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20418094
Your root file system (/) is full, better to free some logs !
 
0
 
LVL 5

Author Closing Comment

by:Basheerpt
ID: 31678091
When I tried second time, but the same command, it worked perfectly. I used the scp command. But it copied very fast unlike windows! I think i am going to love Linux..;)

Thanks geeks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question