Solved

How to move Directories and files between linux systems?

Posted on 2007-12-05
9
1,750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 125 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

724 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