A Question on inode - ext3FS

Jordi Prats jordi.prats at gmail.com
Wed Nov 26 07:38:46 UTC 2008


2008/11/26 Stephen Samuel <darkonc at gmail.com>:
> It's an application issue.  It has to do with how the file is updated.
> There are two ways for an editor to update a file:
>   write to the file in place, (nostly done with simple appends) or
>   write a new version of the file (with a temporary name), then rename the
> temporary file to replace the old one.
>
> The first method only modifies the existing file, so the Inode number
> changes the same.
>
> The secondmethod creates a new file (with a different inode number) and then
> the new file (with the new inode number) replaces the old file.
>
> THe main advantage of the second method is that it's atomic. Either the file
> is replaced, or it isn't. Thus other users/programs which accesss the file
> never see intermediate results.  (also the case if the program dies, or the
> system is reset).


Just curious...How is done that?There's a system call to do this replacement?

Thanks!

> The first method has the advantage that the inode# stays the same, and so
> any programs which had the old file open will see the updates.  The
> disadvantate is that if anything goes wrong in the middle of the update, the
> file could end up in an partial update state.
>
> Remember, the file is nothing more than a collection of bytes.  There's no
> way to insert a character or two in the middle of the file. You then have to
> rewrite the entire file from that point on.
>
> On Tue, Nov 25, 2008 at 8:40 PM, lakshmi pathi <lakshmipathi.g at gmail.com>
> wrote:
>>
>> I have noticed that whenever you edit a file content,a new inode
>> number is assigned with the File.
>> But Sometime file changes the inode number,Sometimes it remains as older
>> inode.
>>
>> Can anyone please let know the concept behind this - modifing content
>> changes the file's inode but not all the time?
>>
>> I'm using Fedora 7  with ext3 file system. (Kernel : 2.6.25.4)
>
> --
> Stephen Samuel http://www.bcgreen.com
> 778-861-7641
>
> _______________________________________________
> Ext3-users mailing list
> Ext3-users at redhat.com
> https://www.redhat.com/mailman/listinfo/ext3-users
>



-- 
Jordi




More information about the Ext3-users mailing list