Welcome to Dark Area

Explore, Secure, Evolve – IT, Cybersecurity & Ethical Hacking

ATTENTION! Due to account issues, our mails are going into spam. Please, do not forget to check the spam folder for confirmation mails.

Register…

Linux SysAdmin [RHEL] - Lesson #3

Dark

Owner

Joined
Mar 21, 2024
Messages
40

Linux SysAdmin [RHEL] - Lesson #3

This thread is continue of Linux System Administrator topic based on RedHat.



Breaking Down from Zero
How Storage logic works?

1. Physical Storage
Physical Storage is HDD/SSD that where files stored in physically.
kx9arp1.png




2. Partitioning
Divides Physical Storage into Logical Parts for managing logical disk amount and size.

2.1. MBR
Max supports 4 primary partition, each of max 2TB

2.2. GPT
Supports unlimited primary partition, each of unlimited size (9.4 ZettaByte)
P.S> Windows support max 128 primary partition.

P.S> A Physical Storage can be only GPT or MBR, not both.

rbamc5c.jpg


2.3. Partition called as in:
Linux Systems: /dev/sda, /dev/sdb
Windows Systems: C:, D:



3. File System

File System organizing and manages files/folders such as a file where starts and finished in disk, which data blocks used and more.
If a partition will not formatted with any file system, it is unusable but visible by OS and called "Unallocated Space".

When Partition formatted with File System, it called as "Free Space".
Most used for:
Windows: NTFS
Linux: Ext4, XFS

t78a3fw.jpg



Formatting in Windows (diskmgmt.msc):
rvbfbrr.jpg



Formatting in Linux (cfdisk):
c3wstu1.jpg



4. Data Block
Data Block keeps data in blocks which is by default set 4KB. It means;
1KB file keeps 1 block (4KB) in file system.
10KB file keeps 3 block (12KB) in file system.




5. Inodes
Inodes are Data Structure that stores critical information about files and directories like Size, Owner User/Group, Creating/Editing Date, File Type (File, Folder, Hardlink or Softlink), Located in which Data Blocks.

Inode manages file/folders, says where file/folders are stored physically.

Data Blocks physically store file/folders.

YES, ALL THINGS INCLUDING FOLDERS ARE FILE IN LINUX.

ls -li
shows listed files/folders with their inodes.
klql97n.png


6. Hardlink
Creating a full copy of a file includes all metadatas except file name. It attachs new copy to the same inode.

6.1. Creating Hardlink is NOT ALLOWED for Folders.
6.2. Hardlink CAN BE CREATED ONLY in SAME PARTITION in SAME VIRTUAL/PHYSICAL DISK.

6.3. After creating hardlink for file.ext named file2.ext;
6.3.1. Editing: Changing content, metadata and etc. of file.ext affects file2.ext directly, because they are attached in same inode, it means all their information is same except name.
6.3.2. Deleting - After creating hardlink, deleting file.ext does not affect soft2.ext, it stays and protects inode being lost.

ln mainfile.ext hardlink_file.ext
Inodes are same.
duowr1n.png



7. Softlink
Creating literally a shortcut as Windows. It is "bypass" for device/partition restriction in hardlink.

7.1. Softlink only shows where is main file/folder is located.
7.2. Creating Softlink IS ALLOWED for folders too.
7.3. Softlinks can be created for linking from other storage as device, network or cloud unlike hardlinks.

7.4. After creating softlink for file.ext/folder_name named file2.ext/folder2_name;
7.4.1. Editing (Files only): Editing softlinks (soft2.ext) means editing main file (file.ext) which redirected by softlink.
7.4.2. Deleting: Deleting softlink does not affect anything. Only main file/folder's shortcut deleted.

ln -s mainfile.ext/folder softlink.ext
Softlink redirection has been set.
130vtkc.png



P.S> FAT32 does not support hardlink/softlink. Supported Alternatives:

Linux: ext4, XFS
Windows: NTFS



Linux SysAdmin [RHEL] - Lesson #4 is soon...
 
Top