I use sudo rsync --archive --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*",/lost+found} a lot for backups so I want to be sure of what it does.
According to the rsync man page, --archive or -a is equivalent to -rlptgoD. All this options are fine and clear for me, except -D equivalent to --devices --specials, that are explained in Unix files types, Wikipedia.
I have never seen the effect of -D, copying device and special files is completely out of my present understanding.
In which case could -D be useful for archiving?
Should I just write -rlptgo(no -D) to prevent unexpected effects?
While writing this, I have the idea that sudo rsync --archive --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*",/lost+found} could be replaced by sudo rsync -rlptgo, because devices and specials are roughly covered by the exclude; in particular, devices are exactly "/dev/*".
/dev/zeropretty much wherever you want usingmknod: https://unix.stackexchange.com/q/562341/70524 (You probably may not have, but when making a whole system backup, it's worth considering that something you use may have) – muru Apr 22 '21 at 06:03sudo rsync /dev/zero totoandsudo -D rsync /dev/zero totoandcp /dev/zero toto.rsync -Dtransfers/dev/zeronicely whereascpfills the target with zeros. – Pierre ALBARÈDE Apr 22 '21 at 19:43-Dwould be dangerous. – Pierre ALBARÈDE Apr 22 '21 at 19:47rsync -a --no-D ...– Chris Davies Apr 22 '21 at 19:54-D, because not using-Dcould have unwanted consequences if you are copying directories containing device files, as you yourself noticed in the other comment. – Kusalananda Apr 22 '21 at 20:59