Hard Link - Link Counter

Link Counter

Most file systems that support hard links use reference counting. An integer value is stored with each physical data section. This integer represents the total number of links that have been created to point to the data. When a new link is created, this value is increased by one. When a link is removed, the value is decreased by one. If the link count becomes zero, the operating system usually automatically deallocates the data space of the file if no process has the file opened for access. The maintenance of this value assists users in preventing data loss. This is a simple method for the file system to track the use of a given area of storage, as zero values indicate free space and nonzero values indicate used space.

On POSIX-compliant operating systems, such as many Unix-variants, the reference count for a file or directory is returned by the stat or fstat system calls in the st_nlink field of struct stat.

Read more about this topic:  Hard Link

Famous quotes containing the words link and/or counter:

    If parents award freedom regardless of whether their children have demonstrated an ability to handle it, children never learn to see a clear link between responsible behavior and adult privileges.
    Melinda M. Marshall (20th century)

    I’d take the bus downtown with my mother, and the big thing was to sit at the counter and get an orange drink and a tuna sandwich on toast. I thought I was living large!... When I was at the Ritz with the publisher a few months ago, I did think, “Oh my God, I’m in the Ritz tearoom.” ... The person who was so happy to sit at the Woolworths counter is now sitting at the Ritz, listening to the harp, and wondering what tea to order.... [ellipsis in source] Am I awake?
    Connie Porter (b. 1959)