0% found this document useful (0 votes)
26 views16 pages

Linux Unit 2

The document provides an overview of various file systems used in Linux, including EXT4, XFS, Btrfs, F2FS, ReiserFS, NTFS, FAT32, and exFAT, highlighting their features and use cases. It also explains how to create and manage file systems, the structure and importance of the fstab file, and the SSH protocol for secure remote access. Additionally, it covers the System Security Services Daemon (SSSD) and runlevels in Linux for managing system states and services.

Uploaded by

jy193857.yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views16 pages

Linux Unit 2

The document provides an overview of various file systems used in Linux, including EXT4, XFS, Btrfs, F2FS, ReiserFS, NTFS, FAT32, and exFAT, highlighting their features and use cases. It also explains how to create and manage file systems, the structure and importance of the fstab file, and the SSH protocol for secure remote access. Additionally, it covers the System Security Services Daemon (SSSD) and runlevels in Linux for managing system states and services.

Uploaded by

jy193857.yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1) Different file system

In Linux, a *file system* is a way of organizing and storing files on a disk or partition. Different file
systems have different features and advantages. Below are some common file systems used in Linux,
explained simply:

### 1. *EXT (Extended File System)*

- *EXT4 (most common)*:

- The most widely used file system in Linux.

- Supports large files and volumes.

- Fast performance and reliability.

- Features: journaling (keeps a log of changes), file permissions, and large file support.

- Best for general-purpose use (desktops, servers).

- *EXT3*:

- An older version of EXT4, still used but less common now.

- Does not support some of the newer features of EXT4, like larger file sizes and faster performance.

- *EXT2*:

- Even older than EXT3.

- Does not support journaling, so it’s slower and less reliable during crashes.

- Still used in specific cases (like flash drives or older devices).

### 2. *XFS*

- *XFS*:

- High-performance file system.

- Ideal for large files and high-performance servers.

- Supports journaling and scalable file systems.

- Commonly used for file servers and enterprise systems.


### 3. *Btrfs (B-tree File System)*

- *Btrfs*:

- Newer file system with advanced features.

- Supports snapshots (backup features), compression, and deduplication (removes duplicate copies
of data).

- Aimed at improving scalability and data integrity.

- Still considered less stable than EXT4 for everyday use but is growing in popularity.

### 4. *F2FS (Flash-Friendly File System)*

- *F2FS*:

- Designed specifically for NAND flash memory (used in SSDs, smartphones, and USB drives).

- Optimized for faster read and write performance on flash storage.

- Works well on devices like smartphones and USB flash drives.

### 5. *ReiserFS*

- *ReiserFS*:

- Once popular for its fast performance with small files.

- Not commonly used anymore due to lack of development and community support.

- Suitable for older systems but now replaced by newer file systems like EXT4.

### 6. *NTFS (New Technology File System)*

- *NTFS*:

- Used primarily by Windows.

- Linux can read and write NTFS with help from tools like ntfs-3g.

- Not the native file system for Linux, but useful for dual-boot systems or external drives.

### 7. *FAT32 (File Allocation Table)*


- *FAT32*:

- Very old file system, used for compatibility with various operating systems (Windows, Linux,
macOS).

- Supports smaller file sizes (max 4 GB).

- Commonly used on USB drives, SD cards, and external hard drives.

### 8. *exFAT (Extended File Allocation Table)*

- *exFAT*:

- Designed for flash drives, SD cards, and external hard drives.

- Supports larger file sizes (over 4 GB) and is compatible with both Linux and Windows.

- Often used for media devices.

---

### Summary of Key Features:

- *EXT4*: Fast, reliable, general-purpose.

- *XFS*: High performance, large files.

- *Btrfs*: Advanced features like snapshots and compression.

- *F2FS*: Optimized for flash memory.

- *NTFS*: For compatibility with Windows (read/write in Linux with tools).

- *FAT32*: Old, basic file system, good for compatibility with various OS.

- *exFAT*: For flash drives, large files, cross-platform use.

Each file system has its strengths, so the choice depends on your needs (e.g., speed, reliability, file
size, compatibility).

Creating file system(ext4 usiing fdiks)

Steps to create the Ext4 file system:


1. List partitions:

o Run the command:

o fdisk -cUl /dev/sdb

o This will display all the partitions on the device /dev/sdb.


Look for one partition with a type of 83 (this means it's ready to be used for Linux).
That partition will be used to create the file system.

2. Check if the partition is empty:

o Run the command:

o mount /dev/sdb1 /mnt

o This will mount the partition /dev/sdb1 (the first partition on /dev/sdb) and show its
contents.
If the command fails, it’s fine because the partition is empty.
If it works, check the files in the /mnt folder to ensure there’s nothing important on
the partition.

3. Format the partition to Ext4:

o Run the command:

o mkfs.ext4 /dev/sdb1

o This formats the partition as Ext4.


After running this, you’ll see details like:

 The tool being used (e.g., mke2fs).

 The block size (default is 1024).

4. Mount the partition:

o Finally, run the command:

o mount /dev/sdb1 /mnt

o This mounts the formatted partition to the /mnt directory. Now, you can use the
partition to store files.

Key Commands Explained:

 fdisk: Lists and manages partitions on storage devices.

 mkfs.ext4: Formats a partition with the Ext4 file system.

 mount: Makes a partition accessible in your file system (like opening a folder).

In short:

1. Check the partition.


2. Format it.

3. Mount it for use.

4) Explain the content of fstab files (imp)

The fstab (file systems table) file is a configuration file in Unix-like operating systems, such as Linux,
that defines how and where storage devices (like disks, partitions, or remote file systems) are to be
mounted and accessed. It is typically located at /etc/fstab.

Structure and Content of fstab

Each line in the fstab file represents one filesystem and follows a specific structure with six fields:

1. Filesystem (Device or UUID)

 Specifies the source of the filesystem to be mounted.

 Examples:

o Device name: /dev/sda1 (a partition on a disk)

o UUID: UUID=123e4567-e89b-12d3-a456-426614174000 (universally unique


identifier of the partition)

o Label: LABEL=my_drive (volume label)

o Network file system: //server/share (for network-mounted resources like SMB/CIFS


shares)

 Use lsblk, blkid, or findmnt commands to identify device names, UUIDs, or labels.

2. Mount Point

 The directory where the filesystem will be mounted.

 Examples:

o /: Root filesystem

o /home: Home directory

o /mnt/backup: Custom mount point for a backup drive

3. Filesystem Type

 Specifies the type of filesystem on the device.

 Common types include:

o ext4, xfs, btrfs (local disk filesystems)

o vfat, ntfs (Windows-compatible filesystems)

o nfs, cifs (network filesystems)


o swap (swap space)

4. Options

 Mount options to define how the filesystem should behave.

 Common options:

o defaults: Standard options (read/write, noexec, etc.)

o ro: Read-only

o rw: Read/write

o noatime: Disables updating access times for files

o nosuid: Prevents execution of setuid/setgid binaries

o noauto: Prevent automatic mounting at boot

o user: Allow non-root users to mount

o credentials=/path/to/file: For network filesystems needing credentials

5. Dump

 Determines whether the filesystem should be backed up using dump utility.

 Values:

o 0: Do not back up.

o 1: Enable backups.

6. Pass

 Defines the order in which filesystems are checked at boot by fsck.

 Values:

o 0: Skip filesystem check.

o 1: First priority, usually reserved for root (/).

o 2: Second priority for other filesystems.

Example of fstab File


Key Points to Remember

1. The fstab file is processed at boot to determine which filesystems to mount automatically.

2. Incorrect entries in fstab can prevent the system from booting, so changes should be tested
carefully.

3. Use mount -a to test fstab changes without rebooting.

4. Backup fstab before making changes (cp /etc/fstab /etc/fstab.bak).

How to change the properties of file system

 Check Current Properties:

 Use the dumpe2fs command to view the current properties of the file system.
Example:

dumpe2fs /dev/sdb1 | less

 This command shows details such as the file system UUID, features, block size, and other
properties.

 Modify File System Properties:

 Use the tune2fs command to change file system properties.

 Example properties you can change:

o Maximum Mount Count (-c): Sets how many times the file system can be mounted
before it’s checked.

bash

Copy code

tune2fs -c 10 /dev/sdb1

(This will check the file system after 10 mounts.)

o Interval Between Checks (-i): Sets how often (in days, weeks, or months) the file
system is checked.
bash

Copy code

tune2fs -i 7d /dev/sdb1

(This will check every 7 days.)

o Reserved Blocks (-m): Change the percentage of reserved space.

bash

Copy code

tune2fs -m 2 /dev/sdb1

(This reduces reserved space to 2%.)

o Volume Label (-L): Assign a name fo the file system for easier identification.

bash

Copy code

tune2fs -L "MyLabel" /dev/sdb1


Mounting file systems automatically through fstab and its content:

 Dump Support:

 1: Use backup utility (dump) for this device.


 0: Do not use the dump utility.

 File System Check Order:

 1: Check the root file system first.

 2: Check this file system after the root.

 0: Skip the check.

Ssh , ues , main features

What is SSH?

SSH (Secure Shell) is a protocol that allows you to securely connect to another computer or server
over the internet or a network. It's commonly used to log into remote systems, run commands, and
transfer files safely.

Key Features of SSH

1. Security
SSH encrypts the data exchanged between your computer and the remote system. This
ensures that no one can see or alter your information while it's being transferred over the
network.

2. Authentication
SSH verifies your identity before letting you connect to a remote system. It can use:

o Passwords: You type in a password to log in.

o Keys: More secure, where you use a pair of cryptographic keys (public and private).

3. Data Protection
SSH ensures that any data sent is not changed during transmission. If someone tries to
change the data, SSH will detect it.

4. Remote Access
SSH allows you to access and control a computer or server from anywhere, as if you were
sitting right in front of it.

5. File Transfer
SSH supports transferring files securely with two protocols:

o SFTP (SSH File Transfer Protocol): Secure way to transfer files.

o SCP (Secure Copy): Another way to copy files between computers over SSH.

6. Port Forwarding
SSH can securely "tunnel" other types of network traffic (like web traffic) through an
encrypted connection. This can be useful when accessing services behind a firewall.

7. Running Commands
You can run commands on a remote machine without having to be physically present.
8. Cross-Platform
SSH works across different operating systems, like Linux, macOS, and Windows, making it
easy to connect between different devices.

Common SSH Commands

1. Log into a remote system:

2. ssh username@hostname_or_ip

3. Copy a file to/from a remote system:

4. scp local_file username@hostname:/path/to/remote/destination

5. Transfer files interactively:

6. sftp username@hostname

7. Create SSH keys (for secure login without passwords):

8. ssh-keygen

Why SSH is Useful

 Security: It protects your data and login information while you're accessing another system.

 Remote Control: Lets you manage servers and systems from anywhere in the world.

 File Transfer: Makes it easy to transfer files securely.

 No Need to Be Physically Present: You can access and control a computer from far away.

SSH is an important tool for anyone who needs to manage remote systems or servers securely.

Openssh clients
SSD

Here is a simplified version of the text you provided:

SSSD Overview

 The System Security Services Daemon (SSSD) helps manage identity and authentication.

 It checks a local cache for identity information or can connect to external sources like LDAP,
Active Directory, or Kerberos.

 SSSD benefits administrators by:

o Reducing the need for multiple identity/authentication services.

o Allowing offline authentication.

o Using a single service for different systems.

Setting Up SSSD

1. Configuration file: SSSD is configured in the sssd.conf file. By default, this file is located at
/etc/sssd/sssd.conf. If it's not there, you will need to create and configure it manually.

2. Parts of the configuration file:

o [sssd]: General settings like domain and services.

o [service_name]: Specific configuration for each service (e.g., nss for user lookup).

o [domain/DOMAIN_NAME]: Settings related to a specific domain.

Example configuration:

[sssd]

domains = LOCAL
services = nss

config_file_version = 2

[nss]

filter_groups = root

filter_users = root

[domain/LOCAL]

id_provider = local

auth_provider = local

access_provider = permit

Starting and Stopping SSSD

1. To start SSSD: Before starting SSSD, make sure at least one domain is set up.

o Use the command: service sssd start or /etc/init.d/sssd start.

o By default, ssd is not configured to start automatically.

o There are two ways to change its behaviour:

o Enabling ssd through authconfig command: # : authconfig --enableldapsauth --


update

o Add SSSD to the start list using chkconfig command: #chkconfig sss on.

Runlevel( network manager)

Network manager service used to start or restart the network on linux

It works with GUI as well as CLI

This service loads its configuration files when the system file start-up

Working with service and runlevel:

a runlevel is a system state that determines what services and programs run on the system. Each
runlevel is designed for a specific purpose, such as shutting down, maintenance, or normal
operations.

 Runlevel 0: Halt
 The system is shut down completely. All services and processes are terminated.

 This is a non-operational state, and the system is powered off.

 Command: init 0

 Runlevel 1: Single-User Mode

 A minimal environment for system maintenance, primarily used for troubleshooting or


repairing a system.

 Only the root user has access, and networking is usually disabled.

 No multi-user services are running, making it ideal for administrative tasks such as file
system repairs.

 Command: init 1

 Runlevel 2: Multi-User Mode without Networking

 This is a multi-user mode where multiple users can log in, but networking services are not
started.

 It's typically used in environments where networking is not required (such as for systems
that do not need to connect to the network).

 Command: init 2

 Runlevel 3: Multi-User Mode with Networking

 This is the default runlevel for most Linux servers.

 The system supports multiple users, networking is enabled, and full multi-user services (such
as web servers, databases, etc.) are running.

 This runlevel does not typically start a graphical user interface (GUI).

 Command: init 3

 Runlevel 4: Unused/Customizable

 Traditionally, runlevel 4 is not used by most Linux distributions.

 It can be configured for specific, custom purposes (e.g., for additional services or alternate
configurations).

 In some systems, it might be used as an alternative multi-user mode with special


configurations.

 Command: init 4 (if configured)

 Runlevel 5: Multi-User Mode with GUI

 This runlevel is used in environments where a graphical user interface (GUI) is needed,
typically for desktop systems.

 In this state, the system boots into a full multi-user mode with networking enabled and
starts the graphical login manager (like GDM or LightDM).
 Command: init 5

 Runlevel 6: Reboot

 The system reboots. All processes are terminated, and the system goes through the
shutdown process and restarts.

 Command: init 6

Write a short note on configuration authentication using cashing credentials.

Cached credentials allow Linux systems to authenticate users even when the system cannot reach
the central authentication server (e.g., LDAP, Active Directory, or Kerberos).

How Cached Credentials Work

 When a user logs in successfully, the system securely stores (caches) their authentication
information locally.

 If the authentication server is not available during login, the system checks the user's
information against the stored (cached) data.
 Ssd k bare me likh

You might also like