Linux File System
Linux File System
1) /root (/):-
It is main directory & it is as home directory for root user.
2) /home :-
This is the directory in which every user on the system has or own personal folder for its own
personal file name. home directory provide service for other directories like FTP, HTTP etc.
5) /boot :-
These directory contain files for booting of the OS i.e. boot strap loader etc.
6) /user:-
In this directory store user application and files. It contains all commands, libraries, games and static
files for normal operation.
a) /lib:- It contain unchanging data file for program and sub program system.
b) /include:- It header file in the c programing language. It shoud be bellow /user/bin for consistency.
c) /bin:- This directory includes user executable files.
d) /sbin:- These are system binary files. They are executables utilized for system administration.
7) /dev:-
It includes the device file for all hardware devices connected to the system.
8) /etc:-
It includes the local system configuration files for the host system.
9) /mnt:-
It is a temporary mount point for basic file systems that can be used at the time when the
administrator is working or repairing a file system.
10) /media:-
A place for mounting external removable media devices like USB thumb drives that might be linked
to the host.
11) /opt:-
It contains optional files like vendor supplied application programs that must be placed here.
12) temp:-
It act as storage for temporary file program running after boot up and should use /var/temp file.
13) /var:-
Here, variable data files are saved. It can contain things such as MySQL, log files, other database
files, email inboxes, web server data files, and much more.
a) /cache
b) /log
c) /spool
d) tem
1) Boot Block -
A boot block in Linux is a sector on a storage device that contains the code and data required to start the
system. It's the first program that runs when a computer is turned on.
A boot block may contain the boot track code i.e. read into the machine during the booting this
program is executed when we boot the host machine. Although only one boot block is needed to start up the
machine.
How it works:
The boot block is usually the first sector on the storage device.
The BIOS loads the boot block into memory when the computer starts.
The boot block contains the bootstrap program, which initializes the system.
The bootstrap program locates the operating system kernel on the disk and loads it into memory.
The bootstrap program then starts the operating system.
2) Super Block -
Superblock in Linux is a data structure that stores information about a file system. It's located at the
beginning of the disk slice.
The super block is a blueprint that allows the operating system to access, navigate, and manage the
file system. It's similar to a master index in a library, providing immediate access to information about every
file and directory.
3) Inode block-
The inode (index node) is a data structure that describes a file-system object such as a file or a
directory. An inode block in Linux is a block of data that stores the disk block locations and attributes of a
file or directory. An inode, or index node, is a data structure that stores metadata about files and directories
in a Linux system. Inodes are unique identifiers for each file or directory in a filesystem.
4) Data block -
A data block in Linux is a storage block that contains information stored in a file, directory, or
symbolic link. The size of data blocks is determined when a file system is created. a data block size is
allocated to store file or directory. If it’s free and available for the system to allocate whenever needed.
data blocks:
File types:
A] Text file:-
A text file content only printable characters & you can view of contents and make senses out of
them. A text file content lines of character. Where every line is terminated with new line also known as line
feed.
B] Binary file:-
A binary file on the other hand content both printable and unprintable characters that cover the entire
ASCII range. Most UNIX command are binary file.
2) Device file:-
It represent physical device such as disk that read or write data block at a time.
1. Character devices – These devices transmit the data character by characters, like a mouse or a
keyboard.
2. Block devices – These devices transfer unit of data storage called a block, USB drives, hard drives,
and CD ROMs
mount command.
umount command.
1) mount command.
The mount command is used. mounting devices in Linux is the process of making files and folders from
another location accessible on your computer. You can mount devices like USB drives, hard drives, or
network. A device file are located in the /dev directory
Syntax:
Options Description
l Lists all the file systems mounted yet.
h Displays options for command.
V Displays the version information.
a Mounts all devices described at /etc/fstab.
t Type of filesystem device uses.
T Describes an alternative fstab file.
r Read-only mode mounted.
2) umount command.
To umount mounted file systems from their mount points, use the umount command. Before physically
removing a storage device or making configuration changes, it is essential to umount the file system. It is a vital
instrument for securely disconnecting network shares or USB drives, among other types of storage, from
the Linux file system.
For the purpose of preventing data loss or corruption, the command makes sure each of the current file
operations has concluded.
Syntax:
Options Description
-a Unmount all filesystems listed in /etc/fstab.
-c Report the number of mounts and unmounts since the last check.
Example:
#umount /home/viraj/file
Example:
#umount /home/viraj/file
B] Mount and Umount CD/DVD device: (Compact Disk / Digital Versatile Disk)
You need to use the mount command to mount a CD-ROM or DVD disk under a Linux operating
systems. First, you need to insert the CD or DVD in the server / laptop or desktop drive. It will add new
block device into /dev directory. To verify it, use the lsblk or fdisk -l command. Then perform mount and
umount operation on CD/DVD device.
Example:
Example:
#umount /home/viraj/file
Example:
Example:
#umount /home/viraj/file
Example:
Example:
#umount /home/viraj/file