Command rm deletes filename but not the blocks


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Command rm deletes filename but not the blocks
# 1  
Old 01-16-2012
Command rm deletes filename but not the blocks

Hi

It happens when I try to delete a file of 250MB with the command rm -r on our old Intergraph CLIX that the filename disappears while the blocks remain on the machine. Only when I reboot the system the blocks really disappear. Then rm works again for sometime but after some time it happens again ...

Can someone please help me?
Thank you.
# 2  
Old 01-16-2012
That is because at least one process or someone is still holding the file open...
Why -r ? this argument is for recursive, makes no sense with only one file, I would have expected more -f...
Next time before deleting, try to find out who is using the file, if its a daemon or a logger, stop it before to use rm, there is a command if installed: lsof (list open files...) that is just what you will need if you don't know... so a good start is to see if you have the man pages of this command:
Code:
man lsof

# 3  
Old 01-16-2012
I am doing it that way since 20 years and it always worked without problems. This happens since about two weeks. The file is a scan file and no one else is using it.

Code:
man lsof

gives the result man: lsof not found
# 4  
Old 01-16-2012
Try the unix "fuser" program on the individual file or files. The output from "fuser" is the process IDs if any programs which have the file open.
Code:
fuser filename

# 5  
Old 01-16-2012
The file is no longer visible after a directory listing.
# 6  
Old 01-16-2012
Obviously run "fuser" before considering "rm".
# 7  
Old 01-16-2012
For 20 years there was no reason to use "fuser". Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Can I run repair on lot of blocks with single command ?

Hi, I have Solaris-10 OS on T5220. Both local disks were mirrored under SVM. Somehow when one disk gone bad (c0t1d0), other disk (c0t0d0) also got lot of bad block. We have readable data only on c0t0d0, but as soon as server comes after, it hangs when I run few commands because of read errors,... (1 Reply)
Discussion started by: solaris_1977
1 Replies

2. UNIX for Dummies Questions & Answers

sed command that deletes lines with 3-5 digit strings

Hello! My final exam in my Linux class is tomorrow, and I was just reviewing the grep and sed commands. I came across an example, by which I got stumped: it asks to provide a sed command that deletes all lines that contain exactly 3 to 5 digit strings, from a file. In this case, I created a... (3 Replies)
Discussion started by: kalpcalp
3 Replies

3. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

4. Slackware

Thunderbird 3.1.9 deletes from drafts

I am using Tbird as it came with Slackware 13.37 and everytime I send something I get a message 1 or 2 drafts deleted. Should it be doing that? If not has this been reported ? How can I find out if it was reported? I have no drafts to delete. (2 Replies)
Discussion started by: slak0
2 Replies

5. Shell Programming and Scripting

Why sed command deletes last line in a file if no carriage return?

Hi I am using sed command to make SCORE=somevalue to SCORE=blank in a file. Please see the attached lastline.txt file. After executing the below command on the file, it removes the last line. cat lastline.txt | sed 's/SCORE=.*$/SCORE=/g' > newfile.txt Why does sed command remove the... (3 Replies)
Discussion started by: ashok.k
3 Replies

6. Shell Programming and Scripting

A script that deletes files.

I want to write a script that deletes files inside the dir. However, the script should also allow the user to confirm by pressing (d) key before deleting files.. #!/bin/bash for file in $1/* do size='ls -l $file | cut -f 5 -d " "' name='ls -l $file | cut -f 9 -d " "' ... (1 Reply)
Discussion started by: herberwz
1 Replies

7. Shell Programming and Scripting

how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello, I have a file like this: FILE.TXT: (define argc :: int) (assert ( > argc 1)) (assert ( = argc 1)) <check> # (define c :: float) (assert ( > c 0)) (assert ( = c 0)) <check> # now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Discussion started by: paramad
5 Replies

8. UNIX for Dummies Questions & Answers

Convert 512-blocks to 4k blocks

I'm Unix. I'm looking at "df" on Unix now and below is an example. It's lists the filesystems out in 512-blocks, I need this in 4k blocks. Is there a way to do this in Unix or do I manually convert and how? So for container 1 there is 7,340,032 in size in 512-blocks. What would the 4k block be... (2 Replies)
Discussion started by: rockycj
2 Replies

9. Shell Programming and Scripting

Help with Script using Command Blocks

Hello, I am trying to create a shell script that use command block (donīt really know if this is the correct way to say it), but while one version works fine, the other one is not working at all. So let me show an example of this "command block" Iīm using and its working ok: cat << _EOF_ `echo... (7 Replies)
Discussion started by: Alexis Duarte
7 Replies

10. UNIX for Dummies Questions & Answers

Multi line deletes

I would like to be able to delete the first n lines of a file from inside of a ksh script. I am not sure how to achieve this or if it is possible. Could someone please help. Thanks in advance. (5 Replies)
Discussion started by: rehoboth
5 Replies
Login or Register to Ask a Question