Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora User (http://www.linux-archive.org/fedora-user/)
-   -   "find" problem (http://www.linux-archive.org/fedora-user/618121-find-problem.html)

01-06-2012 07:43 PM

"find" problem
 
On my F13 machine,

find / ! -fstype ext4 -prune -o -print

prints every file that is in an ext4 filesystem mounted on /, and prunes
those in any other type of fs.

On my F15 the same command prints nothing. Why might that be?



--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Cameron Simpson 01-06-2012 08:28 PM

"find" problem
 
On 06Jan2012 12:43, Dean S. Messing <deanm@sharplabs.com> wrote:
| On my F13 machine,
|
| find / ! -fstype ext4 -prune -o -print
|
| prints every file that is in an ext4 filesystem mounted on /, and prunes
| those in any other type of fs.
|
| On my F15 the same command prints nothing. Why might that be?

Is / an ext4 fs? If not, the find will terminate immediately.
I would run the find with a -print before the -prune and withjout th
trailing print - see what the find is pruning.

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Giving money and power to the government is like giving whiskey and car keys
to teenaged boys. - P J O'Rourke
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Cameron Simpson 01-06-2012 10:20 PM

"find" problem
 
On 07Jan2012 08:28, I wrote:
| On 06Jan2012 12:43, Dean S. Messing <deanm@sharplabs.com> wrote:
| | On my F13 machine,
| |
| | find / ! -fstype ext4 -prune -o -print
| |
| | prints every file that is in an ext4 filesystem mounted on /, and prunes
| | those in any other type of fs.
| |
| | On my F15 the same command prints nothing. Why might that be?
|
| Is / an ext4 fs? If not, the find will terminate immediately.
| I would run the find with a -print before the -prune and withjout th
| trailing print - see what the find is pruning.

It is also worth noting that your find may not find nested ext4 mounts.
Supposing an ext4 mount point is mounted inside an ext3 mount? Your
prune will prevent find from descending deep enough to find it.

Alterative approach:

mount
| awk '$5 == "ext3" {print $3}'
| while read -r fstop
do find "$fstop" -xdev -print
done

Change ext3 to ext4 (I was testing on an ext3 only system).

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

It's our metallo-organic approach versus the incumbent technologies.
- overhead by WIRED at the Intelligent Printing conference Oct2006
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

01-06-2012 10:50 PM

"find" problem
 
On 06 January, 2012 at 3:47pm, Cameron Simpson wrote:
> On 06Jan2012 12:43, Dean S. Messing <deanm@sharplabs.com> wrote:
> | On my F13 machine,
> |
> | find / ! -fstype ext4 -prune -o -print
> |
> | prints every file that is in an ext4 filesystem mounted on /, and prunes
> | those in any other type of fs.
> |
> | On my F15 the same command prints nothing. Why might that be?
>
> Is / an ext4 fs? If not, the find will terminate immediately.
> I would run the find with a -print before the -prune and withjout th
> trailing print - see what the find is pruning.


Yes it is:

# mount | grep lv_root
/dev/mapper/vg00-lv_root on / type ext4 (rw,relatime,user_xattr,acl,barrier=1,stripe=32,da ta=ordered)
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

01-06-2012 11:04 PM

"find" problem
 
On 06 January 2012 at 15:59pm, Cameron Simpson wrote:
> On 07Jan2012 08:28, I wrote:
> | On 06Jan2012 12:43, Dean S. Messing <deanm@sharplabs.com> wrote:
> | | On my F13 machine,
> | |
> | | find / ! -fstype ext4 -prune -o -print
> | |
> | | prints every file that is in an ext4 filesystem mounted on /, and prunes
> | | those in any other type of fs.
> | |
> | | On my F15 the same command prints nothing. Why might that be?
> |
> | Is / an ext4 fs? If not, the find will terminate immediately.
> | I would run the find with a -print before the -prune and withjout th
> | trailing print - see what the find is pruning.
>
> It is also worth noting that your find may not find nested ext4 mounts.
> Supposing an ext4 mount point is mounted inside an ext3 mount? Your
> prune will prevent find from descending deep enough to find it.
>
> Alterative approach:
>
> mount
> | awk '$5 == "ext3" {print $3}'
> | while read -r fstop
> do find "$fstop" -xdev -print
> done
>
> Change ext3 to ext4 (I was testing on an ext3 only system).

My actual "find" script is more complicated and doesn't have the problem
you bring up.

I just wanted to present the "kernel" of the problem so people
could tell me what's going on.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Cameron Simpson 01-07-2012 12:11 AM

"find" problem
 
On 06Jan2012 15:50, Dean S. Messing <deanm@sharplabs.com> wrote:
| On 06 January, 2012 at 3:47pm, Cameron Simpson wrote:
| > On 06Jan2012 12:43, Dean S. Messing <deanm@sharplabs.com> wrote:
| > | On my F13 machine,
| > |
| > | find / ! -fstype ext4 -prune -o -print
| > |
| > | prints every file that is in an ext4 filesystem mounted on /, and prunes
| > | those in any other type of fs.
| > |
| > | On my F15 the same command prints nothing. Why might that be?
| >
| > Is / an ext4 fs? If not, the find will terminate immediately.
| > I would run the find with a -print before the -prune and withjout th
| > trailing print - see what the find is pruning.
|
|
| Yes it is:
|
| # mount | grep lv_root
| /dev/mapper/vg00-lv_root on / type ext4 (rw,relatime,user_xattr,acl,barrier=1,stripe=32,da ta=ordered)

Ok, so per my test suggestion, what does:

find / ! -fstype ext4 -print -prune

show?

Is it useful to go:

find / ! -type d -fstype ext4 -print -prune

What does "man find" say about the -fstype test? I haven't an F15 box to
hand to check against. Does that paragraph differ from the man on F13?

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Surely it was of this place, now Cambridge but formerly known by the name of
Babylon, that the prophet spoke when he said, 'the wild beasts of the desert
shall dwell there, and their houses shall be full of doleful creatures, and
owls shall build there, and satyrs shall dance there.'
- Thomas Gray (1716-1771)
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Cameron Simpson 01-07-2012 12:12 AM

"find" problem
 
On 06Jan2012 16:04, Dean S. Messing <deanm@sharplabs.com> wrote:
| On 06 January 2012 at 15:59pm, Cameron Simpson wrote:
| > It is also worth noting that your find may not find nested ext4 mounts.
| > Supposing an ext4 mount point is mounted inside an ext3 mount? Your
| > prune will prevent find from descending deep enough to find it.
| > Alterative approach:
[... mount | awk | find ...]
|
| My actual "find" script is more complicated and doesn't have the problem
| you bring up.

No worries.

| I just wanted to present the "kernel" of the problem so people
| could tell me what's going on.

Very desirable. Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

You should never bet against anything in science at odds of more than about
10^12 to 1. - Ernest Rutherford
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

01-07-2012 05:48 AM

"find" problem
 
On 06 January 2012 at 9:53pm, Cameron Simpson wrote:
> Ok, so per my test suggestion, what does:
>
> find / ! -fstype ext4 -print -prune
>
> show?

It prints just the root. (I.e. "/" appears alone on a line.)
What is that saying?



> Is it useful to go:
>
> find / ! -type d -fstype ext4 -print -prune

This prints all the files in my two ext4 mounts under /, and none
out of the ext3 mount or the other 'system' mounts like /proc or /sys.
Importantly, it prints no files in the root fs itself.

On my F13 system, it looks like it is printing ALL files under root
except the ones in non-ext4 directories. (I interupted it before it
finished.)

> What does "man find" say about the -fstype test? I haven't an F15 box to
> hand to check against. Does that paragraph differ from the man on F13?

They are word-for-word identical.

It appears to act as though / is NOT ext4. However:

df / returns:

/dev/mapper/vg00-lv_root 157237076 125230856 32006220 80% /

and

blkid /dev/mapper/vg00-lv_root returns:

/dev/mapper/vg00-lv_root: UUID=<elided> TYPE="ext4"

Here's more info:

On my F13 system

find /bin -fstype ext4 -print

prints everything in /bin (which is an ordinary dir under /).

On my F15 system the same command prints nothing.

I'm thoroughly confused.

Dean
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

01-07-2012 06:29 AM

"find" problem
 
In doing more experimenting with find, I discovered that
/ is evidently fstype "rootfs", whatever that is.

Looking in /etc/mtab I see:

rootfs / rootfs rw 0 0

and

/dev/mapper/vg00-lv_root / ext4
rw,relatime,user_xattr,acl,barrier=1,stripe=32,dat a=ordered 0 0

In fact,

find / -fstype rootfs -print

prints all the files and ordinary directories under /.
None of the ext4 mounts are entered, nor are /proc or /sys, &c.

find / -fstype ext4 -print

only prints the entries in ext4 directories mounted in /.

This behaviour thoroughly breaks some of my scripts.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Cameron Simpson 01-07-2012 08:02 AM

"find" problem
 
On 06Jan2012 23:29, Dean S. Messing <deanm@sharplabs.com> wrote:
| In doing more experimenting with find, I discovered that
| / is evidently fstype "rootfs", whatever that is.

Interesting.

| Looking in /etc/mtab I see:
| rootfs / rootfs rw 0 0

I was going to suggest you run the "mount" command, but I see you're
ahead of me.

| and
| /dev/mapper/vg00-lv_root / ext4
| rw,relatime,user_xattr,acl,barrier=1,stripe=32,dat a=ordered 0 0
|
| In fact,
| find / -fstype rootfs -print
| prints all the files and ordinary directories under /.

Which makes sense, given the above.

| None of the ext4 mounts are entered, nor are /proc or /sys, &c.

As you'd hope!

| find / -fstype ext4 -print
| only prints the entries in ext4 directories mounted in /.

Well at least it is all nice and consistent.

| This behaviour thoroughly breaks some of my scripts.

Fun fun fun. What assumptions are you making (aside from ext4 == regular
filesystem)? Are you simply trying to avoid /proc and /dev etc? And NFS
mounts I guess?

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

I bested him in an Open Season of scouring-people's-postings-looking-for-
spelling-errors. - kevin@rotag.mi.org (Kevin Darcy)
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


All times are GMT. The time now is 01:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.