Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My girlfriend's macbook's hard drive failed, so I gave her a new one and reinstalled OSX on it. Works fine. However, I wanted to see if I could use her old hard drive for backups/fun.

I was able to wipe the partitions on the drive and make one single ext4 partition on it. I was then able to mount it and check it's size (~230G, perfect).

Then I tried backing up my home directory to the hardrive using sudo cp -r ~/* /media/tmp where /media/tmp is the mounted filesystem. My home directory is around 35G in size. I was able to get far into the copy, then I received this:

sudo cp -r ./* /media/tmp/
root's password:
cp: writing `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/09 Ghost.mp3': Read-only file system
cp: cannot create regular file `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/07 Communist Daughter.mp3': Read-only file system
cp: cannot create regular file `/media/tmp/media/music/Neutral Milk Hotel/In the Airplane Over the Sea/06 Holland, 1945.mp3': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Everything Is': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/1996 - On Avery Island': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Beauty': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/1998 - In the Aeroplane Over the Sea': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Neutral Milk Hotel/Invent Yourself A Shortcake': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Tim Minchin And The Heritage Orchestra': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Dethklok': Read-only file system
cp: cannot create directory `/media/tmp/media/music/The Tossers - Discography [77era]': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Porcupine Tree (All Studio Albums)': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Protest The Hero': Read-only file system
cp: cannot create directory `/media/tmp/media/music/Dream Theater': Read-only file system
cp: cannot create directory `/media/tmp/media/pictures': Read-only file system
cp: cannot create directory `/media/tmp/media/videos': Read-only file system
cp: cannot create directory `/media/tmp/misc': Read-only file system
cp: cannot create directory `/media/tmp/Monster Complete Series (Eng.-Dub)': Read-only file system
cp: cannot create directory `/media/tmp/repo': Read-only file system
c    p: cannot create directory `/media/tmp/web': Read-only file system

Message from syslogd@linux-vwzy at Dec 11 21:48:16 ...
 kernel:[950354.789962] journal commit I/O error

Pardon me for the personal files there, now you know what kind of music I listen to.

I'm not quite sure exactly what's happening here. Are there bad sectors on the hard drive? What does the kernel:[950354.789962] journal commit I/O error message mean?

Whatever the issue, is there a way I can fix this? What if I determine where the issue lies on the disk and never write up that sector, would that work?

Update So supposedly the os ran into too many errors while writing to the disk, and put it into read-only mode as a response. So I guess my only question is if there is a way around this? Is this problem directly related to the size of data I write on the disk (ie if I only write 1G will the data be safe as long as I don't touch those bad parts)?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Unmount the drive and run badblocks -n on it. This will rewrite every sector on the drive — read-then-write, so it's nondestructive — which forces the drive to swap in a fresh sector for every dodgy one found during the pass.

If badblocks can't fix it, you could step up to SpinRite which does that and more.

If either of those "fixes" the drive but you get more data errors later, you have a continual degradation going on, and no fix will be permanent.

share|improve this answer
1  
Sorry about the late reply on this. I ran `badblocks -n on the device a couple times, and each time it found SEVERAL "bad" blocks and would lock my computer up. I've given up on this hard drive unless there are any other options. I will accept this answer seeing as it actually showed me what was wrong with my drive. Thanks. –  MaxMackie Dec 14 '11 at 1:51

The first thing you should do is run a SMART check.

smartctl -t long /dev/whatever

which will tell you it's running a long smart test and roughly how long it will take.

Then run smartctl -l /dev/whatever It will tell you how much of the test has been completed and what errors have been seen. Also if the drive is unusable it will tell you.

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.