Professional Documents
Culture Documents
CSMA/CA
Collision domain
A collision occurs when two devices send a packet at the same time on the shared network segment.
The packets collide and both devices must send the packets again, which reduces network efficiency.
Mac Table
A
c
o
ll
i
Mac Table
s
i
o
n
B C
c c
o o
ll
In the beginning Mac table is empty. ll
i i
Switch own port don’t have MAC s and IP. s
i i
Switch itself has one MAC and one IP.
o o
Which is used to access switch but
n not used
n for communication.
If a packet received on port and destination is unknown, switch will broadcast it to all active ports
except that port on which it has received the request.
B C
c c
1 3
o o
ll ll
i Mac Table i
s s
i i
o o
n 2 n
A
c
o
If A node has send request to send packet llto B node.
i
In beginning MAC Table is empty and Destination
s is unknown.
i broadcast on all active ports except on port 2.
It will save Node A and port in Table and will
o
Now if B will send Packet to A. n
MAC table knows address of A, it will save B and Port 1.
A 2
B 1
MAC Address
48 bits or 6 Bytes
48 Bits
24 + 24
6 Bytes
3 3
xx.xx.xx.xx.xx.xx
It cannot be duplicated.
Broadcast Domain
That part of network where a message will travel form one interface to its destination is called
Broadcast Domain.
Broadcast domain is a logical part or division of a computer network. In a broadcast domain, all the
nodes can be reached via broadcast at the datalink layer.
In networking, a broadcast means that we send something that everyone receives, whether they
need/want it or not. Switches will forward broadcast traffic on all their interfaces, except the one they
received the broadcast on. Here’s an illustration to visualize this:
B C
2 2
1 3
3 1
A D
It will broadcast it to all active ports except that port on which it has received request which is port 1.
It will broadcast it to all active ports except that port on which it has received request which is port 1.
ICMP (Internet Control Message Protocol) is an error-reporting protocol network devices like routers use
to generate error messages to the source IP address when network problems prevent delivery of IP
packets. ICMP creates and sends messages to the source IP address indicating that a gateway to the
Internet that a router, service or host cannot be reached for packet delivery. Any IP network device has
the capability to send, receive or process ICMP messages.
SNMP can make query from systems to check for upload and download.
DNS
IP to Name
Name to IP
PKNIC (directory)
11.1.1.1
Superior.edu.pk
Root server
ISP
DSL
.org .com .pk .uk
m
DNS
Server
.edu .com
11.1.1.1 Superior.edu.pk
Superior website is registered on .edu with IP 11.1.1.1 which is hosted on server which can be located
ant where in world.
Every ISP maintain its own DNS server to avoid wastage of resource on finding particular website.
If it don’t have that website IP address then it will send request to DNS server which is higher in
hierarchy and the process will continue with same rule till it will reach root.
Root will send request to .pk and it will send request to .edu, here this website is registered and from
here IP will be taken and each DNS server will save IP and will forward it back until it reaches to user.
Now user will directly access that website from webserver where it is hosted.
It will search for superior.edu.pk directory and will find the file index.html and will open the page.
DHCP Server
Subnet
IP
Mask
Gateway
DNS
Alternate DNS
Routers
Routing Table
FE0 FE1
Layer 1: Hardware standards, Convert binary data into light or electrical signal.
Separate identification number is assigned to each interface/ Browser windows/ application’s instance,
it is also called port.
IP: 1.1.1.1
IP: 3.1.1.1
In above example use has opened two Browser tabs in which he want to open Hotmail in one tab and
yahoo in second tab.
Layer 4:
3.1.1.1 1.1.1.1
Layer 3:
Then Header will be enclosed with port number of sender and receiver.
When it will reach at web server it will be de encapsulated and then response will be provided back to
sender
When response will arrive on sender the requested data will be loaded on related tab by identifying its
Port number.
As Tab 1 has requested for Hotmail webpage with port number 1024.
PC2
1 3 Mac: C PC1
S1
192.168.1.1 192.168.2.1 IP: 192.168.2.2
Mac: B 2
Mac: A PC3
IP: 192.168.1.3
IP Mac address
192.168.1.2 B
192.168.1.1 C
Note: One network can only connect on one port of Router, means we cannot connect on network on
two ports of router.
192.168.2.0/24
No of IPs: 255
192.168.1.3 192.168.1.2
192.168.1.3 192.168.1.2 A
It don’t have Mac address of destination there for ARP request will be sent.
F represents broadcast
When request will reach at Switch it will populate its Mac Table and it will broadcast request on all ports
except port from request is coming.
When request reaches on the destination ARP response will be sent back to sender with its Mac
address.
Now PC3 have MAC address of PC2, PC3 has its own ARP table. And it will populate table with mac
address of PC2.
Network: 1.1.1.0/24
C 1 3 A PC1
PC3 2
PC2
B
IP: 1.1.1.2
1.1.1.1 1.1.1.3
1.1.1.1 1.1.1.3 A
It don’t have Mac address of destination there for ARP request will be sent.
When request will reach at Switch it will populate its Mac Table and it will broadcast request on all ports
except port from request is coming.
When request reaches on the destination ARP response will be sent back to sender with its Mac
address. On way back when it will arrive on switch it will populate its Mac table.
Now PC1 have MAC address of PC3, PC1 has its own ARP table. And it will populate table with mac
address of PC3.
PC2
B
IP: 1.1.1.2
C
Routing Table Switch’s Mac table
Network Port
MAC Address Port
2.1.1.0/24 FE1 A 2
1.1.1.0/24 FE0 E 4
IP: 1.1.1.3
PC3
1.1.1.1 2.1.1.2
Router will check its ports and will automatically set network id in router table. So it know which
network is connected to which port.
In this case when destination node is on other network we need Gateway to send data.
Now PC1 need Mac address of Route, so it will send ARP request to get Mac address of router.
1.1.1.1 2.1.1.2 A E
1.1.1.1 2.1.1.2
Now router will check that destination IP address matches to which network.
Now on layer 2
1.1.1.1 2.1.1.2 G D
Router also have ARP table from where it will check the MAC address of destination.
4 Cases of ARP
If destination network is attached to another router than first router will find other router Mac
Address.
Data-link Layer adds also a trailer at the end of each frame. The trailer is responsible for ensuring that
frames are received intact or undamaged. A typical frame includes two fields as a trailer.
Frame Check Sequence field: this field is used to determine whether errors occurred during the
transmission of frames. In other words, when a frame leaves the sender, it is added a specific
arrangement of numbers, and when it is arrived at the destination, the frames is checked, then a
calculation is done to see if the resulted numbers matches the ones included in the header. If the
numbers are the same, it means that the frame is intact, but in case the numbers are different, it
signifies that the frame is damaged and, as a result, will be discarded. The process of creating numbers
or a logical summary of the contents of the frame in numbers at the source and the act of calculating
the checksum of the frame at the destination is called Cyclic Redundancy Check or CRC, and the
outcome is referred to as CRC value.
Boot Loader
The Kernel
CPU, Memory, Peripheral devices are managed by Kernel. Scheduling, resource sharing.
Daemons
The Shell
Graphics server
If System is Command line interface based, and GUI view is required GUI Desktop is used.
Desktop
Application
Same as windows.
GNS
Twisted pair Cables:
Previously Coaxial cable was used for networking but it was difficult to manage coaxial cable in
networking.
Switch PC Router
RX 1 TX 1 TX 1
2 2 2
3 3 3
4 4 4
TX RX RX
5 5 5
6 6 6
7 7 7
8 8 8
10 Base 10Mbps
Ethernet 10Mbps
Gigabit 1000Mbps
10Gig
40Gig
There are three ways to access switch.
1. Console cable
2. Auxiliary
3. Telnet
Console cable
USB to RS232 converter is also used if RS232 port is not available in computer.
Axillary
Call will be made and a circuit of 64kb will be established than router can be accessed.
Bit rate synchronization
If there will be any difference between source and destination bit rate than data received will not same
as sent.
Receiver sender
As shown in example receiver having greater bit rate than sender in this case receiver will consider 1 bit
twice.
CLI Modes
To access switch with console cable open terminal which is connected with switch through console
cable.
Open terminal
When we run ping command packets are sent to destination and response is received, Arp table add
destination IP and MAC address in table.
Show mac-address-table
To configure router
Same for other port but with different network.
A routing table is a set of rules, often viewed in table format that is used to determine where data
packets traveling over an Internet Protocol (IP) network will be directed.
R1 R2
Ping 192.168.3.1
Because R1’s routing table has entry of PC0’s network in its routing table.
Ping 192.168.2.2
Because R1’s routing table has entry of Router R2’s network in its routing table.
If we will Ping Router Laptop 0 from PC0 we will not get response.
Ping 192.168.1.2
Because R1’s routing table don’t have entry of Laptop 0 network in its routing table.
To resolve this issue we will add Static or Dynamic routes in routing table. Which tells router that where
to send packets.
Routing table of Router R2
If we can access/ ping all routers on network it’s called full convergence.
Administrative distance
Administrative distance is the feature that routers use in order to select the best path when there are
two or more different routes to the same destination from two different routing protocols.
Administrative distance defines the reliability of a routing protocol.
Example
FE4 FE3
9.0.0.0/24
5.0.0.0/24 3.0.0.0/24
FE3 FE2
FE1 FE1
6.0.0.0/24
Routing tables
We can set administrative distance value while adding new route statically, to give priority to any route.
Dynamic Routing
Dynamic routing is a networking technique that provides optimal data routing. Unlike static routing,
dynamic routing enables routers to select paths according to real-time logical network layout changes.
In dynamic routing, the routing protocol operating on the router is responsible for the creation,
maintenance and updating of the dynamic routing table. In static routing, all these jobs are manually
done by the system administrator.
Dynamic routing uses multiple algorithms and protocols. The most popular are Routing Information
Protocol (RIP) and Open Shortest Path First (OSPF).
If any route is not valid now it will delete route from its table and also inform neighbor routers.
When configuration is changed its changed in RAM to save it in NVRAM we have to use write command.
To revert back from bad configuration we have to write NO in start of all commands we have written.
Router>enable
Router#
Router#
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#exit
Router(config-if)#interface fastEthernet 0/1
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router#config t
MIT4(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
Other two routers will be configured same way as have done with router 0
Dynamic Route
MIT4#config t
Enter configuration commands, one per line. End with CNTL/Z.
MIT4(config)#router rip
MIT4(config-router)#network 192.168.1.0
MIT4(config-router)#network 192.168.2.0
Note: if want to delete dynamic route
MIT4(config-router)#no network 192.168.0.0
Similarly, we will add dynamic route of those network which we want to share with neighbor router.
Router#show running-config
Router#show startup-config
1 word = 4 Bytes = 32 Bits
MTU (Maximum Transmission Unit): A maximum transmission unit (MTU) is the largest size packet or
frame, specified in octets (eight-bit bytes), that can be sent in a packet- or frame-based network such as
the Internet.
IP fragmentation is an Internet Protocol (IP) process that breaks datagrams into smaller pieces
(fragments), so that packets may be formed that can pass through a link with a smaller maximum
transmission unit (MTU) than the original datagram size. The fragments are reassembled by the
receiving host.
Fragmentation
IPV4 Header
Internet protocol is layer 3 protocol which takes segments from Layer 4 and divide it into Packets. IP
packet encapsulates data received from Layer 4 and add to its own header information. The
encapsulated data is called IP Payload. IP header contains all necessary information to deliver packet to
the destination.
Version:-
The first header field in an IP packet is the four-bit version field. Version identifies the IP version to
which the packet belongs. This four-bit field is set to binary 0100 to indicate version 4 (IPv4).
Header length or Internet Header Length (IHL):-
The second field (4 bits) is the Internet Header Length (IHL) telling the number of 32-bit words in the
header. This field specifies the size of the header. The minimum value for this field is 5, which is a length
of 5×32 = 160 bits = 20 bytes. Being a 4-bit value, the maximum length is 15 words (15×32 bits) or 480
bits = 60 bytes.
Now known as Differentiated Services Code Point (DSCP). The TOS field is used to carry information to
provide quality of service features. TOS allows the selection of a delivery service in terms of precedence,
throughput, delay, reliability, and monetary cost.
It allows end-to-end notification of network congestion without dropping packets. ECN is an optional
feature that is only used when both endpoints support it.
Total Length:-
This 16-bit field defines the entire datagram size, including header and data, in bytes. The minimum-
length datagram is 20 bytes (20-byte header + 0 bytes data) and the maximum is 65,535 bytes — the
maximum value of a 16-bit word.
Identification:–
This field is an identification field and is primarily used for uniquely identifying fragments of an original
IP datagram.
Flags:–
A three-bit field follows and is used to control or identify fragments. They are (in order, from high order
to low order):
Don’t Fragment:-
Sets the Don’t Fragment bit in sent packets. When an IP datagram has its DF flag set, intermediate
devices are not allowed to fragment it so if it needs to travel across a network with a MTU(Maximum
Transmission Unit) smaller that datagram length the datagram will have to be dropped. Normally an
ICMP Destination Unreachable message is generated and sent back to the sender.
More Fragments:-
Sets the More Fragments bit in sent packets. The MF flag is set to indicate the receiver that the current
datagram is a fragment of some larger datagram. When set to zero it indicates that the current
datagram is either the last fragment in the set or that it is the only fragment.
Fragment Offset:-
The fragment offset field, measured in units of eight-byte blocks, is 13 bits long and specifies the offset
of a particular fragment relative to the beginning of the original unfragmented IP datagram. The first
fragment has an offset of zero. This allows a maximum offset of (213 – 1) × 8 = 65,528 bytes which
would exceed the maximum IP packet length of 65,535 bytes with the header length included (65,528 +
20 = 65,548 bytes).
It is of 8 bit field. This field indicates the maximum time the datagram is allowed to remain in the
internet system. If this field contains the value zero, then the datagram must be destroyed. This field is
modified in internet header processing. The time is measured in units of seconds, but since every
module that processes a datagram must decrease the TTL by at least one even if it process the datagram
in less than a second, the TTL must be thought of only as an upper bound on the time a datagram may
exist. The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum
datagram lifetime. <Hops> must be a number in the range [0–255].
Protocol:-
This field defines the protocol used in the data portion of the IP datagram. The Internet Assigned
Numbers Authority maintains a list of IP protocol numbers.
Header Checksum:-
The 16-bit checksum field is used for error-checking of the header. At each hop, the checksum of the
header must be compared to the value of this field. If a header checksum is found to be mismatched,
then the packet is discarded. Errors in the data field must be handled by the encapsulated protocol and
both UDP and TCP have checksum fields.
As the TTL field is decremented on each hop, a new checksum must be computed each time. The
checksum field is the 16-bit one’s complement of the one’s complement sum of all 16-bit words in the
header. For purposes of computing the checksum, the value of the checksum field is zero.
Source address:-
Sets the source IP address. This option lets you specify a custom IP address to be used as source IP
address in sent packets. This allows spoofing the sender of the packets. <addr> can be an IPv4 address
or a hostname.
Destination address:-
An IPv4 address indicating the receiver of the packet. As with the Source address, this may be changed
in transit by a network address translation device.
Options:-
Additional header fields may follow the destination address field, but these are not often used. The
value in the IHL field must include enough extra 32-bit words to hold all the options (plus any padding
needed to ensure that the header contains an integral number of 32-bit words). The list of options may
be terminated with an EOL (End of Options List) option; this is only necessary if the end of the options
would not otherwise coincide with the end of the header.
The option field is variable in length. There may be zero or more options. There are two cases for the
format of an option:
Case 2: An option-type octet, an option-length octet, and the actual option-data octets.
The option-length octet counts the option-type octet and the option-length octet as well as the option-
data octets.
The copied flag indicates that this option is copied into all fragments on fragmentation.
0 = not copied
1 = copied
Data:- The data portion of the packet is not included in the packet checksum. Its contents are
interpreted based on the value of the Protocol header field.
In a typical IP implementation, standard protocols such as TCP and UDP are implemented in the OS
kernel for performance reasons. Other protocols such as ICMP may be partially implemented by the
kernel, or implemented purely in user software.
Some of the common protocols for the data portion are listed below:
If we want to send Packet which destination is not in known network we will give default route for this
which will send it on the internet.
IP subnet ISP
Or
Delay=1000
10.1.1.0 | 1
BW=100
10.1.1.0 | 1 10.1.1.0 | 2
Matric
Least Bandwidth
107/10+1000 =
107/100+100 =
EIGRP
Enhanced Interior Gateway Routing Protocol (EIGRP) is an interior gateway protocol suited for many
different topologies and media. In a well-designed network, EIGRP scales well and provides extremely
quick convergence times with minimal network traffic.
EIGRP Metrics
EIGRP uses the minimum bandwidth on the path to a destination network and the total delay to
compute routing metrics. Although you can configure other metrics, we do not recommend it, as it can
cause routing loops in your network. The bandwidth and delay metrics are determined from values
configured on the interfaces of routers in the path to the destination network.
Router eigrp
Router 0
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#
Router(config)#router e
Router(config)#router eigrp 1
Router(config-router)#net
Router(config-router)#network 192.168.1.0 ?
A.B.C.D EIGRP wild card bits
<cr>
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.4.0
Router(config-router)#
Router#show running-config
Router 1
Router>
Router>
Router>enable
Router#
Router#
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#router e
Router(config)#router eigrp 1
Router(config-router)#network
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.3.0
Router(config-router)#network 192.168.5.0
Router#show running-config
Router 2
Router>
Router>
Router>enable
Router#
Router#
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#router e
Router(config)#router eigrp 1
Router(config-router)#network
Router(config-router)#network 192.168.4.0
Router(config-router)#network 192.168.5.0
Router#show running-config
Standard Access List
Standard IP access lists filter the network by using the source IP address in an IP packet. You create a
standard IP access list by using the access list numbers 1–99.
To restrict PC1 to send data to PC0, access list will be applied nearest to destination.
Router 0
Router#show running-config
Matric=10^7/bandwidth+delay
Delay 200
Web server
Staff SSH 22
Telnet 21
Port 80
Scenario
Wildcards
Wildcards are used with access lists to specify a host, network, or part of a network.
IP: 192.168.1.192/29
255.255.255.255
255.255.255.248 -
0.0.0.7
192: 11000000
11000000 192
11000001 193
11000010 194
To
11000111 199
With a standard IP access list, you can’t allow users to get to one network service and not another.
However, extended IP access lists allow you to do this. Extended IP access lists allow you to choose your
IP source and destination address as well as the protocol and port number, which identify the upper-
layer protocol or application. By using extended IP access lists, you can effectively allow user’s access to
a physical LAN and stop them from using certain services.
Web server
Permit tcp any source any port any ip any port any
If
Protocol: tcp
Source: any
Port: <1024 (means server as all ports below 1024 used for servers)
Case 3: IT Telnet
Access list 101 permit tcp 192.168.1.248 0.0.0.7 10.1.1.2 0.0.0.0 range 22 23
+
Access List Scenario 1 (All services run on single server)
Case 3: IT Telnet
interface FastEthernet0/1
ip access-group 101 out
#line vty 0 4
#access-class 3 in
NAT (Network address translation), PAT (Port Address Translation)
ICANN is a not-for-profit public-benefit corporation with participants from all over the world
dedicated to keeping the Internet secure, stable and interoperable. It promotes competition
and develops policy on the Internet's unique identifiers. Through its coordination role of the
Internet's naming system, it does have an important impact on the expansion and evolution of
the Internet.
NAT
NAT, defined in RFC 3022, allows a host that does not have a valid, registered, globally unique
IP address to communicate with other hosts through the Internet. NAT achieves its goal by
using a valid registered IP address to represent the private address to the rest of the Internet.
The NAT function changes the private IP addresses to publicly registered IP addresses inside
each IP packet.
Consider following scenario.
192.168.1.10 1.1.1.1
When packet will be sent over internet it will reach its destination which is a server on internet
with a Live IP: 1.1.1.1.
When server will receive the packet it will send reply, but when it will reach over internet it will
get discarded because PC’s IP was private and has no information over internet.
1.1.1.1 192.168.1.10
Interface of Modem which is connected to internet has Live IP address assigned by ISP.
Now when Pc want to communicate with server.
192.168.1.10 1.1.1.1
3.1.1.1 1.1.1.1
Before Translation
After Translation
IF destination IP is private.
Example:
Considering network below.
Routes
Router 0 Router 1
C 192.168.1.0/24 FE 0/0 C 192.168.2.0/24 FE 0/1
C 192.168.2.0/24 FE 0/1 C 192.168.3.0/24 FE 0/0
S 192.168.3.0/24 FE 0/1
PC0 to PC1
192.168.1.2 192.168.3.2
PC1 to PC0
192.168.3.2 192.168.1.2
Static NAT
NAT Statistics
Dynamic NAT configuration
In this case if there are more than one PCs want to communicate over the internet, because of
limited Live IPs communication will be performed in queue.
To overcome this issue we use NAT overloaded with PAT.
Linux
To open super user we use “su” and enter password
To create new user “adduser newusername”
Enter required details
If we want to run configuration commands with different user other than super user we need
to write sudo in start of each command, on execution of command it will ask for password of
user.
After creating new user we need to assign rights to our user.
For that we will write command
When we create an new user his directory is automatically created in home and when we want
to delete a user we have to perfom three steps to completely delte user.
1: delete user
2: delete user directory
3: delete user rights in visudo file
File System Hierarchy Standard (FHS)
Red Hat Enterprise Linux uses the Filesystem Hierarchy Standard (FHS) file system structure,
which defines the names, locations, and permissions for many file types and directories.
The FHS document is the authoritative reference to any FHS-compliant file system, but the
standard leaves many areas undefined or extensible.
The /boot/ directory contains static files required to boot the system, such as the Linux kernel.
These files are essential for the system to boot properly.
The /dev/ directory contains device nodes that either represent devices that are attached to
the system or virtual devices that are provided by the kernel. These device nodes are essential
for the system to function properly. The udev demon takes care of creating and removing all
these device nodes in /dev/.
in the /opt/ directory creates a directory bearing the same name as the package. This directory,
in turn, holds files that otherwise would be scattered throughout the file system, giving the
system administrator an easy way to determine the role of each file within a particular package.
This statement is true because there are special files that are more than just files (named pipes
and sockets, for instance), but to keep things simple, saying that everything is a file is a
n acceptable generalization. A Linux system, just like UNIX, makes no difference between a file
and a directory, since a directory is just a file containing names of other files. Programs,
services, texts, images, and so forth, are all files. Input and output devices, and generally all
devices, are considered to be files, according to the system.
Sorts of files
Most files are just files, called
regular files; they contain normal data, for example text files, executable files or programs,
input for or output from a program and so on.
While it is reasonably safe to suppose that everything you encounter on a Linux system is a file,
there are some exceptions.
Special files: the mechanism used for input and output. Most special files are in /dev, we will
discuss them later.
Links: a system to make a file or directory visible in multiple parts of the system's file tree. We
will talk about links in detail.
(Domain) sockets: a special file type, similar to TCP/IP sockets, providing inter-process
networking protected by the file system's access control.
Named pipes: act more or less like sockets and form a way for processes to communicate with
each other, without using network socket semantics.
(Domain) sockets: and Named pipes: Both are used for process to process communication.
The -l option to ls displays the file type, using the first character of each input line:
drwx-xr-xr
first digit show file type then 3 digits show user permissions
r= read
w= write
x= execute
than next two digits show group permissions and next two shows permission for others.
About partitioning
Why partition?
Primary goal: Data security
Secondary goal: Performance
Most people have a vague knowledge of what partitions are, since every operating system has
the ability to create or remove them. It may seem strange that Linux uses more than one
partition on the same disk, even when using the standard installation procedure, so some
explanation is called for.
of having different partitions is to achieve higher data security in case of disaster. By dividing
the hard disk in partitions, data can be grouped and separated. When an accident occurs, only
the data in the partition that got the hit will be damaged, while the data on the other partitions
will most likely survive.
This principle dates from the days when Linux didn't have journaled file systems and power
failures might have lead to disaster. The use of partitions remains for security and robustness
reasons, so a breach on one part of the system doesn't automatically mean that the whole
computer is in danger.
This is currently the most important reason for partitioning. A simple example: a user creates a
script, a program or a web application that starts filling up the disk. If the disk contains only one
big partition, the entire system will stop functioning if the disk is full. If the user stores the data
on a separate partition, then only that (data) partition will be affected, while the system
partitions and possible other data partitions keep functioning.
Mind that having a journaled file system only provides data security in case of power failure
and sudden disconnection of storage devices. This does not protect your data against bad
blocks and logical errors in the file system. In those cases, you should use a RAID (Redundant
Array of Inexpensive Disks) solution.
RAD is of 3 types
In first type one hard drive contains data and second works as image of firsrt one, so in case of
loss of first Hard drive second start working and data not lost.
Provides: Security
But doesn’t provide performance as we can only use on hard drive.
Primary Mirror
Second type:
Data is stored in blocks
Block1 Block2
Block3 Block4
We can access data from both hard drives and which provides performance but in case of hard
disk failure data get lost.
Third type:
In this type data stored on both hard disks is saved on third hard disk after performing XOR
operation to both hard drives data.
0 0 0
1 0 1
0 1 1
1 1 0
Partition layout and types
There are two kinds of major partitions on a Linux system:
data partition: normal Linux system data, including the root partition containing all the data to
start up and run the system; and
swap partition: (Virtual memory) expansion of the computer's physical memory, extra memory
on hard disk.
Most systems contain a root partition, one or more data partitions and one or more swap
partitions. Systems in mixed environments may contain partitions for other system data, such
as a partition with a FAT or VFAT file system for MS Windows data.
3rd possibility: with two hard disks: 1 partition of 512 MB on each disk.
The last option will give the best results when a lot of I/O is to be expected.
The kernel is on a separate partition as well in many distributions, because it is the most
important file of your system. If this is the case, you will find that you also have a /boot
partition, holding your kernel(s) and accompanying data files.
The rest of the hard disk (s) is generally divided in data partitions, although it may be that all of
the non-system critical data resides on one partition, for example when you perform a standard
workstation installation. When non-critical data is separated on different partitions, it usually
happens following a set pattern:
a partition for user programs (/usr)
Once the partitions are made, you can only add more. Changing sizes
Directory Content
/bin Common programs, shared by the system, the system administrator and the users.
The startup files and the kernel, vmlinuz. In some recent distributions
/boot also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid
of the many different boot-loaders we know today.
Directory Content
Contains references to all the CPU peripheral hardware, which are represented as
/dev
files with special properties.
Most important system configuration files are in /etc, this directory contains data
/etc
similar to those in the Control Panel in Windows
/home Home directories of the common users.
/initrd (on some distributions) Information for booting. Do not remove!
Library files, includes files for all kinds of programs needed by the system and the
/lib
users.
Every partition has a lost+found in its upper directory. Files that were saved
/lost+found
during failures are here.
/misc For miscellaneous purposes.
/mnt Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
/net Standard mount point for entire remote file systems
/opt Typically contains extra and third party software.
A virtual file system containing information about system resources. More
information about the meaning of the files in proc is obtained by entering the
/proc
command man proc in a terminal window. The file proc.txt discusses the virtual
file system in detail.
The administrative user's home directory. Mind the difference between /, the root
/root
directory and /root, the home directory of the root user.
/sbin Programs for use by the system and the system administrator.
Temporary space for use by the system, cleaned upon reboot, so don't use this for
/tmp
saving any work!
/usr Programs, libraries, documentation etc. for all user-related programs.
Storage for all variable files and temporary files created by users, such as log files,
/var the mail queue, the print spooler area, space for temporary storage of files
downloaded from the Internet, or to keep an image of a CD before burning it.
To go in folder sub-child
To check files and folder in directory we use
Ls
And for more detail
In below image file starting with l means it has like and count is 1.
To delete file
rm file.abc
To delete directory (if empty)
rm dirname
ln to create link