LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-12-2013, 12:53 AM   #1
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Rep: Reputation: 1
inodes home directory


Hi,

when we have:
Quote:
ls -ai /
some of the output is:

Quote:
2 . ..... etc .... media ..... root .... tmp
2 .. 2 home
when we have
Quote:
ls -ai ~
some of the output is:

Quote:
2752412 .
2 ..
in "/" the inode numbers of "home", "." and ".." are the same. while the inode of "." changes in /home. I have a vague answer fr it in my mind, but I don't know why in "/" all said inodes are the same?
 
Old 06-12-2013, 01:21 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,129

Rep: Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271
what will mount say?
 
Old 06-13-2013, 07:51 AM   #3
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by pan64 View Post
what will mount say?
here is the result of mount:

Quote:
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=4076932k,nr_inodes=1028433,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
configfs on /sys/kernel/config type configfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,seclabel)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
/dev/sda7 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel,data=ordered)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sr0 on /run/media/sryzdn/WebTemplates1 type iso9660 (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
/dev/sda3 on /run/media/sryzdn/28082EC8082E953A type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
What does it have about the inodes of ".", ".." and "home" being the same ?!?!?!?
 
Old 06-13-2013, 08:30 AM   #4
thedaver
Member
 
Registered: Jan 2010
Posts: 65

Rep: Reputation: 21
"/" and "~" for the user root are NOT the same folder. Thus "." in different folders gives different inodes to "self"
 
Old 06-13-2013, 08:30 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Actually, 'df -h' would be easier to glean from.
Anyway, the top inode on a partition is '2'.
On the system root '/' I get 2 for '.' and '..', which makes sense.
(FYI inode 1 is /sys).

If you have partitions mounted direct at root '/', you'll get the same effect.
I've got a couple of extra mounts, but not mounted off '/', so the parent '..' inodes are high nums.
Code:
cd /
ls -ai

 2 .
 2 ..

 2 boot 

# low mounted partitions
cd /var/lib/libvirt
ls -ai
  2 images         2 partn_pool

cd /var/lib/libvirt/images
ls -ai
      2 .   
3933962 ..  

# which matches
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb2              70G   20G   46G  31% /
tmpfs                 3.8G  424K  3.8G   1% /dev/shm
/dev/sdb1             504M   84M  395M  18% /boot
/dev/sda6              99G   16G   78G  17% /var/lib/libvirt/images
/dev/sda8             9.9G  9.2G  201M  98% /var/lib/libvirt/partn_pool

# also
cd /boot
ls -ai
   2 .
   2 ..
Each partition has its own inode list/table, which, incidentally, is why you can't hardlink across filesystems (partitions).

HTH
 
1 members found this post helpful.
Old 06-13-2013, 12:23 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
The directory structure is a tree, the parent directory contains entries for all subdirectories it contains (thus /home is a subdirectory of /).

".." is the name of the parent directory. Thus .. in the / points to the same directory as / (which is the same as the entry for ".").


In /home, the ".." entry points to the root directory /.

The "." entry in a directory represents the directory itself.

So every directory has an entry for ".." that can be different. They would be the same for all subdirectories of a given directory. All entries for "." will be different.

As every file is represented by an inode number, the inode numbers also represent the directories (directories are just files - just marked as "special"), all they really contain is an inode number, and the file name (/usr/include/bits/dirent.h for details).
 
  


Reply


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
User does int getting home directory in root home in ubuntu 10.04 lucid lynx sunrised24 Linux - Server 2 03-07-2012 10:21 AM
Is there a command to count inodes with in a directory? abefroman Linux - Server 2 07-16-2010 11:16 PM
"Home directory already exists. Please enter another home directory path." Daravon Ubuntu 2 02-15-2009 11:26 PM
contents of 'home' directory found at sda5: mounted as /home, and also on sda6:/home leswatson Linux - Newbie 4 04-18-2008 05:02 PM
How to get list of all inodes in a directory PankajDS Linux - Kernel 1 03-02-2008 08:28 PM


All times are GMT -5. The time now is 06:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration