0

I have a few partitions. One is for my main OS installation, and a second is set aside as the destination for a backup of the main OS. I have a secondary OS set aside for maintenance purposes, with both of the aforementioned partitions mounted as /source and /dest respectively.

After a successful run of:

sudo rsync -av --del /source /dest

I noticed that the fstab file in the copy has a different uuid for the root partition than the original, but, why?

Does it have anything to do with the -a argument being equivalent to -rlptgoD, with -D being --devices --specials?

I need to be sure I'm doing what I intend to do for this copy operation.

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .