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


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/
  • 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. – Maarten Sep 12 '18 at 17:07

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

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.