The classic Unix horror story
lug.wsu.edu
lug.wsu.edu
Late at night, I was tarring up a finished project right before emailing it to my professor. I ran:
tar -cvf *.cpp *.h something.tar
instead of: tar -cvf something.tar *.cpp *.h
It happily wrote most of my project into a tar file on top of the first source file, then complained that something.tar didn't exist. I overwrote "array.cpp" or something like that, and had to rewrite it (this was before I used source control for anything, and a large part of why I learned to use source control).Writing this comment, I had to look up the order of the parameters to tar; I still can't remember. Stupid tar.
Fortunately, they are only virtual fingers and we can grow them back on demand with adequate preparation, unlike real ones. :)
The -f (--file) flag takes an argument. So you could do:
tar -cf *.cpp -f something.tar
It is easier to remember order if you know what the flags mean.The "-f <filename>" flag is perfectly clear, and useful in all modes (c, x, etc). If you remember "tar czf" as a magical incantation, then you're missing something vital. When you understand what each argument means there is no ambiguity. I don't mean to sound condescending, but in my entire life I've never encountered the problem you described.
tar -c *.cpp -f something.tar ; tar c *.cpp *.h >something.tar
; tar c dir | gzip >something-else.tgz
Problem solved! Also: ; tar c dir | gzip | nc -q0 -lp 4000 &
; [another computer]
; nc $otherhost 4000 | gnuzip | tar xPretty please do not create such a directory in this comments thread.
You'll know that "head-in-hands" feeling if you've done it before, and it is quite the experience.
That's why this story will draw you back every time.
Salvaging the disk by recreating a minimalist system on it is heroic and hacky, but was that the only way?
I'm too young for the VAX era, but was there "a" hard disk which could be easily swapped and if they had another (which the Ethernet comment suggests they did) then would it have spare connectors? and free disk space? How fast did files copy back then?
If so they'd still be faced with shutting both down (knowing they couldn't start this one up again, and what was the procedure for shutting down / starting the other?) then be without both while they concocted a bodge recovery, then be faced with telling everyone to use the other and how to find their work - assuming if could take that many extra users and they had enough terminals for that.
That's sounding like a day's downtime of two systems and several days of people disruption followed by more disruption when they had to move users back.
Not as hard-core as the recovery through emacs, but greatly welcome under stress.
"Great programmers spend very little of their time writing code – at least code that ends up in the final product. Programmers who spend much of their time writing code are too lazy, too ignorant, or too arrogant to find existing solutions to old problems. "
I mean so... who's writing the code then? Who's writing the original code? I would call a clever programmer a great programmer. Just clever. and sometimes clever can get you into trouble. But just sometimes :)
o typing 'halt' into the wrong xterm, shutting down well planners
o and likely on the same network, jacking up the NIS+ on Solaris
It's been a constant itch that I never did manage to understand what I was doing wrong, such that NIS+ wouldn't restart correctly.'Step one: configure iptables to deny traffic by default: iptables -P INPUT DROP'
There's also the time that I learned why you should think twice before setting a default policy of DROP or REJECT - iptables -F will clear all rules that allow you in, but not the default policy that keeps you out.
$ cd /etc
$ chmod 600 some_file * # instead of some_file.*
oops... Thank God for boot diskettes.I managed to Ctrl-C it before it ate any files in /home, but I still had some nasty cleanup work to get the computer back in working order again. Thank god for LiveCDs.
It took me half a day to recover from that.
Another one, even more stupid, is to recover a "backup" of /var, done without the proper rights to it. I noticed the problem after a lot of weirds errors cropping in. This one I did not recover - after a few hours, I ended up deciding that reinstalling linux on my machine would be faster and more reliable.
Yeah ... I didn't live that one down, lost my team some points.
One reason I really prefer text commands, as the sequence is preferred, so they can be typed and "queued" to execute in order when they arrive.
That happened right after typing
cp backup.tar.gz /dev/sda
That was fun. Also, back then I had no idea how easy it would have been to at least get the contents of that backup file back using ddMy favourite from USENET is cleaning out .o files after compiling C code but fat-fingering the SHIFT key and instead of typing
% rm -f \.o
,typing
% rm -f *>o
which gives you an empty directory and a zero length file called "o"
ah yes....
In fact, we can see from Youtube:
Ubuntu: http://www.youtube.com/watch?v=D4fzInlyYQo
Windows XP: http://www.youtube.com/watch?v=0aSo8-VDS8E
XP appears to hold up slightly better - it doesn't ruin the fonts, and it pops up a System File Protection dialog indicating it has noticed the broken system files and asking for an install CD to recover them from.
That kind of design takes a lot of thought and, as far as I know, doesn't hold true in DOS/Windows.
$ chown -R terra_t.terra_t /
on a production system. Fortunately I was able to recover the permissions of most of the system files from the rpm database, and do the rest by hand...
One should be careful making such damage threats though, may end up with male appendage replacing rabbit foot on someones' keychain
but you're right, networking speed/bandwidth has gotten better since then, but that's irrelevant and I never claimed it hadn't. my point was that there is a simple, well-known solution/palliative for this, so no need for this kind of drama going forward.
Even this week I've reminded people at work that if you don't test your backup (and restore) system, then you don't have a backup system.