Upload
acacio-oliveira
View
19
Download
1
Embed Size (px)
Citation preview
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Linux Essenciais and System Administration
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Key Knowledge Areas
Create links. Identify hard and/or softlinks. Copying versus linking files. Use links to support system administration tasks.
Devices, Linux Filesystems, Filesystem Hierarchy Standard
Create and change hard and symbolic links
Terms and Utilities
ln
2
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Disk file format
3
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Disk Block Groups
4
• On the physical drive, information is stored in blocks• The first block is always the boot block• The rest of the blocks are pooled and organized into block groups
• Each block groups contains a copy of super block and descriptions of all the block groups• Superblock holds information on the entire filesystem• Block and inode bitmaps provide fast lookup info on free and allocated blocks and inodes
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Disk Block Groups
5
• The inode table holds all of the inodes • The data blocks contain the actual data that is contained in the files on the filesystem
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
inodes
6
Inodes, or Information Nodes, hold all of the meta information for a fileDetails about ownership, size, permissions, times, ACLs and more are stored in the inode.
Most importantly,the inode points to data blocks which store the contents of the file.
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
inodes
7
File Name of a file isn’t stored in a inode. That’s where directories come in...
A directory is a special type of file whose contents (in the data blocks) is a list of name/inode pairs.
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Hard link
hard link maintains the same permissions and access times of the original file both have same inode number - simply appears to have different filename and/or location
8
Create and change hard and symbolic links
•Changes to either the original file or the link affect both. •The two files have equal importance. But deleting either of files won’t affect the other.•Hard link files appear to be regular files when examined and they function this way as
well• Normal users can’t create hard links to directories. • Also, hard links aren’t allowed to span file systems
To create a hard link, use the ln command
# ln stuff2 /home/angie/stuff# ls –al
-rw-r--r-- 2 root root 89704 Aug 27 2000 stuff-rw-r--r-- 2 root root 89704 Aug 27 2000 stuff2
Ex:
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Hard links
9
• When a new hard link is created, it simply adds another reference (filename) in a directory to that inode (file)
• Removing a hard link does not remove file unless it was the only hard link to that inode• Hard links, due to their nature with inodes and directories, only operate within a filesystem - you can
not create a hard link from one filesystem to another
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Symbolic link
Users can create symbolic links to directories, and symbolic links can span file systems.
10
Create and change hard and symbolic links
• Symbolic link maintains permissions separate from those of the original file. • Deleting the original file won’t remove the symbolic link, but the link wont funtion.
To create a soft link, you use the ln command.
# ln –s stuff /home/angie/stuffEx:
Soft links can be identified by listing the details of a directory’s contents:
# ls –al
lrwxrwxrwx 1 angie angie 7 Mar 10 17:06 stuff -> /fun/stuff
Ex:
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Symbolic links
11
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Symbolic Links to Different File Systems
12
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Create and change hard and symbolic links
Multiple Links to One File
13
Core
Lin
ux fo
r Red
Hat
and
Fed
ora
lear
ning
und
er G
NU
Fre
e D
ocum
enta
tion
Lice
nse
- Co
pyle
ft (c
) Acá
cio
Oliv
eira
201
2E
very
one
is p
erm
itted
to
copy
and
dis
trib
ute
verb
atim
cop
ies
of t
his
licen
se d
ocum
ent,
cha
ngin
g is
allo
wed
Fim de sessão
14