1

I used rsync with -av parameter to migrate a website from one server to another. there was no error displayed but the size of the folders are not the same and the website does not work correctly. so something is missing. Is there a parameter who copies really everything ? i have sudo accounts on both sides ofc.

I check folder size with du -s dir , the sizes are the following :

old server : 2554620

new server : 2547676

it's in bytes. How do I manage to have the exact copy?

Wordcount output:

old server :  2663    3105  175534
new server :  2665    3107  175594
RayofCommand
  • 1,451
  • 8
  • 26
  • 36
  • Please post the output of `find /directory/of/stuffs | wc -l` on both servers. I'd like to see an actual file count... – Soviero Aug 16 '13 at 12:22
  • -1 paramenter didn't work. There is my wordcount output using /directory/of/stuffs | wc – RayofCommand Aug 16 '13 at 12:26
  • is it possible that you are using a different file system on the new server? Some file systems store their data more efficient than other file systems do. – Valentin Bajrami Aug 16 '13 at 12:33
  • i am quiet new , how to check that ? old server is ubuntu 10.10 , new one is 12.04 – RayofCommand Aug 16 '13 at 12:35
  • The `wc` command is followed by a lower case "L"... Sorry, monospace should be clearer... – Soviero Aug 16 '13 at 13:14
  • In response to the filesystem comment, please post the output of `mount` on both systems. – Soviero Aug 16 '13 at 13:16
  • What's the outpour with rsync -av --dry-run --stats ? – mterrasson Aug 16 '13 at 12:45
  • didn't show anything. sent 252 bytes received 75215 bytes 21562.00 bytes/sec total size is 2602089241 speedup is 34479.83 (DRY RUN) – RayofCommand Aug 16 '13 at 12:48
  • I use rsync to backup transfert some websites from time to time, here are the options I use : `rsync -rtzvpExh --delete --stats` You could try that (first as a dry-run to see if it transfers anything) – mterrasson Aug 16 '13 at 12:53
  • 2663 on old server, 2665 on new sever, I just made some changes in the ini. I guess its not the problem. I found some other stupid things...But thanks for everything, i leared a lot :) – RayofCommand Aug 16 '13 at 13:45

2 Answers2

2

Its possible some of the files arent satisfying rsync's default size & date. Get rsync to transfer based on check sums instead. It will be slower, but if the file has changed in anyway, it will be transfered.

rsync -cav <source> <destination>

If you want to check that it will transfer the files you want, add -n to the end of the command to get a dry run. You can then check the list for missing files, or even easier, if you have a specific filename that you know wasn't being transferred before, just grep for it!

rsync -cav <source> <destination> -n | grep some-missing-filename

UPDATE: If you're not sure if the contents of the folders are the same, then you can check easily with the following:

on each server:

cd /to/root/of/your/website
find . | md5sum

And then compare the md5 check sum which is output, if the number is the same, then you have the same files (e.g. file1 on server1 and on server2) although this doesn't account for the file contents being different

If you want to see what files exist in one, but not in another, then you can of course output directory listings to files:

cd /to/root/of/your/website
find . > server1.txt

... on both servers, and then

diff server1.txt server2.txt

Just one final thought:

scp -r user@server1:/path/to/website /path/to/website
GeoSword
  • 1,657
  • 12
  • 16
0

I just encountered a problem where not all files would transfer as expected. I synced to my laptop (Fedora 37) and It worked fine, but when i synced to my pi (Debian bullseye) not all files were there. The error was mine. Maybe you have the same problem. My command looked like this:

rsync file/path/version\ 1.1/ user@remotehost:/file/path/version\ 1.1

The problem with me was the space in "version 1.1", my solution was to put quotations on the path as such.

rsync file/path/version\ 1.1/ user@remotehost:"/file/path/version\ 1.1"

I dont remember what the style is called, but you have to be aware of what style your program, system, etc, supports. My guess is that my Fedora setup accepts escaping spaces without quotes while my pi doesn't.

Hackerman
  • 1
  • 1
  • It's because the escaped space turns into an unescaped space when your local bash processes it and provides it to rsync as an argument. So when that argument is used on the remote computer it doesn't have the necessary escape character anymore. – boileau Mar 03 '23 at 13:16