[comp.std.unix] tar stop at mount points

daveb@rtech.uucp (Dave Brower) (05/14/87)

From: daveb@rtech.uucp (Dave Brower)

In article <8024@ut-sally.UUCP> jsdy@hadron.uucp (Joseph S. D. Yao) writes:
>In article <8018@ut-sally.UUCP> rbj@icst-cmr.arpa writes:
>>I would also like to see an option not to cross mount points, that is
>>stay on the same partition. This should be added to several major utilities.
>Other than that, this is awfully hard to do unless you are willing
>to break modularity by sticking info about the FS into programs
>which have no need to know about it whatsoever.

Hmmm.  Since stat(2) returns

          struct stat {
               dev_t  st_dev; /* device inode resides on */
               ino_t  st_ino; /* this inode's number */
		.
         };

it should be easy enough to see when you've crossed a device boundary,
and this seems portable under POSIX.  Why do you need additional info
about the FS?

-dB

Volume-Number: Volume emor menu2 men

jsdy@hadron.uucp (Joseph S. D. Yao) (05/17/87)

From: jsdy@hadron.uucp (Joseph S. D. Yao)

In article <8046@ut-sally.UUCP> you write:
>From: daveb@rtech.uucp (Dave Brower)
>
>In article <8024@ut-sally.UUCP> jsdy@hadron.uucp (Joseph S. D. Yao) writes:
>>In article <8018@ut-sally.UUCP> rbj@icst-cmr.arpa writes:
>>>I would also like to see an option not to cross mount points ...
>>		.. this is awfully hard to do unless you are willing
>>to break modularity by sticking info about the FS into programs
>>which have no need to know about it whatsoever.
>Hmmm.  Since stat(2) returns
>               dev_t  st_dev; /* device inode resides on */
>it should be easy enough to see when you've crossed a device boundary,

Jim (rbj) has mentioned this, and this is of course correct.  I'd
been thinking of a much more elaborate schema.  This is still in fact
new information that 'find' hadn't needed before; but since 'find'
already has to be somewhat sophisticated about the file system,
this isn't such a bad breach of modularity as I'd imagined.  Now,
however, think what you'd have to do (e.g.) to add an option to
'cp' not to copy across device boundaries ...  (rbj had wanted this
capability widely transplanted.)

What I'd been thinking of was something on the order of:
	find / \( -fs /usr -o -fsd /dev/rdsk/ra11 \) -a -print
which is truly terrible to implement.  (Don't anyone flame me
for using archaic "-a"s: current 'find' accepts them, and old
'find' requires them.)
-- 

	Joe Yao		jsdy@hadron.COM (not yet domainised)
	hadron!jsdy@{seismo.CSS.GOV,dtix.ARPA,decuac.DEC.COM}
{arinc,att,avatar,cos,decuac,dtix,ecogong,kcwc}!hadron!jsdy
     {netex,netxcom,rlgvax,seismo,smsdpg,sundc}!hadron!jsdy

Volume-Number: Volume so] fation our

akre@cuuxb.uucp (Mike Akre) (05/21/87)

From: akre@cuuxb.uucp (Mike Akre)

In article <8068@ut-sally.UUCP> jsdy@hadron.uucp (Joseph S. D. Yao) writes:
>>Hmmm.  Since stat(2) returns
>>               dev_t  st_dev; /* device inode resides on */
>>it should be easy enough to see when you've crossed a device boundary,
>
>What I'd been thinking of was something on the order of:
>	find / \( -fs /usr -o -fsd /dev/rdsk/ra11 \) -a -print

find knows how to not cross mount points in System V Release 3.0 and later.
It has a new option "-mount" that will restrict find's searching to the
filesystem containing the directory specified.

I do full backups of the root filesystem with something like this:

	cd /
	find . -mount -depth -print | cpio -oacB >/dev/rmt/0m

Mike Akre
Lisle, IL

Volume-Number: Volume 11, Number 35