LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2016, 10:49 PM   #1
jzoudavy
Member
 
Registered: Apr 2012
Distribution: Ubuntu, SUSE, Redhat
Posts: 180

Rep: Reputation: Disabled
why is a lost+found folder in my newly created disk?


hi all

Am running through a paritioning excersize. I just created the new sdb1 with fdisk and mkfs.ext3, and after mounting it I noticed that there is a folder called lost+found. what is the purpose of that folder?

What would get lost?
 
Old 04-14-2016, 12:08 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
As this appears to be a learning exercise, what did your favourite search engine return ?.
 
Old 04-14-2016, 06:47 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,101
Blog Entries: 10

Rep: Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524Reputation: 1524
I didn't know myself, looks like fsck uses it. I've noticed it for ext4 file systems I create. Unsure if it's there for all file system types.

http://unix.stackexchange.com/questi...linux-and-unix
 
Old 04-14-2016, 07:08 AM   #4
Beefybison
Member
 
Registered: Mar 2016
Distribution: Ubuntu and Fedora
Posts: 37

Rep: Reputation: 2
You are correct that fsck uses it. It is used for any files that aren't properly closed for any reason such as a power failure.
 
Old 04-14-2016, 07:32 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by Beefybison View Post
You are correct that fsck uses it. It is used for any files that aren't properly closed for any reason such as a power failure.
Not quite.

The lost+found directory is used by fsck when it identifies an inode (file) that is not recorded in any directory - in other words, it is lost, and cannot be accessed. In earlier filesystems (ext/ext2) this happens when the system crashes before updating a directory entry with a new file (it is in buffers to be written, but doesn't get written).

Ext3 added a journal to catch this situation, and will replay the journal to apply the updates, so it happens a LOT less. Ext4 continued that and made it work better so it happens even less.

It is actually not necessary (as per the developers statement) that fsck be run for ext4 at boot. Replaying the journal should be sufficient.

That doesn't mean problems can't occur... Specially when layering filesystems on top of other structures (lvm and md), but now it is more important that the other layers maintain their consistency to protect the data.

The use of the lost+found directory goes all the way back to the origin of UNIX, and nearly all UNIX/Linux native filesystems will have a lost+found directory for this purpose.

The last note is that the lost+found directory traditionally had at least 10 blocks (more for bigger disks) preallocated so that fsck could update the directory without having to allocate disk blocks (which may not be valid either during a crash recovery).

Last edited by jpollard; 04-14-2016 at 07:38 AM.
 
1 members found this post helpful.
Old 04-14-2016, 11:19 AM   #6
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,165

Rep: Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223
The lost+found directory even gets created on a usb stick if you format it with a Linux system!

After running fsck, you find it's full of files simply identified by a number. These are things that fsck thought looked like files but which had no entry in any directory. Some will indeed be wanted files, and some will be deleted files, and some will be bits of deleted files. You then have the dubious pleasure of examining each one and deciding what to do with it, but at least everything that could be recovered will have been recovered.
 
  


Reply


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
Applying default permissions for newly created files within a specific folder mattydee Linux - Desktop 29 10-30-2016 10:55 PM
[SOLVED] Set disk quota for newly created user on login skimeer Linux - Newbie 12 01-22-2016 02:11 AM
[SOLVED] Cant make new folder or copy paste in my newly created partition institopper Linux - Newbie 9 07-13-2011 11:05 PM
default size of a newly created folder dinakumar12 Linux - Server 7 12-06-2010 08:39 AM
lvm2 Newly created Volume Group lost after reboot seanikins Linux - Newbie 5 04-11-2010 01:55 PM


All times are GMT -5. The time now is 04:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration