LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-27-2016, 09:11 AM   #16
mistephenso
LQ Newbie
 
Registered: Apr 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by sundialsvcs View Post
Many file-repair utilities do this, including Windows' old chkdsk.exe. The objective is to be sure that there are no "in-use" physical files ("inodes ...") that do not have a directory-entry associated with them somewhere. A dummy directory-entry is built in "lost+found," basically so that the file can be "removed." (If you're curious what the orphaned inode contains, you can look at that now, too.)

But, the bottom line: "if a filesystem is hosed ... it's ... ... ... hosed."
OK, thanks sundialsvcs... Does anyone know of a quick way to break a filesystem so that I can play around with fsck and recovery attempts?
I have a system I can use to do this, but want to try and reproduce the corruption as close to the original issue as possible!
 
Old 04-27-2016, 12:14 PM   #17
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,657
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
Quote:
Originally Posted by mistephenso View Post
OK, thanks sundialsvcs... Does anyone know of a quick way to break a filesystem so that I can play around with fsck and recovery attempts?
I have a system I can use to do this, but want to try and reproduce the corruption as close to the original issue as possible!
Can you "dd"-duplicate the original corrupted system, before attempts at recovery?
 
Old 04-27-2016, 02:35 PM   #18
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
Quote:
Originally Posted by mistephenso View Post
OK, thanks sundialsvcs... Does anyone know of a quick way to break a filesystem so that I can play around with fsck and recovery attempts?
I have a system I can use to do this, but want to try and reproduce the corruption as close to the original issue as possible!
Well, you can dismount one, then use dd to zero out a few MB scattered around... (use count= for the number of blocks to zero out, and skip= to position to where you want to erase).

Then use fsck to analyze the filesystem.

This isn't as effective on filesystems using RAIDs. It can work, but errors would be harder to generate.
 
Old 04-28-2016, 06:48 AM   #19
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,657
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
Well, part of the problem with that approach is that, in my experience, filesystem corruption is usually the side-effect of a hardware failure that has-happened or that is about-to-happen. It is very difficult to simulate that.
 
Old 04-28-2016, 07:09 AM   #20
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
Quote:
Originally Posted by sundialsvcs View Post
Well, part of the problem with that approach is that, in my experience, filesystem corruption is usually the side-effect of a hardware failure that has-happened or that is about-to-happen. It is very difficult to simulate that.
Such errors can occur due to loose cables (signal cable specially, sometimes power cable - but the cache in the disk helps save from power failures).
 
Old 06-12-2016, 11:34 PM   #21
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 771

Rep: Reputation: 242Reputation: 242Reputation: 242
Not powering off properly (system lockup due to kernel crash) has created those files on my system using ext2. My directory listing is different than your examples here. Seems like just pulling the power plug out of the wall would sufficiently crash the disk to create those, but I wouldn't do it on purpose unless on a test system whose data you don't care about.

Some of the numbers may be inodes. It seems that char/block major and minor numbers also appear in your examples, but not in mine.
 
Old 06-13-2016, 05:49 AM   #22
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
It is possible to find "lost" files with really strange flags on disks that have only been partially initialized via a dd restore...

Finding the sticky bit set on files, block devices with only group execute and world write/execute bits that have huge UID/GID numbers, dates before Dec 31,1969 (unix creation date/epoch), pipes the same way; all point to random values stuck in inodes.

All the files in "lost+found" will be numbers - taken from the inode number of the file (a ls -i will show that).
 
Old 06-13-2016, 08:54 AM   #23
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by jpollard View Post
All the files in "lost+found" will be numbers - taken from the inode number of the file (a ls -i will show that).
If you're lucky, some of those numbered entries will be directories with their contents intact, complete with names. Usually that happens only if the filesystem damage was from something overwriting part of the device, not from uncontrolled shutdown unless the directory was newly created.
 
  


Reply



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
replacing cd drives: filesystem corruption tramni1980 Slackware 7 01-04-2009 08:53 AM
/Lost+Found -- Does anyone actually do anything with the contents? GrapefruiTgirl Linux - General 2 05-02-2007 11:07 PM
Guaranteed filesystem corruption on unclean shutdown? pigsa Linux - Software 7 12-10-2006 06:41 AM
Filesystem Corruption Hell Prostetnic_Jeltz Slackware 8 08-19-2006 03:23 PM
Filesystem corruption on software RAID5 drkdiggler Linux - General 6 02-23-2004 08:39 PM

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

All times are GMT -5. The time now is 07:07 AM.

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