Today I noticed that I lost approximately 1 TB of very old movies in my collection. I have no idea how it happened, but Munin shows what happened. I'm pretty sure it was my fault. (I was awake at that hour, yes; but, I am not 100% sure.) How can I prevent something like that from happening again? How can I prevent myself (or a program/script) from deleting more than x GB of data? Any suggestion is welcome.
As someone who has successfully removed the
/Windows subdirectory from a running windows system, AND deleted the contents of
/bin on a running linux boxen (it didn't die!)... I know the feeling. (But I don't know HOW I did the Windows thing, shouldn't be possible, Windows locks files in use.)
Remove write ability from containing subdirectory.
chmod a-w /my_movie_dir
I feel like the best option here might be to rename rm (or whatever you tend to use to delete stuff) and wrap that in a new rm script. By best option I don't mean best option, but its fun to think about doing this. You might just want to be more careful with your deletes.
I tested it out quickly after renaming rm to rm-real
#!/bin/bash /bin/rm $1
And that works. You can have that make use of a few functions in rm and echo yourself a little note to use rm-real for full functionality, or go through the exercise of getting the arguments right.
Edit: Actually the best option is good backups. Changing rm is fun, but as noted in the comments a bit wonky.