2

I have an external USB drive mounted to my 14.0.4 server (which lacks any GUI that I'm aware of). The contents of this drive were created while it was attached to a windows desktop. That computer has since been converted into this 14.0.4 server. I'm attempting to do some basic cleanup (deletions, reorganization) and one folder is giving me fits.

If I attempt to rm -rf the folder, it will tell me that one directory is not empty, and the other encountered an input/output error:

root@swerver:/media/Cavalry# rm -rf .ReadyDLNA/
rm: cannot remove ‘.ReadyDLNA/art_cache/tmp/mnt/sdb1/My Music/Gogol Bordello - Gypsy Punks (Underdog World Strike)’: Input/output error
rm: cannot remove ‘.ReadyDLNA/art_cache/tmp/mnt/sdb1/My Music/Gogol Bordello - Multi Kontra Culti vs. Irony’: Directory not empty

If I descend into the "My Music" folder which is the parent of the two offending items in order to get a better look at them, I actually find a bit more stuff there:

total 33325
drwxrwxrwx 1 root root   49152 Nov 11 18:31 .
drwxrwxrwx 1 root root       0 Nov 10 23:15 ..
-rw-rw-rw- 1 root root       5 Nov 11 18:29 Bloc Party - Silent Alarm
-rw-rw-rw- 1 root root 2270543 Jan  6  2009 Bloc Party - Silent Alarm Remixed
-rw-rw-rw- 1 root root 2189756 Jan  6  2009 Breeders - Pod
-rw-rw-rw- 1 root root 2430533 Jan  6  2009 Cake - Comfort Eagle
-rw-rw-rw- 1 root root 2230473 Jan  6  2009 Clap Your Hands Say Yeah - Clap Your Hands Say Yeah
-rw-rw-rw- 1 root root 1386336 May 25  2014 Dead Milkmen - Eat Your Paisley!
-rw-rw-rw- 1 root root 1887902 May 25  2014 Dead Milkmen - Stoney's Extra Stout (Pig)
-rw-rw-rw- 1 root root 3479647 May 25  2014 De Facto - Legende Du Scorpion A Quatre Queues
-rw-rw-rw- 1 root root 2614188 May 25  2014 De facto - Megaton Shotblast
-rw-rw-rw- 1 root root 1893161 May 25  2014 Deftones - Around The Fur
-rw-rw-rw- 1 root root 4954770 May 25  2014 Elliott Smith - Songs From a Basement on the Hill
-rw-rw-rw- 1 root root 4326380 May 25  2014 Faith No More - Angel Dust
-rw-rw-rw- 1 root root 2334275 May 25  2014 Frank Black - Teenager of the Year
-rw-rw-rw- 1 root root 2046463 Nov 11 18:29 Girl Talk - Secret Diary
d????????? ? ?    ?          ?            ? Gogol Bordello - Gypsy Punks (Underdog World Strike)
drwxrwxrwx 1 root root    4096 Nov 11 18:37 Gogol Bordello - Multi Kontra Culti vs. Irony

Attempting to remove the offending items produces similar output. Attempting to remove this other stuff produces different errors:

rm: cannot remove ‘Bloc Party - Silent Alarm’: No such file or directory
rm: cannot remove ‘Bloc Party - Silent Alarm Remixed’: No such file or directory
rm: cannot remove ‘Breeders - Pod’: No such file or directory

Those files obviously are there. I am doing this as root. I am unable to move or rename the files: No such file or directory. I am able to echo/redirect contents into the files to overwrite them without issue. I am able to use programs like nano to open them and save them without error. I just can't delete them.

Thoughts?

  • Is the drive formatted NTFS? – user508889 Nov 12 '16 at 1:46
  • It is. The way it works is that I originally created the volume when it was attached to my computer as a Windows server. Then I at some point unmounted it and connected it to my Netgear router's USB port, which created this .ReadyDLNA folder from the built-in media streaming service, which I disabled due to the performance impact it had on my network. I then reattached it to the Windows computer, which became my Ubuntu server. I came across the .ReadyDLNA folder and decided it had no business being there anymore, and am now in the situation of being unable to remove it by any normal means. – disord3r Nov 12 '16 at 17:26
  • Do you have a windows machine to plug it into and test file deletion? If it were me, I would use windows to get your data elsewhere, then format the drive to ext4, and then copy your data back on to it. If this is possible for you. – user508889 Nov 12 '16 at 17:33
1

The "Gypsy Punks" line starts "d?????????" which indicates that the directory entry is corrupt. I recommend backing up what you can from the USB drive and running fsck (file system consistency check) on the drive. You can use "df" or "fdisk" to determine the device name of your USB drive (e.g. /dev/sdb) and the partition within the drive (e.g. /dev/sdb1). You can then use "fsck" to scan and attempt to repair the file system. Note that since the fsck command will change the USB drive there is a risk that you will lose data on that drive.

sudo fdisk -l                 # to determine the partition name
umount partition_name         # since fsck will not work on a mounted drive
sudo fsck -a partition_name   # using the appropriate

Note that option -a will automatically apply all changes. Leave that off if you want to run fsck interactively.

After the directory table has been repaired by fsck you should not see question marks in the "ls -l" output and you should be able to delete the files that you want.

See https://linux.die.net/man/8/fsck for details on fsck.

  • fsck didn't find anything meaningful. Or rather, ntfsfix didn't find anything meaningful (had to symlink ntfsfix to fsck.ntfs first, then the output indicated no problems). I shall continue searching. – disord3r Nov 12 '16 at 17:18
  • root@swerver:/# fsck /dev/sdc1 fsck from util-linux 2.20.1 Mounting volume... OK Processing of $MFT and $MFTMirr completed successfully. Checking the alternate boot sector... OK NTFS volume version is 3.1. NTFS partition /dev/sdc1 was processed successfully. – disord3r Nov 12 '16 at 17:26
  • I may be quite wrong to say that the directory is corrupt - it may simply not have "x" permission set, although it's odd that the directory itself shows as d?????????. Try running `chmod +x "Gypsy Punks" to see if that improves things. Alternatively try repairing the USB drive in a Windows machine? If it doesn't detect a problem can you use Windows to delete the apparently corrupt directory? A more extreme solution is to copy the entire USB drive to another disk, reformat the USB drive, and put the files back again. – Jeffrey Ross Nov 15 '16 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.