For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > January 2005 > Filesystem concept









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Filesystem concept
candy_init@yahoo.com

2005-01-14, 8:57 pm

hi all,
I sometimes comes across statements like this:
" Links can be created among files included in the same
filesystem."

In my opinion,everything belongs to the same filesystem(which is ext3
on my Linux),then what does exactly the statements like above ("...
included in the same filesystem") means?Does a home directory and root
directory implies different filesystems?

Thanks,
Candice

Måns Rullgård

2005-01-14, 8:57 pm

candy_init@yahoo.com writes:

> hi all,
> I sometimes comes across statements like this:
> " Links can be created among files included in the same
> filesystem."
>
> In my opinion,everything belongs to the same filesystem(which is ext3
> on my Linux),then what does exactly the statements like above ("...
> included in the same filesystem") means?Does a home directory and root
> directory implies different filesystems?


ext3 is a filesystem *type*. A system can (and often does) have
several filesystems, often corresponding to hard drive partitions. It
is common to the root and home directories on different filesystems
(possibly of the same type).

--
Måns Rullgård
mru@inprovide.com
Eric Sosman

2005-01-14, 8:57 pm



candy_init@yahoo.com wrote:
> hi all,
> I sometimes comes across statements like this:
> " Links can be created among files included in the same
> filesystem."
>
> In my opinion,everything belongs to the same filesystem(which is ext3
> on my Linux),then what does exactly the statements like above ("...
> included in the same filesystem") means?Does a home directory and root
> directory implies different filesystems?


Roughly speaking, a file system is something you can
mount with the "mount" command. If you run "mount" with no
arguments, it will show you all the file systems currently
mounted on your machine; there are probably several, and of
different types.

The link under discussion (often called a "hard link"
to distinguish it from a "symbolic link") only operates
within a single file system, because it's actually just an
additional directory entry pointing to the same inode. Each
file system has its own universe of inodes, and an inode
number from one file system is meaningless in another, so
directory entries in one file system can't list the files
in another.

Blunt example: You can't hard-link a CD-resident file
into your home directory.

--
Eric.Sosman@sun.com

Jim Cochrane

2005-01-14, 8:57 pm

In article <1105735859.851654.304250@c13g2000cwb.googlegroups.com>, candy_init@yahoo.com wrote:
> hi all,
> I sometimes comes across statements like this:
> " Links can be created among files included in the same
> filesystem."
>
> In my opinion,everything belongs to the same filesystem(which is ext3
> on my Linux),then what does exactly the statements like above ("...
> included in the same filesystem") means?Does a home directory and root
> directory implies different filesystems?
>
> Thanks,
> Candice


Do a 'df' or 'df -h' from the command line. Each line you see, except for
the header line, represents a filesystem. If you want more info. try:

linux "what is a filesystem"

on google and checkout the results (e.g.,:
http://learnlinux.tsf.org.za/course...in/ch03s03.html
).

--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
Pascal Bourguignon

2005-01-14, 8:57 pm

candy_init@yahoo.com writes:

> hi all,
> I sometimes comes across statements like this:
> " Links can be created among files included in the same
> filesystem."
>
> In my opinion,everything belongs to the same filesystem(which is ext3
> on my Linux),then what does exactly the statements like above ("...
> included in the same filesystem") means?Does a home directory and root
> directory implies different filesystems?


filesystem = volume =about= partition.

Generally we use one partition per file system, but one could store
one file system over several partitions with soft-RAID and logical
volume management (LVM) where a virtual file system is spread over
several partitions/filesystem.


Use the df command. For example here:

% df -h -T
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda3 ext3 13G 12G 471M 97% /
/dev/hda6 ext3 25G 21G 3.7G 86% /local
/dev/hda7 ext3 34G 33G 581M 99% /data
/dev/hde1 reiserfs 77G 77G 9.6M 100% /e1
/dev/hde2 ext3 76G 71G 4.9G 94% /e2
/dev/hdg1 ext3 76G 74G 1.5G 99% /g
/dev/hdh1 ext3 76G 75G 629M 100% /h
62.93.174.78:/ nfs 7.9G 3.4G 4.2G 45% /larissa/root

To each mount point is attached a different file system. As you can
see, some file systems have a different _type_.

Files in unix file systems like ext2/ext3 are identified by an i-node
number. Use the -i option of the ls command:

% ls -i /tmp/|head -6
751219 Acro8BLxfM
751216 AdobeFnt06.lst.1000
754947 a
754837 a.html
1485796 acl62_trial
751193 acl62_trial.bz2

Unfortunately, these i-node numbers are relative to the file
system. That means the same numbers occurs in different file
systems. For example the root of all ext2/3 file systems is i-node
number 2.

% ls -id $(df|awk '/\//{print $6}')
2 /
2 /data
2 /e1
2 /e2
2 /g
2 /h
2 /larissa/root
2 /local

A hard-link is but a directory entry with a different name and the
same i-node number:

% ln /tmp/a /tmp/b ; ls -i /tmp/a /tmp/b
754947 /tmp/a
754947 /tmp/b


Now, you can have cross file-system links: use symbolic-links.

% ln -s /local/b /tmp/c ; ls -l /tmp/c
lrwxrwxrwx 1 pjb pjb 8 2005-01-14 23:01 /tmp/c -> /local/b






--
__pascal bourguignon__ http://www.informatimago.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d? s++:++ a+ C+++ UL++++ P--- L+++ E+++ W++ N+++ o-- K- w---
O- M++ V PS PE++ Y++ PGP t+ 5+ X++ R !tv b+++ DI++++ D++
G e+++ h+ r-- z?
------END GEEK CODE BLOCK------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com