rsync back up of entire root system not working using --exclude?

9,997

Solution 1

I think you need add * after each sub dir such as /dev/* ...

rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder

Solution 2

Try this one. I just removed the '/' from all the excludes.

sudo rsync -avz --exclude="tmp" --exclude="sys" --exclude="lost+found" --exclude="mnt" --exclude="proc" --exclude="dev" --exclude="media" / /home/willc86/backup/
Share:
9,997

Related videos on Youtube

user2805313
Author by

user2805313

Updated on September 18, 2022

Comments

  • user2805313
    user2805313 over 1 year

    I am trying to do a system back up of my entire OS

    I am using these command and both are not excluding the files I want

    sudo rsync -avz --exclude="/tmp" --exclude="/sys" --exclude="/lost+found" --exclude="/mnt" --exclude="/proc" --exclude="/tmp" --exclude="/media" /* /home/willc86/backup/sudo rsync 
    

    and the one I am trying that I searched online is

    rsync -aAXv --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/","/mnt/","/media/","/lost+found"} / /path/to/backup/folder
    

    both are still copying everything and I am not sure why

    • rubo77
      rubo77 almost 4 years
      What is the commands? both works fine for me. maybe you are wondering, because you have not trailing slashes and it creates the whole folder inside the target again if you run it twice
  • Maarten
    Maarten over 5 years
    This did it for me, thanks!! When I would do OP's command (which I've found on other forums) it would also backup the /mnt folder which is where I was backing up to. When I excluded the way described it would exclude the folders correctly.
  • rubo77
    rubo77 almost 4 years
    this would ignore all folders, that are called "tmp", "sys", ... in each subdirectory. You have to start each folder with a slash
  • rubo77
    rubo77 almost 4 years
    Why would you have to add an asterisk and quotes? without asterisk the command already works fine for me, it ommits all those directories