0

I have a WD 1 TB hard disk. Recently in some folders on the disk I began to observe pictures, similar to the following:

ls: cannot access 'dataset.py': Input/output error
ls: cannot access 'vgg.py': Input/output error
total 198728
drwxrwxrwx 1 master master      4096 Jul 21 17:23 ./
drwxrwxrwx 1 master master      4096 Aug 14 19:35 ../
drwxrwxrwx 1 master master      4096 Jun  9 10:11 data/
-????????? ? ?      ?              ?            ? dataset.py

I want to remove files like 'dataset.py' and backup data, with final step being disk formatting.

How to remove these malicious files?

4
  • 4
    Possibly a failing disk. Stop what you're doing right now, avoid powering off the disk, boot from a USB and make backups immediately. If that's a failing disk, the more you mess with filesystem the bigger chance of data loss.
    – gronostaj
    Aug 15, 2020 at 7:28
  • 3
    I would add to @gronostaj recommendation: don't make backups to your usual backup disk, because you could overwrite an old correct version by a newer corrupt version. Use a different disk for this.
    – xenoid
    Aug 15, 2020 at 8:52
  • @xenoid, do you mean the files are corrupted? I thought it's about the disk's filesystem as a whole. Aug 15, 2020 at 12:29
  • It's the file system. But it is no longer trustable. Of course there are error checks etc, but sh*t happens, you can have crossed pointers and such. Don't take chances.
    – xenoid
    Aug 15, 2020 at 12:56

2 Answers 2

1

Use smartmontools to doubleck your drive health. When having reallocated sectors or pending sectors p.e. duplicate the drive onto a healthy one.

On the duplicate have your file system verify its content completely. If you have unreadable sectors, the file system will mark the clusters these sectors are located in.

You won't have physical sector errors on the target drive anymore but you will loose the content of broken sectors on your source drive.

Then run run checkdsk Z: /f /r /x where Z denotes your drive letter on your target drive.

2
  • The issue was indeed due to corrupted drive sectors Jul 23, 2022 at 18:54
  • Thank you for giving that feedback!
    – r2d3
    Jul 24, 2022 at 18:05
0

Read about mount/umount

In my case directory had be unmount, to be deleted itself or its subdirectories/files

sudo umount -f /media/sami/OS\ WIN7

Then simply sudo rm -rf sami/OS\ WIN7 worked for me

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .