I want to copy an entire linux server that is going to be decommissioned over the network so we are sure nothing is lost.
I did du / and was told there are 60 GB of under /
Then I did rsync -r / root@newserver:/old-server and when doing du in the old-server dir I got 22 GB.
So why is that difference? Is there something that du can see but rsync can’t copy?
You probably have deleted files that can’t yet be deallocated because there are open filehandles on them. (I didn’t previously know that du would see the usage from those, but some testing showed that it does.) You can research this using lsof. The two main causes of this from my experience are deleting Apache logs without kicking the httpd and deleting mysql tables from the filesystem rather than by using DROP TABLE.