Score:0

rm -rf on some direcories never complete

sd flag

I have several directories in an ext4 filesystem that I can't delete. When I run rm -rf on the directories ps aux | grep rm shows a status of D for the process. I have tried allowing it to run for several days.

The same directories have the same issue with ls. I have tried to mv and to rsync the directories to a different block device - these commands have the same issue. I can mv directories within the same block device.

Possibly pertinent - the drive did fill up. I was able to delete enough other directories to get the total used space down to 85%.

What can I try?

jp flag
`find /path/to/your/directory | wc -l`. Also, check dmesg for any disk errors while this `find` is running.
Roger Creasy avatar
sd flag
@AlexD Thanks - dmesg reports read errors. I guess I have a hard drive failing
Score:2
sa flag

One possible solution is to try using the 'find' command to locate and delete the files in the directories. This can be done by running the following command:

find /path/to/directory -type f -delete

This will recursively search the directory and delete all files it finds. Once all the files have been deleted, you should be able to delete the directory itself.

If this does not work, you may need to try using a tool such as fsck to check the filesystem for errors. This can be done by running the following command:

fsck -f /dev/sdX

Replace sdX with the device name of the filesystem you are trying to delete. This will check the filesystem for errors and attempt to repair any it finds. Once the filesystem has been checked and repaired, you should be able to delete the directories.

Roger Creasy avatar
sd flag
fsck did the trick. Thanks
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.