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 was trying zcat to get only the first 1M lines of a compressed .gzip file into a new one.

However, I get the following error:

$ zcat path/to/R2.fq.gz | head -100 >R2.fqtest
head: write error: Input/output error 

I was relieved when I found this thread and tried:

$ gunzip -c path/to/R2.fq.gz | head -n100 >R2_test.fq

But I get the same error again!

head: write error: Input/output error

Anyone know what might be going on and how to fix it?

thanks! Carmen

Edit >

As requested, I typed the following after getting the error

tail /var/log/syslog

and got

tail: cannot open `/var/log/syslog' for reading: No such file or directory
share|improve this question
2  
The command itself is correct. Right after the getting the error, execute tail /var/log/syslog and edit the result into your question. –  Dennis Apr 26 '13 at 19:34
    
Done! :) I got tail: cannot open '/var/log/syslog' for reading: No such file or directory –  Carmen Sandoval Apr 26 '13 at 20:56
    
Well, that didn't turn out to be particularly helpful... Which Linux distro are you using? –  Dennis Apr 26 '13 at 20:58
    
Red Hat Enterprise Linux Server release 6.3 (Santiago) –  Carmen Sandoval Apr 26 '13 at 21:09

3 Answers 3

it doesn't look like a problem with zcat/gunzip. Can you create the file and write into it?

Try this:

hexdump /dev/urandom | head -n 100 > R2_test.fq
share|improve this answer
    
hexdump /dev/urandom | head -n 100 >R2_test.fq I get this: head: write error: Input/output error –  Carmen Sandoval Apr 26 '13 at 20:50
    
then you probably can't write in the file R2_test.fq . Try it from a directory where you have write access. –  pqnet Apr 26 '13 at 23:28
    
pqnet, I do have access to the folder where I am trying to write the file. –  Carmen Sandoval Apr 26 '13 at 23:36

In order, please try and post results of:

head -n 10 /proc/cpuinfo

echo test | gzip -3 | zcat

echo test > R2.fqtest

The goal here is to first test for proper operation of head, then proper operation of zcat, then the ability to successfully write to R2.fqtest.

Since you state that everything works as expected until the attempt to write to R2.fqtest, which does not throw an error but also doesn't show the data you wrote, there's something hinky with that file or underlying filesystem. Does another process write, lock, or rotate that file? What does the fstab line for the filesystem in question look like? Can you unmount and fsck the filesystem in question? Do you see errors in the logs from the physical drive underlying that filesystem?

share|improve this answer
    
Thanks, Jim: The output of head -n 10 /proc/cpuinfo is: processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 45 model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz stepping : 7 cpu MHz : 1200.000 cache size : 20480 KB physical id : 0 siblings : 16 ; echo test | gzip -3 | zcat returns test as expected; and echo test > R2.fqtest does not return an error, but if I open R2.fqtest there is nothing there... –  Carmen Sandoval Apr 28 '13 at 2:11
    
(Note - the new edit is me as well; didn't realize I wasn't logged in until I'd posted!) –  Jim Salter Apr 29 '13 at 6:31

So, it turns out this is a problem of not having enough disk space!

Thanks, eveyone!

Carmen

share|improve this answer

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.