Avatar of SooHow Cheng
SooHow Cheng
Flag for Singapore asked on

Can't rm -rf the directory with error being "Text file busy", how to solve it?

This is using a SLES 12. On this SuSE server, we map to a remote CIFS share with the relevant credentials.
This is the cifs mapped share:

//                cifs   401G   18G  384G   5% /mnt/YTAPxxx-RRR

Browse to /mnt/YTAPxxx-RRR/500000/2021-Jul-13/, there are those updated *.csv files. However, if you attempt to delete (rm) any one of this csv file, the error - rm: cannot remove `lpp_0902.csv': Text file busy.

Ever checked with these commands - lsof | grep -i 2021-Jul-13 or fuser /mnt/YTAPxxx-RRR/500000/2021-Jul-13/, both show none.

What's went wrong with these csv files? how to solve it?

Thanks in advance.


Avatar of undefined
Last Comment
SooHow Cheng

8/22/2022 - Mon
Seth Simmons

is there another system that has a mapping to that cifs share where someone has the files open?
lsof might not show anything open there, but that is a remote cifs share and could be open somewhere else that has DCS mounted (or mapped in windows)
suggest looking at the server that hosts that share and see what it shows for open files

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Duncan Roe

If a remote system has the file open, it will show as open by some local process (samba, nfs, ...).
OP showed output from df - what is output from mount?
"Text file busy" is usually associated with memory-mapped files

If I am understanding this correctly, your SLES 12 is mapping a share on some server.

You can only check the open files for your local machine, but the server or other clients using the same share may also (not visible to the SLES) have files open/locked.
The only machine really aware of any open files is - so you have to run lsof (or the equivalent tool on there to really see what process is locking the file.

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

then again: is the file actually a csv file?   "text file" is also an alias for a program file. if a program is running all files associated with it are locked and cannot be deleted.
So is the file actually a .csv file or a program hiding as a .csv file.
SooHow Cheng

Thanks for both experts, the problem is resolved
SooHow Cheng

I really don't know

Seth may gave the answer as the problem could be these files were opened by other parties.
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.