-1

I have almost an entire day trying to create a mirror backup of the root folder of my ubuntu linux. Install the rsync and create a script with the following content:

#!bin/bash
rsync -rtvpl / /home/julian/Escritorio/copiaRsync/

the big problem is that some files are copied, others are not, in some cases it shows me errors, the script I'm executing as root and I gave it execution permissions with the following command: chmod + x rsync.sh. Other problems is that they are copied with permissions that block the folders, I leave attached some images so that they see the backup copy.

imagen 1

imagen 2

What I can do? I do not know what to try so that the copy is generated exactly the same as the source files. the files of origin are not blocked and when the copy generates them to me with permissions, I do not understand.

1

Use the -a option, which was invented to copy all things that most people need. I.e. replace the -rtvpl with -av, and I would recommend adding -H to add hardlink support.

Without the -go implied by -a you are not copying the group and user of the files, meaning all files and directories end up as being owned by root:root, which means that ordinary users can't access their files anymore.

Note that -v for verbose is not very useful by itself, I recommend adding -i for itemize changes to see why a file is being transferred.

If you are copying over to the same tree over a period of time, --delete may alo be useful to prevent deleted files from filling up the backup.

You are also copying a complete filesystem to a directory contained inside that source filesystem, so you will end up recursively copying that endlessly. Prevent that by excluding that directory; your command ends up as:

rsync -aHvi --exclude '/home/julian/Escritorio/copiaRsync/**' / /home/julian/Escritorio/copiaRsync/
  • it helped me a lot, but the problem when copying some files like the ones in the / sys folder is that they are all virtual files and apparently it is impossible to copy them, also note that when you try to copy the kcore file that is inside the folder / proc rsync was stuck and it turns out that this is another virtual file that weighs 140,7 TB which is extremely large. I had to exclude all those files to generate the copy, imagine that being virtual files (not real) do not influence to generate an exact copy, or if? – JulianProg Apr 19 at 15:09
  • If you want to make an exact copy of the root filesystem and not any mounted filesystems, then use the -x option; then rsync will not leave the filesystem specified as the source. Otherwise exclude all the virtual filesystems in the same way as teh destination is excluded; those will include /dev, /proc, /sys, and possibly /run. – wurtel Apr 23 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.