Operating System - HP-UX
1833622 Members
3668 Online
110062 Solutions
New Discussion

Re: can't umount / remove files

 
Ragni Singh
Super Advisor

can't umount / remove files

hey all,

I have a file in the directory that I am unable to remove. Doing a ls shows the file exists. But when I do a rm , mv, it tells me that it cannot cannot access: No such file or directory. The file is neon.dump.Z.1112. Any help is greatly appreciated.
11 REPLIES 11
Stefan Farrelly
Honored Contributor

Re: can't umount / remove files

Try it with a ./ in front of it;

rm ./* (put a * on the end)

If all else fails unmount the filesystem, run a full fsck on it, and remount. If its corrupt the fsck will prompt to remove its inode entry. We had a similar problem just today - lost an entire directory to some sort of corruption, only fsck could clear it up.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Simon Hargrave
Honored Contributor

Re: can't umount / remove files

Most likely the file has a special character in its name and when you specify its filename you're not actually specifying its "proper" name.

Do rm -i * in the directory where the file is. Say no to ALL other files, and yes when the file you want to delete is displayed.

Or, depending on the filename, you should be able to do a wildcard match.
Jim Butler
Valued Contributor

Re: can't umount / remove files

I also believe you have special characters in the file name. list it and pipe it to cat -v

ls -l | cat -v

This will show misc characters, and then you can remove it.
Man The Bilge Pumps!
Armin Feller
Honored Contributor

Re: can't umount / remove files

Hi,

to move the selected file to a better name, use ls() -i to locate
the file's inode value. Then:

find . -inum 12345 -ok mv '{}' new_file_name \;

"-ok" is a safety check, prompting you for confirmation of the
command it is about to execute. You can use "-exec" instead to avoid
the prompting. The value 12345 is the result of ls() -i command.

Best regards ;-))
Armin
Armin Feller
Honored Contributor

Re: can't umount / remove files


Perform the following steps to remove files that contain special
characters:

1. ll -i | more

Note: Verify the file's inode.

2. find . -xdev -inum # -exec ll {} \;

Note: Verify ll of the inode.

3. find . -xdev -inum # -exec rm -i {} \;

Note: Confirm the deletion of each file.
Sandip Ghosh
Honored Contributor

Re: can't umount / remove files

You can follow as the experts says above, otherwise you can do as follows:
#ls -l>test
#vi test
Remove all the lines except the required one.
put a rm -r before the file.
then run sh test.

when you are redirecting the directory listing to a file it will give you all the characters associated with that filename.

Sandip
Good Luck!!!
Wilfred Chau_1
Respected Contributor

Re: can't umount / remove files

There maybe some control characters in the filename which is not shown, like a back space.

If possible, move all needed files to a temp dir, with the only file left in the current dir, rm *
Steven E. Protter
Exalted Contributor

Re: can't umount / remove files

Standard suggestion.

cd to the directory the file is in.

type rm -f neon

then hit escape escape. The shell should fill in the rest of the filename, special characters and all.

You might want to check and see if there is a softlink from another filesystem here. You know, like print spools have links from /usr/spool to /var/spool so the print data lands on var.

-f says, I don't care, get rid of it.

As am interesting aside, I once has a problem like this.

root fs got full. I went through the whole thing, found nothing big.

Then I started unmounting filesystems.

After unmounting /schmobagel I cd' into it.

What did I find? Files, tons of them, which got copied in by a cron job while I had it unmounted.

You see when you mount a filesystem you need a folder by the same name. If you copy stuff in while its not mounted, when you mount, you can't see whats there, but its on the root fs.

Probably useless but its a cool story.

Steve
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
W.C. Epperson
Trusted Contributor

Re: can't umount / remove files

Steve's story should be useful as well as cool. I scratched my head about root FS space usage for months on my first 7.0 system YEARS ago before I stumbled across a completely populated /usr/bin underneath the /usr FS mountpoint.
"I have great faith in fools; self-confidence, my friends call it." --Poe
Steven E. Protter
Exalted Contributor

Re: can't umount / remove files

Well W.C. perhaps another post for most embarassing moment thread?

In my shop the only two that knew about it are me and my backup.

Steve
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
W.C. Epperson
Trusted Contributor

Re: can't umount / remove files

Nah. Like most sysadmins my most embarrassing moment involves a space between the * and the rest of the filespec in an rm command. Oh, yeah, then there was the time I ran "initrin" on an HP3000 to find out what it did....
"I have great faith in fools; self-confidence, my friends call it." --Poe