Fedora 22 rm can not remove file - structure needs cleaning
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Fedora 22 rm can not remove file - structure needs cleaning
In Fedora 22, I recently had an electrical power loss which (fortunately) had only a tiny effect on my hard disk. While investigating a subsequent rsync error, I tracked down a problem file (e.g. file01), and issued an ls file01 and an rm -f file01. Responses:
The file is unimportant; all I want to do is delete the file and have a clean file structure. The file is on my boot disk, which was formatted as ext4. Reformatting the entire boot disk would be a lot of trouble (e.g. boot from backup hard disk on docking station, reformat entire partition, reload data). Is there an easy way to simply delete the file and clean up the file structure?
Searching the forum I discovered:
1. unmount the file system (i.e. boot from backup on docker)
2. run xfs-repair
If the problem persists after xfs-repair, you might need to unlink the file and then run it again. It has been years since I used XFS, but this did happen a time or two due to power failures and unlinking the file was helpful to inform xfs-repair that the file was no longer present.
Why would you be talking about "xfs-repair" for a filesystem that you say is formatted ext4? Are you sure it's ext4? I've never run across that "Structure needs cleaning" message for an ext2/3/4 filesystem.
In fact the file is an obselete Firefox cache file.
Your response seems ambiguous. Are you saying that the only hope for avoiding a boot disk reformat is to unmount the file (booting from backup on docker) and then run xfs-repair? Given that unlink also fails, suppose the xfs-repair fails. Is there any way to "assist" the xfs-repair, other than the (failed) unlink?
-------
Thanks to rknichols for his reply; my response:
I used df -T to verify that it is an ext4 file system. I skimmed this website's forums for "structure needs cleaning" messages, and happened to notice the xfs-repair command mentioned. Therefore, I (kitchen-sink) tossed that idea into my query. Questions:
1. Is xfs-repair unworkable on an ext4 partition?
2. Is there a way of "repairing" an ext4 partition?
3. Is there any alternative to reformatting the boot disk?
unlink doesn't usually fail - it means the directory the name is in has some issues.
xfs repair is for xfs filesystems, not ext filesystems.
fsck will handle that, and you can usually do it in single user mode (which should occur before the disk is mounted read/write, and after running fsck to a hard reset to ensure no writes are done to the filesystem before the reboot).
As others noted, "structure needs cleaning" messages hasn't been seen with ext, so it may be coming from somewhere else.
New symptom : after pc had been on for several hours, the hard disk activity light would begin blinking, with corresponding audible knocking sound. 3 days ago it happened after pc had been on for about 11 hours; 2 days ago it happened after pc had been on for about 8 hours. Per computer technician, the (boot) hard disk was "GOING BAD". This seems to explain the "Structure needs cleaning" symptom on an ext4 file system. Originally I (incorrectly) rejected this diagnosis because I powered (totally) off after the blinking hard disk activity light began, waited 20 seconds, and then attempted a cold boot with a (KNOWN TO BE GOOD) boot-flashdrive. When this failed, I suspected mobo or case-wiring problems. The boot-flashdrive failure apparently occurred because the "semi-bad" hard disk was still connected to sata-0 on the motherboard.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.