Kim Lux wrote:
I do the followin in such situations: Create a folder on the destination disk. Then , the following command should do the trick when run in the destination machineThe hard drive is full on our server. I can ssh into it from my workstation. I've got a formatted drive mounted on my workstation ready to receive the server files.
How do I easily copy the server files to the workstation drive over our network ? Keep in mind that I need to preserve the file ownership, permissions and dates.
If I had the new hard drive mounted on the server, I would use:
cp -aR /olddrive /newdrive >> logfile
I've tried using scp, but I cannot force it to preserve the file
attributes.
rsync -avz -e ssh login@remote_machine:/remote_directory/ /local_directory/ |tee logfile
Before doing anything for real , I suggest you add the --dry-run parameter... I did the stupid thing of forgetting that parameter the other day and had to recover my home directory from backup :p
For recursive scp , you can use -p to preserve modes and atime and -r to work recursively. But I strongly suggest rsync , since -a uses -rlptgoD , which means:
recursive , copy symlinks as symlinks , preserve permitions , times , group , owner and devices. I've used that same command a few times to move services between machines and no user ever complained about wrong permissions or errors like permission denied on the webserver...
-- Pedro Macedo