LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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


Closed Thread
  Search this Thread
Old 03-21-2005, 05:49 AM   #1
drummerboy350
LQ Newbie
 
Registered: Mar 2005
Posts: 3

Rep: Reputation: 0
Linux Gurus needed, please help!


I have a question for my class that I will pass the class if I get this right. here it is...
Does Linux recycle the inode numbers of deleted files and subdirectories?
Thanks!!
 
Old 03-21-2005, 05:54 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

BAD,BAD,BAD!!

homework and tests at all are against the rules...

and afaik, i.e. can be wrong, the question is wrong:
what happens to inode numbers is filesystem dependent not linux dependent.

regards

slackie1000
 
Old 03-21-2005, 05:54 AM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
A google search will answer that.

Quote:
To understand how links work requires some basic knowledge of how Linux handles files. Each file is assigned unique properties (i.e.; permissions, creation date, file type) when created. The two properties critical to understanding links are inode number and file name. An inode number is a unique number assigned to a file by the operating system at the time the file is created. The inode number corresponds to the location of the file contents (the actual data that makes up the file) on the mounted volume (the partition of the disk that is mounted to the volume the file is created in). The file name is a link to the inode number. The file name points back to the inode number from its (the file name's) location in the directory hierarchy. What this means is that when a file is created two things occur: 1) An inode number is assinged to the file data stored on the disk, and 2) The file name is created in the directory structure and assigned to the inode number.

The inode number (the file contents) can have any number of file names hard linked to it. The ls -l command will report the number of hard linked file names to the coressponding inode number in second field of output (the field after permissions). The ls command will not tell you what other file names are hard linked to the inode number. Also note that this number reports the number of hard links for files only. If the number is in the row of a directory, the this is the number of directories immediately under the indicated directory. This number will always be 2 or more. Remember that . and .. are counted in this number (execute ls -a in any directory, count the directory files, then pop up one level, ls -l and see that the number calculated equals the number in the second field).

When a file name is deleted from the directory tree, the file name's connection to the inode number is severed. If the file name is the last "link" to the inode number, thereby reducing the number of inode (file content) "links" to file names to 0, then the inode is detatched from the actual data and returned to the pool of free inode numbers. The data remains on the disk, but unaccessable by traditional means now that it no longer has a corresponding inode number. The disk space is free to be overwritten. This process is called unlinking.

A hard link creates an indistinguishable link between two file names. A hard link allows two (or more) file names to point to the same inode number. When a hard link is created, the link file is assigned the same inode number as the target in its new directory (or the same directory location if the link name is different from the target). The original file contents remain unchanged, but the new file name is attatched to the inode number corresponding to the file contents. Any change made to either file name is reflected in file data. Essentially, a hard link creates another file name and attatches it to the inode number of the data you want to add the link to. If you delete either file name, the other will remain (basically, you are unlinking the file name from the inode number and removing the file name from the directory tree). Hard links cannot be used to link directories (unless the -d,-F option is used by super user). They cannot be used to link across different file systems. Hard links are restricted to the current mounted disk volume boundary.
 
Old 03-21-2005, 05:57 AM   #4
JSpired
Member
 
Registered: Sep 2003
Distribution: Slackware, Suse 9.2
Posts: 565

Rep: Reputation: 30
You've asked this twice now. Shame on you. I'm guessing you don't value your education much!
 
Old 03-21-2005, 06:42 AM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

I'm closing this thread, but I leave you with this: If there are a finite number of inodes what do you think would happen once enough files had existed on a system to use every valid inode? Would the system refuse to create new files? Or would the system recycle inode values of deleted files?
 
  


Closed Thread



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
New Forum for Linux-Gurus[Programming/Administration] or Linux-Advanced Users [ Progr raees LQ Suggestions & Feedback 5 04-12-2005 07:35 PM
nelp linux gurus golpemortal Linux - Software 9 07-04-2004 12:22 AM
A question for Linux Gurus.... perry Linux - Software 1 05-28-2004 03:16 PM
Debian Gurus Needed!!! je_fro Linux - Distributions 8 11-28-2002 01:48 AM
Calling all RedHat gurus...help needed.... gballard Linux - Distributions 1 08-03-2002 01:02 AM

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

All times are GMT -5. The time now is 07:21 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