Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-23-2014, 04:47 AM   #1
Registered: Jul 2011
Posts: 322

Rep: Reputation: Disabled
Whats does the symbol -> indicate in linux and how about hard and symbolic links

what does the symbol -> indicate in linux. For an instance i saw /etc/named.conf -> /var/named/chroot/etc/named.conf. is dat a symbolic link

If it is, then in a new machine,i have the file /etc/named.conf. How to i make it point to /var/named/chroot/etc/named.conf?
Old 01-23-2014, 05:21 AM   #2
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 143

Rep: Reputation: 20
Hi Sarah,

Yes, that indicates a symbolic link. So when you use /etc/named.conf you're actually using /var/named/chroot/etc/named.conf

But form the path, it looks like this is comming from a rescue system, aren't you? (named.conf should be in /etc in the first place). If for some strange reason you want to use named.conf from the /var/named/chroot/etc directory you can try
ln -s  /etc/named.conf /var/named/chroot/etc
This will create a symbolic link in /var/named/chroot/etc to /etc/named.conf.

Old 01-23-2014, 08:46 AM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
A bit more information:

A symbolic link is a small file that contains a path specification to a file or directory (which may not exist). The file is marked "special" as a symbolic link, just like directories are marked special (both use different bits in the "mode" field of the inode.

A hard link, on the other hand, is not special. The native linux filesystems allow inodes to have multiple names - each name represents a hard link. The number of hard links is maintained by the "links" field of the inode.

A file cannot be deleted until the link count goes to zero. Now that said, a file may still be delayed in deletion - when a file is opened, the inode is copied into memory. The disk file may then be deleted, and if that is the last remaining hard link, is ready for deletion... except for the open file which maintains the inode in memory. If a system crash prevents the file from being deleted, a repair pass over the filesystem (either fsck, or more likely a journal pass) will identify the file as missing, and recreate a name (fsck puts it in the filesystems lost+found directory) or restore the file name that was deleted from the journal.

The link count is also what makes it hard to delete directories. There are two reasons for that, 1 - it is a special file, so it has special handling... 2 - there are always two links in a directory: "." which is a hard link to the directory inode itself, and ".." which is a hard link to the parent directory. Removing one link is easy, but removing two causes race conditions (hence the special handling). A partially deleted diretory is a filesystem corruption - it can cause a number of problems - pointing to unused/deallocated/deleted inodes, or pointing to non-existent parent directories... Even the pointer to self would prevent normal cleanup, as an existing hard link would indicate a used file... yet that same file (a directory) is not accessable through the filesystem - thus a "lost" file.

There are some significant differences between hard and soft links- a hard link can only exist within a single filesystem. They cannot cross filesystems (after all, the link count is only on one inode). A symbolic link, being symbolic, can point to any file name with the system, which allows it to point to files on other filesystems. This is also why the pointed to file may not exist - it could have been deleted, or the file system it is on is not currently mounted.

Now, an inode is nothing more than a chunk of data that describes the allocations for data (the contents of a file). The combination of inode + data allocations is the file. The inode number can be thought of as just an index into an array of inodes stored on disk. Sometimes the array is stored as a sparse array (containing holes), but that is up to the specific filesystem design (XFS is one that does this). A directory is just a file that contains inode numbers and the associated name (minimally - some filesystems store additional information to make directory access faster). It is not possible to open file without an inode (one will be created if the option to create is provided, otherwise you get a "file not found" error).
1 members found this post helpful.
Old 01-23-2014, 09:44 PM   #4
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
Well thank u both of you....

Lpwevers,i did try and did like the way u wrote it there but unlike the existing server where in the /etc/ directory where "/etc/named.conf -> /var/named/chroot" been shown,doing what u said created vice versa that is in the /var/named/chroot/etc , "/var/named/chroot/etc/named.conf -> /etc/named.conf" is been shown. n doing the vice-versa of the command says /etc/named.conf exists.
Old 01-23-2014, 10:05 PM   #5
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 81
"/var/named/chroot/etc/named.conf -> /etc/named.conf"
thats because "->" this shows reference of the file 2nd to 1st, so in this case of named the original file lies in /etc/named.conf and is referenced to 'chroot' inside the /var dir

Hope that makes the concept of reference clear.

Last edited by SAbhi; 01-23-2014 at 10:08 PM.
Old 01-24-2014, 08:48 AM   #6
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,469

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Leave the link the way it was originally. When you have the "bind-chroot" package installed, the named process is confined, for security, inside the chroot directory and cannot access anything outside it. That chroot directory is what the named process will see as its root directory (/), so the link "/var/named/chroot/etc/named.conf -> /etc/named.conf" would actually be pointing to itself.

The actual config file is stored inside the chroot. The link "/etc/named.conf -> /var/named/chroot/etc/named.conf" is needed so that administrative tools, running outside the chroot, can access that config file via its usual path in /etc.


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
LXer: Learn Linux, 101: Create and change hard and symbolic links LXer Syndicated Linux News 1 06-08-2010 08:45 AM
Differences between Hard and Symbolic links imprise Linux - Newbie 3 05-17-2009 02:15 AM
Symbolic links Vs Hard links sulekha Linux - General 2 10-02-2008 07:03 AM
Symbolic and hard links Ciccio Linux - General 1 12-16-2002 02:10 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration