Vous êtes sur la page 1sur 3

File types

1.

Directory - special file stores file name(s) (hard link) and inodes.
Every entry in a directory constitutes a hard link.

2.

Links
hard link file name association to inode. Cannot span multiple file systems.
more than one name is allowed (link count).
A hard link is a pointer to a file and is indistinguishable from the original directory entry
Examle: different names, same inode 70, link count is 3.
cd /usr/bin;
ls -li cp mv ln
70 -r-xr-xr-x 3 root bin
27360 Jan 24 2007 cp*
70 -r-xr-xr-x 3 root bin
27360 Jan 24 2007 ln*
70 -r-xr-xr-x 3 root bin
27360 Jan 24 2007 mv*
In Berkley file system opened files inodes are cached dnlc (directory name lookup cache)
touch ./file1;
To create a new directory entry called file2
ln file1 file2;
ls -li
total 4
12091 drwxr-xr-x 2 root root
512 Sep 22 12:03 ./
2 drwxr-xr-x 25 root root
1024 Sep 22 12:02 ../
12095 -rw-r--r-- 2 root root
0 Sep 22 12:03 file1
12095 -rw-r--r-- 2 root root
0 Sep 22 12:03 file2
find . -inum 12095
./file1
./file2

symbolic link a file containing a path to another file. Can span multiple file systems.
ln -s file2 link1
ls -l
drwxr-xr-x 2 root root
drwxr-xr-x 25 root root
-rw-r--r-- 2 root root
-rw-r--r-- 2 root root
lrwxrwxrwx 1 root root

512 Sep 22 12:19 ./


1024 Sep 22 12:06 ../
0 Sep 22 12:03 file1
0 Sep 22 12:03 file2
5 Sep 22 12:19 link1 -> file2

If file2 is deleted, link1 can point to a non existing file!


rm ./file2
ls -l
drwxr-xr-x 2 root root
drwxr-xr-x 25 root root
-rw-r--r-- 1 root root
lrwxrwxrwx 1 root root

512 Sep 22 12:21 ./


1024 Sep 22 12:21 ../
0 Sep 22 12:03 file1
5 Sep 22 12:19 link1 -> file2

ls lL (dont show the link but its target file)


ls -lL link1
link1: No such file or directory

3. inodes (stored in cylinder groups - 16 cylinders/group) contain two parts:


- information about the file:
owner, permissions, size, link count, last access/inode change/modification time
- pointers to data blocks associated with file content (max file size 64TB Solaris10)
4. Device files do not use data blocks and do not hold data.
Long listing of a device file shows major and minor device numbers instead of file size details.
ls -l /devices/pci@780
crw------- 1 root sys

267, 255 Sep 22 13:13 pci@0:devctl

A major device number 267 identifies the specific device driver required to access the device.
modinfo -w | grep -w 267
24 129d660 3a10 267 1 pxb_plx (PCIe/PCI nexus driver 1.25)
A minor device number 255 identifies the specific unit of the type that the device driver controls.
A reconfiguration reboot creates device files and symbolic links to them.
devfsadm command
- attempts to load every driver and attach all possible device instances.
- for new devices found creates physical device files in /devices in memory system directory and
symbolic links in the /dev directory.
- maintains /etc/path_to_inst file.
Character-Special device files. Data access as a data stream.
Block-Special device files
Call for I/O operations based on defined block size.
-Faster - Data transferred between a process and a block special device is first stored in a kernel managed
memory based cache.
-Allow random seeks to be performed.

Vous aimerez peut-être aussi