[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Listing all inodes on filesystem (without doing a stat() call).

From: James Youngman
Subject: Re: Listing all inodes on filesystem (without doing a stat() call).
Date: Sat, 20 Feb 2010 12:08:35 +0000

On Thu, Dec 31, 2009 at 10:32 PM, Ray Van Dolson <address@hidden> wrote:
> I'm trying to generate a sorted list of inodes on my filesystem (so I
> can optimize a GFS2 backup workflow).  The filesystem has >1 million
> inodes, so generating this list can take a little bit of time.
> I initially attempted to do this via Python, but all of its calls
> appear to be too high level and result in stat() being called on every
> file.
> I then tried using find:
>  find . -printf "%-15i %h/%f\n"
> However, this also appears to call stat() on every file -- presumably
> because the call to printf means I might want other information not
> necessarily provided via a readdir()/getdents() calls (?)

Historically, yes.   But more recent versions of find should adopt a
finer-grained approach.   Try it with a version of findutils-4.5.x
(available by FTP from alpha.gnu.org).

> Can someone advise as to the most efficient way to generate a list of
> inode / filename pairs for my entire filesystem using find?

find -O3 . -printf "%-15i %p\0"

(Using newline as a separator is problematic since filenames can
contain newlines)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]