inodes. filesystems each partition has a filesystem –this filesystem will usually support a...

7
inodes

Upload: russell-mosley

Post on 17-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

inodes

Page 2: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

Filesystems• Each partition has a filesystem

– This filesystem will usually support a directory hierarchy

• Every file on a disk partition is allocated an inode number.– Typically this is an index number into an array stored on that disk– Each element in that array is an inode

• inodes store administrative information about a file– Who created it– When it was created– Etc

• inode numbers are stored alongside the filename in the directory– This means directories are tables that associate filenames with inode

numbers

Page 3: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

dir1

dir2

file1

file2

file98

file97

1301

1306

1997

2675

An actual inode

1301

1306

1302

1307

1303

1304

1305

filesystem

location on H/D, owner:pdunne, size:2M, etc

location on H/D ,owner:pdunne, size:200K

inode numberfilename

filename inode number

Each filename – inode pair is called a link

The same inode number can appear in more than one link

The inode number is the indexnumber in the inode array

1997

1997

Page 4: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

dir1

dir2

file1

file2

file99

file98

file97

1301

1306

1306

1997

2675

The actual inode

1301

1306

1302

1307

1303

1304

1305

filesystem

location on H/D, owner:pdunne, size:2M, etc

location on H/D ,owner:pdunne, size:200K

inode numberfilename

filename inode number

The inode number is the indexnumber in the inode array

Here we have two linksto the same inode

Hard link: Associate two or more file names with the same inode. Hard links share the same data blocks on the hard disk, while they continue to behave as independent files….If you delete one link the other link still points to inode

1997

Create a hard link$ ln TARGET LINK_NAME$ ln /dir1/file1 /dir2/file99

Create a hard link$ ln TARGET LINK_NAME$ ln /dir1/file1 /dir2/file99

Page 5: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

dir1

dir2

file1

file2

file99

file98

file97

1301

1306

1997

2675

The actual inode

1301

1306

1302

1307

1303

1304

1305

filesystem

location on H/D, owner:pdunne, size:2M, etc

location on H/D ,owner:pdunne, size:200K

inode numberfilename

filename inode number

The inode number is the indexnumber in the inode array

Here we have two linksto the same inode

Soft link or symbolic link (or for short: symlink): a small file that is a pointer (i.e. contains path) to another file. All commands that read/write follow a link follow and operate on the real file. Symbolic links can span partitions!

1997

Page 6: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

dir1

dir2

file1

file2

file99

file98

file97

1301

1306

1306

1997

2675

The actual inode

1301

1306

1302

1307

1303

1304

1305

filesystem

location on H/D, owner:pdunne, size:2M, etc

location on H/D ,owner:pdunne, size:200K

inode numberfilename

filename inode number

Each filename – inode pair is called a link

The inode number is the indexnumber in the inode array

Here we have two linksto the same inode

$ rm /dir1/file1

The direcory link is removed, inode is released and file H/D data blocks released

1997

X

Page 7: Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated

dir1

dir2

file1

file2

file99

file98

file97

1301

1306

1306

1997

2675

The actual inode

1301

1306

1302

1307

1303

1304

1305

filesystem

location on H/D, owner:pdunne, size:2M, etc

location on H/D ,owner:pdunne, size:200K

inode numberfilename

filename inode number

The inode number is the indexnumber in the inode array

Here we have two linksto the same inode

$mv /dir1/file1 /dir1/fileABC The move command, mv, can be used to rename a file if the second parameter is in the same directory as the original file. It creates a new entry with the same inode and then deletes the old link.

1997

fileABC 1301

X