0% found this document useful (0 votes)
72 views18 pages

Rhel/Centos: by Shashank Gosavi

This document provides an overview of Red Hat Enterprise Linux (RHEL) and CentOS, including their directory structures and how files are organized using inode metadata. It describes how inode block pointers allow files to expand across multiple blocks, with direct, indirect, double indirect and triple indirect pointers addressing up to 4TB of file size. It also covers how umask values determine default file permissions for new files by masking off permissions from the base permissions.

Uploaded by

Shashank Gosavi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views18 pages

Rhel/Centos: by Shashank Gosavi

This document provides an overview of Red Hat Enterprise Linux (RHEL) and CentOS, including their directory structures and how files are organized using inode metadata. It describes how inode block pointers allow files to expand across multiple blocks, with direct, indirect, double indirect and triple indirect pointers addressing up to 4TB of file size. It also covers how umask values determine default file permissions for new files by masking off permissions from the base permissions.

Uploaded by

Shashank Gosavi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

RHEL/CentOS

By Shashank Gosavi

Introduction
Red Hat Enterprise Linux is the Linux distro for enterprise environment, developed by Red Hat Inc. Due to support of Red Hat Network (RHN), it is widely used for servers. Community Enterprise OS (CentOS) is based on source code of RHEL and freely available. But do not have RHN support.

Linux directory structure

INODE
Index Node ? INODE is metadata. It stores following info

INODE Structure of Directory

It is simple Directory name to INODE number mapping. INODE no of .(DOT) is INODE no of Current Directory

INODE Structure of File

INODE Structure of File (cont.)


Mode: This keeps information about permission information and the type of inode (e.g. file, directory or a block device etc.) Owner Info: Access details like owner of the file, group of the file etc. Size: This location store the size of the file in terms of bytes. Time Stamps: it stores the inode creation time, modification time, etc.

Blocks
Whenever a partition is formatted with a file system. It normally gets formatted with a default block size. Now block size is the size of chunks in which data will be spread. So if the block size is 4K, then for a file of 15K it will take 4 blocks(because 4K*4 16), and technically speaking you waste 1 K.

Direct Block Pointers


In an ext2 file system an inode consists of only 15 block pointers. The first 12 block pointers are called as Direct Block pointers. Which means that these pointers point to the address of the blocks containing the data of the file. 12 Block pointers can point to 12 data blocks. So in total the Direct Block pointers can address only 48K(12 * 4K) of data. Which means if the file is only of 48K or below in size, then inode itself can address all the blocks containing the data of the file.

Indirect Block Pointers


Whenever the size of the data goes above 48k(by considering the block size as 4k), the 13th pointer in the inode will point to the very next block after the data(adjacent block after 48k of data), which in turn will point to the next block address where data is to be copied. Now as we have took our block size as 4K, the indirect block pointer, can point to 1024 blocks containing data(by taking the size of a block pointer as 4bytes, one 4K block can point to 1024 blocks because 4 bytes * 1024 = 4K). which means an indirect block pointer can address, upto 4MB of data(4bytes of block pointer in 4K block, can point and address 1024 number of 4K blocks which makes the data size of 4M)

Double indirect Block Pointers


Now if the size of the file is above 4MB + 48K then the inode will start using Double Indirect Block Pointers, to address data blocks. Double Indirect Block pointer in an inode will point to the block that comes just after 4M + 48K data, which intern will point to the blocks where the data is stored. Double Indirect block pointer also is inside a 4K block as every blocks are 4K, Now block pointers are 4 bytes in size, as mentioned previously, so Double indirect block pointer can address 1024 Indirect Block pointers(which means 1024 * 4M =4G). So with the help of a double indirect Block Pointer the size of the data can go up to 4G.

Triple Indirect Block Pointers


Now this triple Indirect Block Pointers can address upto 4G * 1024 = 4TB, of file size. The fifteenth block pointer in the inode will point to the block just after the 4G of data, which intern will point to 1024 Double Indirect Block Pointers.

INODE (cont.)
INODE in Commands ls -i <filename> stat <filename> find -inum <number> <command> ; cd $(find inum <number>) Effects of cp and mv commands.

UMASK
User file-creation mode mask Determines the file permission for newly created files. Also control the default file permission for new files To set umask open /etc/profile and append umask 022 (or any valid umask value) To set umask open ~/.bashrc and append umask 022 (or any valid umask value)

Calculating UMASK
Octal Value 0 Permission Read, Write, Execute

1
2

Read, Write
Read, Execute

3
4 5 6 7

Read only
Write, Execute Write Only Execute only No Permissions

Examples
If umask is set to 022,then permissions are calculated as:
Bit Targeted At File Permission

0
2 2

Owner
Group Others

Read, Write, Execute


Read, Execute Read, Execute

Calculating Final Permissions


Final Permissions = base permissions umask File Permissions: 666(base) 022(umask) = 644(final) (rw-r--r--) Directory Permissions: 777(base) 022(umask) = 755(final) (rwx--x--x)

THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy