I've been trying to use all kinds of rsync commands in different kinds of constellations similar to this one on the arch page to back up my linux system to an SMB Storage.

this includes the following versions:

  1. rsync -aAXv --exclude=/dev/ --exclude=/proc --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* --exclude=/cdrom/* --exclude=/lost+found / /mnt/mounted_smb_storage

  2. rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt/mounted_smb_storage

  3. rsync -aAXHv --exclude-from=/path/to/excludelist.txt / /mnt/mounted_smb_storage

both with and without quotations...

It always seems to ignore the --exclude command as long as I use the Root Directory as source. Once I use a source like /mnt and use --exclude /mnt/* it ignores the directory like it's supposed to

Im using Debian 11 and rsync version 3.2.3 protocol version 31

  • 1
    I can't reproduce this (with a different version of rsync), but you're looking for the -x option. Aug 3, 2022 at 20:42
  • rsync -aAXv --exclude={mnt,proc} /* /mnt/mounted_smb_storage
    – gapsf
    Aug 3, 2022 at 21:01
  • 1
    Using rsync-3.2.4 regularly -aXH --del with root dir as source + an exclude list of the kind you wrote in your § 2. Everything is systematically fine. Are you sure that when launching your §2 command, your mounted_smb_storage did not already contained the files from your exclude list ? (having tried in all constellations… such a mistake could be possible ;-) Additionally your last paragraph puzzles me : You do realize that excluding /mnt/* won't ignore the directory. Only the files laying behind it.
    – MC68020
    Aug 3, 2022 at 22:29

2 Answers 2


I fixed the issue by uninstalling rsync with apt purge rsync.

rsync had a weird dependency to a maria-db package when uninstalling

After reinstalling rsync alone the commands work as expected again..


You could marginally better write this as

rsync -aAXv --exclude=/dev/ --exclude=/proc/ --exclude=/sys/ --exclude=/tmp/ --exclude=/run/ --exclude=/mnt/ --exclude=/media/ --exclude=/cdrom/ --exclude=lost+found/ / /mnt/mounted_smb_storage

Or with a shell that understands brace expansion,

rsync -aAXv --exclude=/{dev,proc,sys,tmp,run,mnt,media,cdrom}/ --exclude=lost+found/ / /mnt/mounted_smb_storage

The trailing / on each exclusion indicates to rsync that the item is a directory. The leading / ties each to the top of the source path. The excluded directories themselves will also be omitted from the copy.

Better still, if your SMB storage server allows you to run rsync you could gain efficiencies on subsequent copies by using a network copy. For example,

 rsync -aAXv --exclude=/{dev,proc,sys,tmp,run,mnt,media,cdrom}/ --exclude=lost+found/ / user@storageServer:/mnt/mounted_smb_storage

For non-root accounts on such a destination you might need to add -M--fake-super both for backups and restores, so that metadata attributes such as ownership can be recorded alongside each target file.

You must log in to answer this question.

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