学习空间

为什么vi编辑后文件的Birth Time也会变?

2022-11-22  本文已影响0人  潘猛_9f76

1、问题现象

VI编辑后 Acess、Modify、Change和Birth Time都会变


image.png

其原因是 vi后,文件的inode会发生变化


image.png

这种情况如果发生在日志文件上,就会出现新日志不会记录到日志文件,而且日志空间还会继续上涨


image.png

2、inode为什么会变?

缺省情况下,backupcopy=auto,一般是no,也就是会写一个新文件

'backupcopy' 'bkc'      string  (Vi default for Unix: "yes", otherwise: "auto")
                        global or local to buffer |global-local|
                        {not in Vi}
        When writing a file and a backup is made, this option tells how it's
        done.  This is a comma separated list of words.

        The main values are:
        "yes"   make a copy of the file and overwrite the original one
        "no"    rename the file and write a new one
        "auto"  one of the previous, what works best

        Extra values that can be combined with the ones above are:
        "breaksymlink"  always break symlinks when writing
        "breakhardlink" always break hardlinks when writing
3、如何让inode不变
4、已经vi编辑过的日志如何找回
上一篇 下一篇

猜你喜欢

热点阅读