不是说记住rm -rf的教训就够了
不是说记住rm -rf的教训就够了
2013年,我在同步CTAN镜像的时候,在/home下我的文件夹里面操作了下面的命令:
rsync -av --delete rsync://rsync.dante.ctan.org/CTAN .
这个直接导致我的一些文件删掉了,包括一些Java代码,当时有点痛心。但是,这能怪谁,看到--delete和.不加警惕就必然要中招的。说起来也不算是会记吃不记打,这种事只要发生过一次的话,就肯定会长长教训。
大学的时候读过一本W. Curtis Preston写的动物书,中文版叫做《UNIX备份与恢复》(1999年版,后来这本书在2007年出了覆盖Windows的新版),现在想来,这书大概是可以重新读一遍的。里面写的内容,我大概记不清了,也就记得最后面魔改披头士的Yesterday:
Yesterday,
All those backups seemed a waste of pay.
Now my database has gone away.
Oh I believe in yesterday.
Suddenly,
There's not half the files there used to be,
And there's a milestone hanging over me
The system crashed so suddenly.
I pushed something wrong
What it was I could not say.
Now all my data's gone
and I long for yesterday-ay-ay-ay.
Yesterday,
The need for backups seemed so far away.
I knew my data was all here to stay,
Now I believe in yesterday.