Tar do not take --exclude into account

Discussion in 'Mac Programming' started by sandy-locke, Jan 16, 2013.

  1. macrumors newbie

    Joined:
    Jan 16, 2013
    #1
    Hi,

    I'm using tar to backup my non-ios-phone onto my mac and am facing an issue with --exclude function. I enter the following line in term:

    Code:
    ssh developer@192.168.2.15 "tar -cvzp --exclude='/proc' --exclude='/lost+found' --exclude='/sys' --exclude='/mnt' --exclude='/media' --exclude='/dev' /" | cat > /local/path/backup.tar.gz
    I also tried with "/" at the begining like this:

    Code:
    ssh developer@192.168.2.15 "tar -cvzp / --exclude='/proc' --exclude='/lost+found' --exclude='/sys' --exclude='/mnt' --exclude='/media' --exclude='/dev'" | cat > /local/path/backup.tar.gz
    But --exclude is never taken into account and I always end up with a "short read" when "/sys" tries to tar (which is normal I assume).

    Could somebody help find the right sentence please ? Thx
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    To make sure I understand things:

    Your phone (undisclosed model and version) is running an ssh service. You're logged into that service from your Mac (also undisclosed model and OS version).

    You then tell the phone to run a tar command (as posted, 2 variants), which does not correctly follow the --exclude options in that command.

    The output of the remote tar command, if it worked, would be sent as standard-output to the Mac, where it's cat'ed into a Mac-local file.
    If that's a correct description:

    1a. Find the version of tar on the phone. If it's a version that should support --exclude, what does --help say?

    1b. Try:
    Code:
    --exclude pattern
    instead of:
    Code:
    --exclude=pattern
    
    2. Make a simplified test-case of a tar command. It should contain one simple directory name (with files) and one simple exclusion (with files). It should write to phone-local storage.

    3. If the simplified test-case works, create a simplified mockup directory structure that reflects the permissions and ownership of / and /sys, to test whether the problem lies with permissions or ownership.

    4. Consider asking your question on a forum dedicated to your phone. The 'tar' command is running on the phone, as a phone-native process, not on the Mac. The options of a Mac-based tar (whatever version) have no relationship to the phone-based tar.
     
  3. thread starter macrumors newbie

    Joined:
    Jan 16, 2013
    #3
    Hi, thanks, yes you're correct ;)

    Phone is Nokia N9 with Meego Harmattan, Mac is MacBook Pro Late 2011 with OSX Mountain Lion.

    I checked tar version and all I get is this :

    Code:
    BusyBox v1.20.0.git (MeeGo 3:1.20-0.2+0m8) multi-call binary.
    Usage: tar -[cxtzjhmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...
    So I assume it's the tar from busybox v.1.2. for Meego.

    I'll first try 1b., then 2 and post the results here. Then we'll see.

    And thanks for the precision about tar being the one from the phone. I actually didn't make the correlation. I'll certainly post my question on a dedicated forum then, although since I started it up here I'll post the results of 1b and 2 here to see if it can be solved from here.
     
  4. macrumors 603

    Joined:
    Aug 9, 2009
    #4
    It looks like it to me.

    FWIW, the -X FILE option is traditional for excluding a list in FILE. That option is supported by GNU tar and the bsdtar found on OS X Mtn Lion (see their respective man pages). The equivalent long GNU-tar option name is --exclude-from.
     

Share This Page