rsync
does not change any files, so if you did the rsync
correctly, you should expect /source/etc/fstab
to be identical to /dest/etc/fstab
.
It looks like your rsync
command copies /source
to /dest/source
instead of /dest
which you would expect. So if you check in your partitions, you probably have a file /dest/source/etc/fstab
which is the actual copy of /source/etc/fstab
, (/dest/etc/fstab
just happens to be there with the old data).
To copy directories the way you want, you need to add a trailing /
in the source (I usually add one also in the destination, but I believe that is not necessarily needed), like this:
sudo rsync -av --del /source/ /dest/
Relevant documentation from the man page:
rsync -avz foo:src/bar /data/tmp
This would recursively transfer all files from the directory src/bar on the ma‐
chine foo into the /data/tmp/bar directory on the local machine. The files are
transferred in "archive" mode, which ensures that symbolic links, devices, at‐
tributes, permissions, ownerships, etc. are preserved in the transfer. Addition‐
ally, compression will be used to reduce the size of data portions of the trans‐
fer.
rsync -avz foo:src/bar/ /data/tmp
A trailing slash on the source changes this behavior to avoid creating an addi‐
tional directory level at the destination. You can think of a trailing / on a
source as meaning "copy the contents of this directory" as opposed to "copy the
directory by name", but in both cases the attributes of the containing directory
are transferred to the containing directory on the destination. In other words,
each of the following commands copies the files in the same way, including their
setting of the attributes of /dest/foo:
rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo