Solved

How to move Directories and files between linux systems?

Posted on 2007-12-05
9
1,742 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 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
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…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now