nixCraft Poll

Topics

Understanding UNIX / Linux file system

Posted by Vivek Gite [Last updated: September 25, 2007]

A conceptual understanding of file system, especially data structure and related terms will help you become a successful system administrator. I have seen many new Linux system administrator w/o any clue about file system. The conceptual knowledge can be applied to restore file system in an emergency situation.

What is a File?

File are collection of data items stored on disk. Or it's device which can store the information, data, music (mp3), picture, movie, sound, book etc. In fact what ever you store in computer it must be inform of file. Files are always associated with devices like hard disk ,floppy disk etc. File is the last object in your file system tree. See Linux/UNIX - rules for naming file and directory names.

What is a directory?

Directory is group of files. Directory is divided into two types:

Directories are used to organize your data files, programs more efficiently.

Linux supports numerous file system types

# cat /proc/cpuinfo

# cat /proc/sys/net/ipv4/ip_forward
# echo "1" > /proc/sys/net/ipv4/ip_forward
# echo "0" > /proc/sys/net/ipv4/ip_forward

You can find out what type of file systems currently mounted with mount command:
$ mount
OR
$ cat /proc/mounts

What is a UNIX/Linux File system?

A UNIX file system is a collection of files and directories stored. Each file system is stored in a separate whole disk partition. The following are a few of the file system:

See The importance of Linux partitions for more information.

But what is in a File system?

Again file system divided into two categories:

Next time I will write more about Metadata objects - superblock, inodes, directories with actual linux commands so that you can understand and master the concepts :)

Continue reading rest of the Understanding Linux file system series:

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Ashish Says:

    Hello Sir,

    I would like to post my comments regarding file and directories definitation.

    File:

    It contains the metadata which includes inodes, date and stamp, rights and ownership filesize and type. It also has the link to the datablock which stores data on it.

    Directories:

    Directories are also files which contains filename to inode associations in its datablock so people says there are only files in Unix.

    Thanks!
    Ashish

  2. nixcraft Says:

    Nice ashish! I appreciate your post :)

  3. Anonymous Says:

    two typos

    Procfs: The proc
    ___^____________
    cat /proc/mounts
    _______________^

  4. Anonymous Says:

    You didn’t mention Reiserfs which I think is a little short sighted. Many users prefer it to ext3, XFS, and JFS journaling filesystems. Once reiserfs v4 is merged we’ll see some cool features being made available to all other filesystems as well.

  5. nixcraft Says:

    Anonymous, thanks. I really appreciate your help for spotting out typos and your post.

  6. nixcraft Says:

    Yes, I just missed reiserfs v3 was quite stable v4 will take some to stable under 2.6 kernel.. I will update the post for reiserfs. Thanks for suggestion.

  7. Anonymous Says:

    Quote “It contains the metadata which includes inodes, date and stamp, rights and ownership filesize and type. It also has the link to the datablock which stores data on it.”

    I think this definition is wrong, a file by definition is a stream of data -the meta data is exactly that, its data about data.

    The inode may be part of the operating systems fileing system, but it is NOT part of the file. For example if I copy a file from my linux system onto my windows system i lose the date/time/inode/mode/group - but I still have my “file”

    Jon

  8. Ashish Says:

    Hey Jon,

    This brings another querry in my mind.
    Where file is storing the information about date, stamp, permissions, ownership and filesize?

    BTW, I really do not have much information about windows file system. Is it same like Unix file system? Is it having inodes and other stuff?

    Thanks!
    Ashish Pathak

  9. Thomas Scott Says:

    “A conceptual understanding of file system, especially data structure and related terms will help you become a successful system administrator”
    ———————-
    But his job is easily taken away
    by future s/w that manages all objects
    files and folders , w/o a cmd line .
    Automating objects , reduces the
    kernel size , runs much faster .
    ————————

    Pocket boxes are $5 cpu , & 64MB .
    And Intel lost its grip ( 20 countries
    make ARM !). No more WinTel .

    Ppl will hack h/w and s/w into
    a pocket box that will run fast
    enuf to do everything .
    OpSys that has NO cmd line , true G.U.I.
    uses images ONLY , has no text keyboard.
    But since OpSys is non-text , one
    can create apps in hours ! Most of
    the proceedures will be in kernel ,
    all you need is to chain these proc’s
    in the proper order to create your app .

    Yes , i know Linux is your paycheck ,
    sorry …..

  10. Arnab Says:

    Hey friends can any one answer this following questioon plz.. it’s urgent.. I need ur help.

    ” Now a days memories are large and cheap.Therefore,when a file is opened it is simpler and faster to fetch a new copy of the i-node into the i-node table, rather than searching the entire table to see if it is already there” True or False?? - Justify

  11. abhi Says:

    @Thomas Scott,

    Thomas, a question : How does your hypothetical keyboard-less OS stores your resume to begin with? or any data? Just curious.

    And what if someone wants to create something new? How do these “most procedures” cope with that then? Sheesh!

    If you don’t understand computers, or are plain simple drunk, why bother commenting at all? Why not just sleep off the effect of the wonderful liquor you have imbibed?

  12. koulis Says:

    hi,
    i very appreciate this tutorial but
    part-ii ( http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/11/understanding-unixlinux-filesystem.php ) forwords to a 404 error.
    pls fix toc ontinue reading :D

  13. koulis Says:

    ok i googled a bit and found the correct url ( http://www.cyberciti.biz/tips/understanding-unixlinux-filesystem-superblock.html )

    pls fix it for others and sorry for posting a comment instead of mail.

  14. vivek Says:

    koulis,

    I’ve updated php regex and it should now redirect to correct url.

  15. srees Says:

    will linux support RAW file system?
    my USB drive was changed by Trojan horse to Raw.
    how can i recover it?

  16. ami Says:

    Is there a way to add custom properties (attirbutes) to iNode structure?

  17. savi Says:

    diagrms would have helped the user to understand the things easily.

  18. AMITKUMAR Says:

    hi, all

    i’ve to design ext3 linux file system, so please any body can suggest me, that from where i can get the proper knowledge of ‘ext3 linux file system’ architecture/ structure

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.