• Tar "removing leading slashes" Error

    All Linux distros have the 'tar' utility. I use tar with bzip2 to do backups on clients server computers. One thing that really annoyed me was the "removing leading slashes from..." error message from tar that would then result in a return code of non-zero. This, in turn, would then cause the backup to be considered "unsuccessful" by my backup script. Well I have found a solution. When you call tar use the -C to change to the / (root) directory and then for all the directories you wish to backup omit the first slash. For example:

    tar cvfj backup.tar.bz2 /home /usr/local /etc


    tar cvfj -C / backup.tar.bz2 home usr/local etc


    It works well and NO MORE ERROR MESSAGES!