多个程序或者进程使用一个文件时进行truncate操作

假设A进程正在对文件file进行写操作,offset为 offseta,现在执行

truncate -s offseta file

则文件起始位置到offseta之间的数据被置为0,offset开始是进程A写入的内容。

https://superuser.com/questions/881777/what-happens-when-i-truncate-a-file-that-is-in-use

https://stackoverflow.com/questions/980283/truncating-a-file-while-its-being-used-linux

posted @ 2017-07-18 10:50  Cloud2020  阅读(262)  评论(0)    收藏  举报