How do you delete files that are seemingly missing inodes?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do you delete files that are seemingly missing inodes?
# 1  
Old 02-02-2009
How do you delete files that are seemingly missing inodes?

I have some files that appear to have no inode numbers. To complicate the matter, the filenames have UTF8 (I think) characters.

I am trying to delete them. In fact, and this might make things easier, I'm trying to delete their parent directory.

I don't know what to try next, please help.

Thanks,
Ryan

Ok here are the symptoms:
1) rm appears to have no effect. so does unlink. so does rmdir on the parent directory.
Code:
$ ls
Andre?? 3000 Feat. Kelis  Les Mise??rables  ???????????? ???  ??????????????????  ???????????????
$ rm -rf André\ 3000\ Feat.\ Kelis
$ ls
Andre?? 3000 Feat. Kelis  Les Mise??rables  ???????????? ???  ??????????????????  ???????????????

2) More pushy rm options lead to more mystery:
Code:
$ rm -d André\ 3000\ Feat.\ Kelis 
rm: cannot remove `Andre\314\201 3000 Feat. Kelis': No such file or directory

3) Really can't find them?! Bc they think they're there:
Code:
$ find . -print
.
find: ./宇多田ヒカル: No such file or directory
find: ./André 3000 Feat. Kelis: No such file or directory
find: ./早稲田大学: No such file or directory
find: ./佐村河内 守: No such file or directory
find: ./Les Misérables: No such file or directory

4) How come they have no inodes?
Code:
$ ls -ial
total 40
5783555 drwxr-xr-x 10 farl farl 36864 Feb  1 21:53 .
5783553 drwxr-xr-x  3 farl  121  4096 May 21  2008 ..
      ? ?---------  ? ?    ?        ?            ? Andre?? 3000 Feat. Kelis
      ? ?---------  ? ?    ?        ?            ? Les Mise??rables
      ? ?---------  ? ?    ?        ?            ? ???????????? ???
      ? ?---------  ? ?    ?        ?            ? ??????????????????
      ? ?---------  ? ?    ?        ?            ? ???????????????
$ ls -Qi
0 "Andre\314\201 3000 Feat. Kelis"
0 "Les Mise\314\201rables"
0 "\344\275\220\346\235\221\346\262\263\345\206\205 \345\256\210"
0 "\345\256\207\345\244\232\347\224\260\343\203\222\343\202\253\343\203\253"
0 "\346\227\251\347\250\262\347\224\260\345\244\247\345\255\246"

5) fsck says everything is ok
Code:
$ sudo fsck.ext3 /dev/sdb2
e2fsck 1.40-WIP (14-Nov-2006)
/dev/sdb2: clean, 60692/59834368 files, 74016803/119652120 blocks 
$ sudo fsck.ext3 -vf /dev/sdb2              
e2fsck 1.40-WIP (14-Nov-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

   60693 inodes used (0.10%)
    5639 non-contiguous inodes (9.3%)
         # of inodes with ind/dind/tind blocks: 32097/910/0
74016804 blocks used (61.86%)
       0 bad blocks
      16 large files

   59067 regular files
    1556 directories
       0 character device files
       0 block device files
       0 fifos
    6044 links
      60 symbolic links (0 fast symbolic links)
       0 sockets
--------
   66727 files

# 2  
Old 02-02-2009
Probably you already tried it :

find . -exec /bin/rm -f {}
# 3  
Old 02-02-2009
Yeah, same results as trying to manually rm them.
Code:
$ ls
Andre?? 3000 Feat. Kelis  Les Mise??rables  ???????????? ???  ??????????????????  ???????????????
$ find . -print -exec /bin/rm -f {} \;
.
/bin/rm: cannot remove `.' or `..'
find: ./????????????: No such file or directory
find: ./Andr? 3000 Feat. Kelis: No such file or directory
find: ./??????????: No such file or directory
find: ./???????? ??: No such file or directory
find: ./Les Mis?rables: No such file or directory
$ ls
Andre?? 3000 Feat. Kelis  Les Mise??rables  ???????????? ???  ??????????????????  ???????????????

I hope there is an easy answer. So far, the only thing I can think of is a bit drastic: somehow forcibly orphan the files/directory or remove their references from the directory structure and let fsck handle the aftermath---although I have no clue how to do that.
# 4  
Old 02-02-2009
Look carefully at your man page for fsck. There should be a option like -f to force it to do a full check. Unmount the file system, rerun fsck with the force option, and see if that fixes it.

If this doesn't work, tell us the name of your OS so we don't have to guess. Solutions to stuff like this are very OS specific. It seems to be linux, but what release of which distro?
# 5  
Old 02-02-2009
$ uname -ar
Linux maclir 2.6.18-5-ixp4xx #1 Thu Aug 30 16:47:13 UTC 2007 armv5tel GNU/Linux

This is a Linksys NSLU2 running Debian 4.0. Files in question are on an ext3 partition on an external USB drive and is not the root partition.

Perderabo: fsck -f output is in original post.
# 6  
Old 02-02-2009
I hope you have a backup of that disk.

If your fsck is accepting directory entries like that, I must suspect a bug. So my first approach would be find a better version of fsck. Are your patches up to date? If you can find a patched version of fsck, try that.

The safest way out is a fair amount of work... Do a mkfs and reload all of the files.

There is, perhaps, a way to do what you want. I have never done it on Linux, but I have done it on HP-UX. So I am locating the similiar linux commands and guessing that they might work. Caution, I have never tried anything like this in linux.

You need to destroy that directory. A directory is actually a file and it has datablocks allocated to it. Each directory entry is a pair of items: a name and an inode number. Your directory has entries pointing to invalid inode numbers. To destroy that directory, use "ls -id /path/to/directory" to get the inode of that directory. Then destroy that inode and rerun fsck. The clri command is what I used on HP-UX and on linux, it is not a separate command, it is part of debugfs. So it goes something like:

1 find inode number of directory
2 umount /dev/sdb2
3 debugfs -w /dev/sdb2
4 at the debug prompt, clri 1234
5 at the debugfs prompt, quit
6 fsck -f /dev/sdb2

But I'm not gonna try that on my system... you first... Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Mismatched free() / delete / delete [] line no missing

Could you tell me the possibilities of the reason to get the Mismatched free() / delete / delete . I unable to see the line no in the valgrind report. it displays the function name. with that function name, I am not able to find where exactly the issue is there.I am getting the Mismatched free()... (3 Replies)
Discussion started by: SA_Palani
3 Replies

2. Shell Programming and Scripting

Seemingly simple sed, delete between matching lines

There are many matching blocks of text in one file that need to be deleted. This example below is one block that needs to be either deleted or replaced with an empty line. This text below is the input file. The ouput file should be empty Searching Checks. Based on search criteria name: Value :... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies

3. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

4. UNIX for Dummies Questions & Answers

Delete data blocks based on missing combinations

Hello masters, I am filtering data based on completeness. A (Name , Group) combination in File2 is only complete when it has data for all subgroups specified in File1. All incomplete (Name , Group) combinations do not appear in the output. So for example , Name1 Group 1 in File2 is... (6 Replies)
Discussion started by: senhia83
6 Replies

5. Shell Programming and Scripting

Regular expression, seemingly simple but

Hello, I want to test a hour variable with an expression regular The format is 00 01 02 03.......19 20 21 22 23 what follows in red doesn't work, it's clear 19 for example can't work. Can you help me the right regular expression ? case "$3" in () # Nothing, OK ! ;; (*) echo... (4 Replies)
Discussion started by: amazigh42
4 Replies

6. Shell Programming and Scripting

How to take the missing files

Hi all , am using unix ksh I have a lots of files in /prb directory in the format as .. .. .. .. MMRR0607.DAT_2012 MMRR0707.DAT_2012 MMRR0907.DAT_2012 MMRR1107.DAT_2012 ... .. MMRR3107.DAT_2012 MMRR0208.DAT_2012 .. I need the output as Missing files are:- MMRR0807.DAT_2012 (note... (4 Replies)
Discussion started by: Venkatesh1
4 Replies

7. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

8. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

9. Shell Programming and Scripting

echo and then cp the missing files

Hi.... I have two files abc.txt and xyz.txt. I want to echo and copy files from abc.txt to xyz.txt, which are not in xyz but present in abc.txt. Both of these files are in same directory. Please provide code with while or for loop.... :) (3 Replies)
Discussion started by: tushar_tus
3 Replies

10. UNIX for Dummies Questions & Answers

files missing

a few of some live payroll files have been deleted / missing ... i've restored last nites backup ... what could be the possibilities of this strange occurance ... users have menus to work on and use these live files ... we run an aix box with a ksh shell. Where do I start ?? Thanks (4 Replies)
Discussion started by: cubicle^dweller
4 Replies
Login or Register to Ask a Question