# Restricting tar or pax to a single file system



## jaymax (Nov 22, 2009)

How does one restrict tar or fax to a single file system when tarring or paxing from root (/) ?

Thanks!  

Restricting tar or pax to a single file system


----------



## vivek (Nov 22, 2009)

Sorry, I did not get your question first time. gordon provided correct info.


----------



## gordon@ (Nov 22, 2009)

From the man page for tar, use the --one-file-system argument.


----------



## jaymax (Nov 22, 2009)

The syntax here is confusing, should it be >
[ignoring other options]

`tar -c -W one-file-system -f tarfile2Becreated.tar /`

{
From the man pages 
-W longopt=value
 Long options (preceded by --) are only supported directly on systems that have the getopt_long(3) function.  The -W option can be used to access long options on systems that do not support this function.
}

Or is there another synopsis?

Thanks!


----------



## gordon@ (Nov 23, 2009)

I bet you could use either:
[cmd=]tar cf tarfile.tar --one-file-system /
tar cf tarfile.tar -W one-file-system /
[/cmd]
BTW, be careful to not put the tarfile.tar on the same mountpoint as the one you are tarring up. At least with older implementations, it would try add the tarball to the tarball, and well, fun things happen in that case.


----------



## jaymax (Nov 23, 2009)

Thanks !! the `tar cf tarfile.tar -W one-file-system /` worked like a charm

Thanks again


----------

