Exclude mounted folders from tar archive

user2984570 asked:

we want to backup our server and this seems to be pretty simple thing to do except one. Currently we use something like this:

tar cvpjf backup.tar.bz2 –exclude=/proc –exclude=/lost+found –exclude=/backup.tar.bz2 –exclude=/mnt –exclude=/sys /

Everything is fine, but we do not want to include mount points, as several ftp users has chrooted access to their homes with mounts like:

mount –bind /var/www/folder /home/user/html

Is the any way to exclude such folders from being backuped?

My answer:


Use the appropriate tar command line option:

       --one-file-system
              stay in local file system when creating archive

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.