[ale] inode change after vi a file ?

Jesse Guardiani jesse at wingnet.net
Thu Mar 30 14:44:12 EST 2006


Chris Ricker wrote:
> On Thu, 30 Mar 2006, Jerry Yu wrote:
> 
>> To my surprise, the inode #  changes as long as I do ":w" inside vi.  This
>> holds true on a stock installation of CentOS 4.1 and CentOS 4.3 (equivalent
>> of RHEL 4.* AS) . Anyone knows this is a new feature? If it is a feature,
>> I'd like to learn ways to turn it off.
>>
>> [zyu at saturn ~]$ date > blah; ls -i blah; vi blah; ls -i blah
>> 688427 blah
>> 692394 blah
> 
> It's making a new temporary file that you're editing, then moving it over 
> the original file....

Yeah, this is the only way to do a reliable atomic update on a *NIX filesystem.
I suspect VIM doesn't do this everywhere, as I code on a production server that
will complain if you vim :w a file while someone is trying to access it. Perhaps
VIM causes the file to blink out of existence temporarily? That would be silly,
as a simple rename operation would be 100% atomic inside the same filesystem,
but it would coincide with what I've seen.





More information about the Ale mailing list