[CentOS] random file

William L. Maltby CentOS4Bill at triad.rr.com
Sun Jun 22 22:52:32 UTC 2008


On Sun, 2008-06-22 at 14:14 -0400, Mag Gam wrote:
> even seeking thru it requires a sequential  scan, right?

If Linux FS systems work like real *IX, it depends. The underlying
C/system calls should be smart enough to calculate an offset that
traverses inode information to cause a direct access seek of the read
write head.

If you use a utility, it depends on if the utility is smart enough to
use the correct system calls or just does a sequential read until the
proper location is achieved. I *suspect* that most utilities are smart
enough to work the "fast" way.

You can test this for various utilities or applications.

For instance

    dd if=<your file name> skip=<some large number> of=/dev/null count=1

should return *very* quickly. If not, that means it is stupid.

For output, the same. Just replace skip with seek.

Think of large database handlers. If they had to process sequentially,
there would be no fast ones unless the whole DB was cached.

> <snip>

> On Sun, Jun 22, 2008 at 1:57 PM, Frank Cox <theatre at sasktel.net>
> wrote:
>         On Sun, 22 Jun 2008 11:20:22 -0400
>         Mag Gam <magawake at gmail.com> wrote:
>         
>         > Is it possible to create a file on a random inode on a file
>         system?
>         
>         
>         Wouldn't it be easier (and safer) to create a large file, then
>         seek within it?
>         <snip sig stuff>

HTH
-- 
Bill




More information about the CentOS mailing list