Results 1 to 2 of 2

Thread: How to use iNodes and Hard Links in Linux

  1. #1
    Join Date
    Nov 2009
    Posts
    583

    How to use iNodes and Hard Links in Linux

    iNodes and Hard Links :


    Every file on your system by one inode represents (stands for "information node" (information node) and node is in English as "eye-" pronounced). An inode contains all information of the file. However, the inode is not immediately visible. Instead, each inode with the file system through one or more hard links linked. Hard links contain the name of the file and the inode number. The inode contains the file itself, for example, the location on the disk, permissions, file type and so on. The system can be found inode inode number of each basis.

    A single file can have more than one hard link. This means that multiple file names can refer to the same (they are the same inode number that is connected). It may, however, occur no hard links between file systems. All hard links to a particular file (inode) must be on the same file system, since each file has its own inodes for file system and duplicate inode numbers may be different there.



  2. #2
    Join Date
    Nov 2009
    Posts
    583

    Re: How to use iNodes and Hard Links in Linux

    Since all hard links to a file on the same file reference, you can change the file a name and then make under a different name watch the changes with:

    Code:
    techarena @ ~ $ cd echo "hello"> first link
    cd changes in your home directory and places the file there first link to the word 'hello'contains. So redirecting the output of echo (echo is only the arguments) in the file first link to.
    Code:
    techarena @ ~ $ cat first link
    Confirmed the contents of first link.
    Code:
    techarena @ ~ $ ln first link second link
    Creates a hard link: second link now points to the same inode as first link.
    Code:
    techarena @ ~ $ cat second link
    Confirmed that second link is the same as first link.
    Code:
    techarena @ ~ $ ls-l
    Note that the number of hard links by first link and second link is 2.
    Code:
    techarena @ ~ $ echo "change">> second link



    This is another shell redirection - do not take care of the details. We have the word "change"to second link attached. Check this with cat second link.
    Code:
    techarena @ ~ $ cat first link
    first link also has the word "changeadded, "since first link and second link on the same file reference. It does not matter how you call the file when you make changes.
    Code:
    techarena @ ~ $ chmod a + rwx first link
    Change the rights for first link. Give the command ls-l one, to see that the rights of second link were also amended. The rights are then stored in the inode, not the links.
    Code:
    techarena @ ~ $ rm first link
    Deletes this link. This is a subtlety of rm - deletes it actually links, not files. Now enter ls-l one and see for yourself from the fact that second link is still there. Note also decreased by a number of hard links from second link.
    Code:
    techarena @ ~ $ rm second link
    Clears the other link. If there are no links to a file anymore, Linux deletes the file itself - this is the inode. All files do so, even special types of files, such as devices (for example / dev / hda). A directory is simply a list of filenames and inode numbers - ie a list of hard links. If you are composing your hard link, you will add a new entry in the list of directories only. If you delete a file, you delete only one hard link from the Directory.

Similar Threads

  1. Two different hard disk for two different Linux
    By UbuntuOSX in forum Operating Systems
    Replies: 3
    Last Post: 16-10-2009, 01:01 PM
  2. Difference between "Junction points" and "Hard Links" ?
    By Carla Lacrosse in forum Windows XP Support
    Replies: 7
    Last Post: 02-03-2009, 01:51 AM
  3. Important Links for openSUSE Linux 11.1 release
    By Rudra.J in forum Operating Systems
    Replies: 1
    Last Post: 16-02-2009, 11:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,285,336.61654 seconds with 17 queries