LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-31-2019, 02:00 AM   #1
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 193

Rep: Reputation: 19
Question rm command fails w/ "Input/output error", how to fix?


Hello,

I've got an annoying problem where my external hard drive accidentally disconnected as I was copying files to it (the drive is NTFS format so that my Windows machines can also read/write to it). My system is Manjaro Linux with kernel 4.19.

After reconnecting the drive, I wanted to delete those files and start from scratch. However, after running `rm -rf` on the directory in question, it threw several errors on some files in that directory. They look like this:

Code:
rm: cannot remove '[path to file on external hard drive]': Input/output error
This is annoying. Is there a way to fix this without having to re-format the entire partition? Thank you very much!
 
Old 05-31-2019, 03:42 AM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,533
Blog Entries: 1

Rep: Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241Reputation: 2241
Quote:
Originally Posted by penyuan View Post
my external hard drive accidentally disconnected as I was copying files to it (the drive is NTFS format
When this happens, the target filesystem involved must be checked. ntfsfix can fix some NTFS errors using Linux, but more likely you'll need to have Windows do the check. You could try ntfsfix first, but if it was mine I'd go directly to Windows.
 
1 members found this post helpful.
Old 05-31-2019, 04:38 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ I agree, use windows tool to fix NTFS problems!

besides...
Quote:
Originally Posted by penyuan View Post
I've got an annoying problem where my external hard drive accidentally disconnected as I was copying files to it
this should not happen at all!
is there a problem with the cable connection?
has it happened more than once?
you must fix this.

PS:
native linux filesystems are much more robust with these problems!
 
1 members found this post helpful.
Old 05-31-2019, 08:04 AM   #4
WideOpenSkies
Member
 
Registered: May 2019
Location: /home/
Distribution: Arch Linux
Posts: 166

Rep: Reputation: 61
Could read/write permissions have a hand in this?
 
Old 05-31-2019, 09:14 AM   #5
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Contrapak View Post
Could read/write permissions have a hand in this?
No, then you would get a "Permission denied" error, not an "Input/Output" one.
The latter mostly is an hardware (connection TO or bad spots ON the disk) error
but in this case could possibly be a file system one.

I join previous respondants as to run a chkdsk on this ntfs volume from Windows,
it knows better what could be wrong with that fs.
 
1 members found this post helpful.
Old 05-31-2019, 09:20 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,356

Rep: Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003
If that was an ntfs filesystem I recommend you to try to repair it from windows. Also you may try to save/backup your important data (in read-only mode) before fixing it.
 
1 members found this post helpful.
Old 05-31-2019, 10:51 AM   #7
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
I agree with the others; check an NTFS filesystem from Windows, not Linux.

I also agree with ehartman; an "Input/Output" error likely means there is something wrong with the hardware. You should check the hardware itself, post the output of the following command if you're not sure;

Code:
smartctl -a /dev/sdX
Replace "sdX" with the correct device node for the drive in question.
 
1 members found this post helpful.
Old 06-01-2019, 12:17 AM   #8
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 193

Original Poster
Rep: Reputation: 19
Thank you everyone! Very informative tips, here's what I've found so far:

1. Running `smartctl -a /dev/sdb` (the drive shows up at `/dev/sdb`) gives me this error (!):

Quote:
Read Device Identity failed: scsi error unsupported field in scsi command

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
Using the `-T permissive` argument failed to give me any more information... It just gave me this:

Quote:
=== START OF INFORMATION SECTION ===
Device Model: [No Information Found]
Serial Number: [No Information Found]
Firmware Version: [No Information Found]
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: [No Information Found]
Local Time is: Sat Jun 1 12:58:38 2019 CST
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
2. I plugged the drive into a Windows computer, and chkdsk found and repaired issues (without being specific on what the issues were...).

3. I was able to read/write/delete the problematic files in question.

4. I believe the sudden disconnect I experienced was due to a very flimsy USB 3 "micro B" connector on the hard drive enclosure of my Seagate external hard drive. A slight movement would essentially eject it! Are there USB 3+ external hard drives with more robust connectors????

So, here are a couple follow up questions:

a. @ondoho mentioned that Linux filesystems are more robust. Which specifically? Or are they all generally better? My goal is for this external hard drive to be read/writable from Windows systems, too. Is there an option that is better than NTFS??? (I didn't use FAT32 because it doesn't support large files)

b. smartctl couldn't access my external hard drive, is that a very bad sign???

Thank you for your help!

Last edited by penyuan; 06-01-2019 at 12:21 AM. Reason: Added question to point 4.
 
Old 06-01-2019, 12:30 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by penyuan View Post
4. I believe the sudden disconnect I experienced was due to a very flimsy USB 3 "micro B" connector on the hard drive enclosure of my Seagate external hard drive. A slight movement would essentially eject it!
i suspected as much.
Quote:
Are there USB 3+ external hard drives with more robust connectors????
probably yes.

Quote:
@ondoho mentioned that Linux filesystems are more robust. Which specifically?
I can say from experience that I had many unclean shutdowns with ext3 and ext4 systems and work just continued after a reboot.

Quote:
My goal is for this external hard drive to be read/writable from Windows systems, too.
unfortunately my expertise ends there.


Quote:
smartctl couldn't access my external hard drive, is that a very bad sign???
can happen with usb drives.
you could try to take the drive out of the enclosure and directly connect it to the motherboard.
 
1 members found this post helpful.
Old 06-01-2019, 05:54 AM   #10
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by penyuan View Post
...My goal is for this external hard drive to be read/writable from Windows systems, too. Is there an option that is better than NTFS??? (I didn't use FAT32 because it doesn't support large files)
...
You have a couple of options;

1) Use a filesystem that both Windows and Linux have support for, such as FAT32 (but as you say, it will be limited to files no more than 4GiB in size), or keep using NTFS, but you will need to have the ntfs-3g drivers installed on Linux - not all Linux distributions have the ntfs-3g drivers installed by default. Just install the ntfs-3g package in that case.

2) Install a file system driver for a Linux based file system on Windows.
 
1 members found this post helpful.
Old 06-01-2019, 06:17 AM   #11
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 193

Original Poster
Rep: Reputation: 19
Understood, thanks again! Good to know that the smartctl failure is not necessarily a bad sign, though I should find a better external drive next time. Will mark thread as solved for now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
input/output error bad blocks how to fix? BW-userx Linux - Hardware 3 10-08-2016 03:18 PM
Fix input/output error or find correct webcam driver for icecam2? agingcomputer Linux - Hardware 0 03-25-2010 08:06 AM
"failed to execute child process" "Input/output error" fl.bratu Fedora 4 12-15-2008 04:03 AM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM
Repeated "input: AT Translated Set 2 keyboard as /class/input/input" messages AcerKev Mandriva 2 09-16-2007 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration