LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 04-04-2016, 12:18 PM   #1
zug234zwang
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
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:

ls: cannot access 'file01': Structure needs cleaning
rm: cannot remove ‘file01': Structure needs cleaning

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

Is this the simplest solution?
 
Old 04-04-2016, 01:31 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Yes.

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.
 
Old 04-04-2016, 03:08 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,592

Rep: Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114
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.
 
1 members found this post helpful.
Old 04-05-2016, 02:38 AM   #4
zug234zwang
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks to pollard for his reply; my response:

unlink file01 (et al) yields:
unlink: cannot unlink ‘file01’: Structure needs cleaning

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?
 
Old 04-05-2016, 07:16 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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.
 
1 members found this post helpful.
Old 04-07-2016, 04:30 AM   #6
zug234zwang
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
RESOLVED

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.
 
  


Reply

Tags
fedora, recovery


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert directory structure from long file names in Linux to DOS 8.3 structure? manorina Linux - Software 5 09-12-2009 10:18 AM
cleaning up fedora's grub. nokuku4u Linux - Distributions 4 01-11-2009 09:03 AM
how many different ways we can remove the file from a directory structure. dina3e Linux - General 8 10-01-2008 04:06 AM
Cleaning my installation (remove all software and settings) Xenogis Slackware 10 02-21-2006 11:15 AM
Cleaning up menus in gnome/fedora jdier Fedora 2 06-04-2004 06:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration