Is it possible to create a file on a random inode on a file system?
I am trying to simulate a random read and write for testing purposes.
TIA
On Sun, 22 Jun 2008 11:20:22 -0400 Mag Gam magawake@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?
even seeking thru it requires a sequential scan, right?
On Sun, Jun 22, 2008 at 1:57 PM, Frank Cox theatre@sasktel.net wrote:
On Sun, 22 Jun 2008 11:20:22 -0400 Mag Gam magawake@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?
-- MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com
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@sasktel.net wrote: On Sun, 22 Jun 2008 11:20:22 -0400 Mag Gam magawake@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