Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm sorry if this question is really stupid, but this is basically what I have been thinking about constantly: Suppose I run : cat ./somefile.txt a few hundred times a second. How much faster is my harddrive going to die?

share|improve this question
    
Why would you call cat a few hundred times a second to begin with? Are you trying to parse something? –  Xanny Jul 7 '11 at 13:22
3  
FWIW, running : cat somefile.txt does not run cat. The : built-in does nothing at all. –  grawity Jul 7 '11 at 13:50
    
: cat somefile.txt > otherfile.txt creates otherfile. –  Blub Jul 7 '11 at 13:58
30  
It's usually a wasted effort -- they never come until they hear the can opener. –  Daniel R Hicks Jul 7 '11 at 17:46
    
@Blub, actually your command does very little : cat somefile.txt > otherfile.txt will not copy the contents of somefile.txt to otherfile.txt; otherfile.txt will be present after the command, but will be empty (even if it originally had contents). : `cat somefile.txt > otherfile.txt` will copy the contents of somefile.txt to otherfile.txt without displaying the output. See: gnu.org/software/bash/manual/html_node/… and stackoverflow.com/questions/3224878/… –  dr jimbob Jul 7 '11 at 18:28
show 1 more comment

3 Answers 3

up vote 16 down vote accepted

Seven. But seriously, it's hard enough to know how long a disk will last while idling let alone under heavy load. There's no answer other than to say it will probably wear the disk faster.

The better argument against this is it would generally be quite slow. Why would you need to hammer the disk like that?

If you're looking to find out when something changes, perhaps look at inotify which is a kernel-based file event system that can call some code when something happens, negating the need to hammer the disk.

There are wrappers like pyinotify to make things easier.

share|improve this answer
    
+1 for the pointer to inotify. I hadn't heard of it before and it looks like a useful tool. –  user815423426 Jul 8 '11 at 14:16
add comment

It may have no effect at all, depending on the size of somefile.txt - if it's small enough for the kernel to cache it in RAM, the file will only be read once from disk and subsequent iterations will retrieve it from the cache.

Even if running that command repeatedly does have an effect on your drive's lifetime, it will be due to the file being read repeatedly. Whether you use cat or some other program to read it is completely irrelevant.

share|improve this answer
    
I guess nowadays there are very few files you would want to cat large enough not to be cached completely. So indeed, only the first time the disk is going to feel it. –  Joey Jul 7 '11 at 14:28
add comment

This reminds me of that study Google did about Harddrives. Since they go through a lot of harddrives, they did an informal study to see if there was any significant correlation between the lifetime of a HD and a list of factors that include temperature, power cycles, activity levels, etc. The only significant factor they found was age, I believe. The study is called "Failure Trends in..." something something.

I wouldn't worry too much about HD usage eating your drive.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.