Ls cannot open directory input output error

My system raised the I/O error when I tried to use 'ls' on a mounted hard disk. I am using hadoop@hbase1:/hddata$ uname -a Linux hbase1 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:...

My system raised the I/O error when I tried to use ‘ls’ on a mounted hard disk.

I am using

hadoop@hbase1:/hddata$ uname -a
Linux hbase1 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64    x86_64 x86_64 GNU/Linux

hadoop@hbase1:/hddata$ df
Filesystem                      1K-blocks       Used Available Use% Mounted on
/dev/mapper/hbase2--vg-root     468028968    2715496 441532304   1% /
udev                              6081916          4   6081912   1% /dev
tmpfs                             2436652        336   2436316   1% /run
none                                 5120          0      5120   0% /run/lock
none                              6091620          0   6091620   0% /run/shm
/dev/sda1                      1922727280  867279740 957771940  48% /hddata
/dev/sdb1                          233191      27854    192896  13% /boot
10.18.103.101:/data/marketdata 1883265024 1644255232 143344640  92% /srv/data/marketdatah

The last several lines of dmesg

hadoop@hbase1:/hddata$ dmesg | tail
[316263.280056] EXT4-fs (sda1): previous I/O error to superblock detected
[316263.281326] sd 0:0:0:0: [sda] Unhandled error code
[316263.281329] sd 0:0:0:0: [sda]
[316263.281330] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[316263.281332] sd 0:0:0:0: [sda] CDB:
[316263.281334] Write(10): 2a 00 00 00 00 3f 00 00 08 00
[316263.281342] end_request: I/O error, dev sda, sector 63
[316263.282584] Buffer I/O error on device sda1, logical block 0
[316263.283799] lost page write due to I/O error on sda1
[316263.283842] EXT4-fs error (device sda1): ext4_find_entry:1270: inode #2: comm bash: reading directory lblock 0

tshepang's user avatar

tshepang

11.9k21 gold badges90 silver badges134 bronze badges

asked Sep 16, 2013 at 2:56

Vimos's user avatar

Buffer I/O error on device sda1, logical block 0

This sort of thing is indicative of an impending hardware failure. I’d do what you can to back up everything you need to somewhere else and replace the drive before it fails irreparably.

answered Sep 16, 2013 at 3:19

Robin Sheat's user avatar

I have my local NAS on the base of Cubietruck (Ubuntu Xenial with Armbian Linux 3.4.113-sun7i) with smbd for samba shares. As storage extension I use 2 TB Western Digital SSD connected via USB and automatically mounted on startup with fstab on /mnt/wd1:

UUID=0e32bef4-78a1-4172-bc7d-de2d74f9b092       /mnt/wd1        ext4    defaults,noatime,nodiratime,commit=600,errors=remount-ro,x-gvfs-hide    0       1 

There are 2 folders on this SSD with owner for samba user and with appropriate permissions:

root@Artisan:~# ls -la /mnt/wd1
total 16
drwxrwxr-x 4 artisan artisan 4096 Nov 22 19:36 .
drwxr-xr-x 3 root    root    4096 Nov 22 19:27 ..
drwxrwxr-x 2 artisan artisan 4096 Nov 22 19:36 Other
drwxrwxr-x 3 artisan artisan 4096 Dec 12 11:44 Video

Here’s part of smb.conf

security = user
passdb backend = tdbsam
unix charset = utf-8
dos charset = cp932

[Music]
path = /ncsdata/Music
comment = Music
read only = no
writeable = yes
browseable = yes
create mode = 0775
directory mode = 0775
valid users = artisan
force user = artisan
guest ok = no

[Video]
path = /mnt/wd1/Video
comment = Video
read only = no
writeable = yes
browseable = yes
create mode = 0775
directory mode = 0775
valid users = artisan
force user = artisan
guest ok = no

«Music» is located on local Cubietruck storage and works perfectly for read/write. «Video» is located on mounted SSD and allows reading, but writing from windows laptop ends in undefined time (seconds to minutes) or allows to completely write file and stops on the next file with error «There is a problem accessing //ARTISAN/Video». After all I can’t access it even from root account:

root@Artisan:~# ls -la /mnt/wd1/Video
ls: reading directory '/mnt/wd1/Video': Input/output error

SSD stays mounted:

root@Artisan:/mnt/wd1# df
Filesystem      1K-blocks      Used  Available Use% Mounted on
udev               955288         0     955288   0% /dev
tmpfs              201412      3556     197856   2% /run
/dev/sda1       922976468 674280112  201811784  77% /
tmpfs             1007056       140    1006916   1% /dev/shm
tmpfs                5120         4       5116   1% /run/lock
tmpfs             1007056         0    1007056   0% /sys/fs/cgroup
tmpfs             1007056       108    1006948   1% /tmp
/dev/mmcblk0p1    7529608   3235512    4189700  44% /media/mmcboot
/dev/sdb1      1968975652   1964664 1866992812   1% /mnt/wd1
armbian-ramlog      51200       344      50856   1% /var/log
tmpfs              201412         8     201404   1% /run/user/1000
overlaid           201412         8     201404   1% /run/user/1000/ncadmin-chromium
tmpfs              201412         0     201412   0% /run/user/0

After reboot the mount is accessible again. What could be a problem?

UPD: After some time mount is actually gone:

root@Artisan:~# df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev              955288         0    955288   0% /dev
tmpfs             201412      3560    197852   2% /run
/dev/sda1      922976468 674248620 201843276  77% /
tmpfs            1007056       140   1006916   1% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs            1007056         0   1007056   0% /sys/fs/cgroup
tmpfs            1007056       108   1006948   1% /tmp
/dev/mmcblk0p1   7529608   3235512   4189700  44% /media/mmcboot
armbian-ramlog     51200      7220     43980  15% /var/log
tmpfs             201412         8    201404   1% /run/user/1000
overlaid          201412         8    201404   1% /run/user/1000/ncadmin-chromium
tmpfs             201412         0    201412   0% /run/user/0

  • Remove From My Forums
  • Question

  • I created the Windows Server 2012 share using: 

    PS C:Windowssystem32> nfsshare testshare2=C:testshare2 -o anon=yes anonuid=0 anongid=0 rw=uuu.uuu.uuu.uuu
    ntestshare2 was shared successfully

    Where *uuu.uuu.uuu.uuu* is the IP of my Ubuntu system. 

    Next, from the Ubuntu machine I mounted the Windows NFS share as follows:

    sudo mount -t nfs xxx.xxx.xxx.xxx:/testshare2 /mnt/testshare2

    Where *xxx.xxx.xxx.xxx* is the IP of the Windows Server 2012 machine.

    No errors are shown when mounting, but when I `ls` the mounted directory, the following appears:

    `ls: cannot open directory /mnt/testshare2/: Input/output error`

    I’m not showing any errors in Ubuntu’s syslog.

    Here are properties of the share in Server 2012.   (EDIT — The system will not let me attach a link or image due to my account not being verified, and I am unable to locate how/where to get my account verified. :-/)  

    The screenshot is on imgur.com /  edGEaVt

    Edit 1:
    I get the same input/output error when attempting to mount the Server 2012 NFS share from a RHEL7 machine. Mount works fine I just can’t ls directory or touch files.

    Edit 2:
    In Server 2012, the NFS log shows a successful mount to both Ubuntu and RHEL machines.

    • Edited by

      Wednesday, March 2, 2016 8:26 PM

Answers

  • I may have found the problem.  I initially created the share by right clicking a folder name and using the NFS Sharing tab.   I just deleted that share/folder and set up a new share using the Wizard in Server Manager.   I’m able to read
    and write data to the share from my RHEL7 machine.   

    So no, this wasn’t a hardware issue with Linux.. just a config issue with 2012 which I suspected.   :-)

    • Marked as answer by
      Mary Dong
      Tuesday, March 15, 2016 6:31 AM

Input/output error when accesing a directory

Hi

I have a directory «foo» on a NTFS partition of my hard drive, which i created a couple of days ago.
After creation it worked fine and i put some files in it, but the day after i get the following error:

me@mymachine:/media/disk1$ ls -l foo
ls: cannot access foo: Input/output error

me@mymachine:/media/disk1$ ls -l
ls: cannot access foo: Input/output error
total 101
d????????? ? ? ? ? ? foo
(+ a succesful listing of other files and directories)

I get the Input/output error no matter what i try to do to the directory (rm, mv, cd, etc.), and no matter which privileges i have.

I read some threads suggesting that it is a hardware problem. I tried running ntfsfix on the partition:

me@mymachine:~$ sudo ntfsfix /dev/sda3
Mounting volume… OK
Processing of $MFT and $MFTMirr completed successfully.
NTFS volume version is 3.1.
NTFS partition /dev/sda3 was processed successfully.

I have also run the short and the long SMART test from the disk utility, resulting in the overall assessment: Disk is healthy.

It would be nice to know how to recover the data in the directory, but i have backup so that part is not crucial. I could also reformat the whole drive to ext4, which I eventually would have done in any case. Or i could just ignore the defective folder which does not harm anyone.
However if this problem is the first warning of a failing drive, I would rather get a new drive now, before some more important data suddenly disappear.

My question is now, what course of action i should take.
Is there any other diagnostics that i could try? Is it a soft- or hardware related issue. Should I begin looking for a new hard drive?


Arrow Re: Input/output error when accesing a directory

That most definitely seems like a bad hard drive.

Of course a hardware problem elsewhere could also cause data/file system corruption. Do you have reason to suspect it could be anything else? Upgraded your CPU or RAM lately?

Eternally confused.


Re: Input/output error when accesing a directory

Thanks for the reply.
Nope, no hardware changes. I’ve been running Hardy to Karmic on unchanged hardware without problems of this kind before.
I guess I should look into changing the disk. However it would be nice to be able to verify that the hardware is to blame.


Re: Input/output error when accesing a directory

Quote Originally Posted by tjoff
View Post

Thanks for the reply.
Nope, no hardware changes. I’ve been running Hardy to Karmic on unchanged hardware without problems of this kind before.
I guess I should look into changing the disk. However it would be nice to be able to verify that the hardware is to blame.

You answered your own question. Try a Karmic.live CD and see if the problem still occurs.

I try to treat the cause, not the symptom. I avoid the terminal in instructions, unless it’s easier or necessary. My instructions will work within the Ubuntu system, instead of breaking or subverting it. Those are the three guarantees to the helpee.


Re: Input/output error when accesing a directory

Thank you for taking the time to answer me.

Regarding booting from a live-CD:

I tried it, the problem persists.
I still wonder however, what I have proved by booting from the live CD.
How should I be able to distinguish between a corrupted filesystem (in which case the problem can be solved by reformatting the drive), and a physically failing hard drive (in which case the solution is to exchange the drive)?

I was hoping to be able to make some kind of diagnostics for the hard drive, which could give me a more verbose error message than «Input/output error», and indicate the what causes the error.
I did all the tests from the disk utility tool, and none indicate any problems.

A definite proof or disproof that the hardware is failing would, apart from assuring myself that it is necessary to change the drive, come in handy as there is still a valid guarantee on the computer.


Re: Input/output error when accesing a directory

I tried to boot with windows xp, and chkdsk or whatever it is called found the errors and deleted the corrupted directory.
In ubuntu i no longer have any indication of the problem. I guess it was a software problem after all, and that ntfsfix was not able to fix the ntfs.


Re: Input/output error when accesing a directory

huhuhu,
me also encountered the same thing as yours, tjoff.

the case in me is that,
my ftp mounted directory seems can not accept
some files after cp operation… Geeez…


Понравилась статья? Поделить с друзьями:

Читайте также:

  • Ls cannot access input output error
  • Low heat error xerox 3215
  • Lotus script on error
  • Lotro game error 128
  • Lost connection to mysql server at reading initial communication packet system error 104

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии