Linux Unit 2
Linux Unit 2
1. What is Logical Volume Manager? What are the different types of partitions that are created in
Linux?
Ans
1) Partitions offer a rather static way to configure storage on a server, whereas logical volumes offer
a much more dynamic way to configure storage. However, all Red Hat servers have at least one partition
that is used to boot the server
2) If you need only basic storage features, you’ll use partitions on the storage devices. In all other
cases, it is better to use logical volumes
3) The Logical Volume Manager (LVM) offers many benefits. The following are its most interesting
features:
• LVM makes resizing of volumes possible.
• In LVM, you can work with snapshots, which are useful in making a reliable backup.
• In LVM, you can easily replace failing storage devices
4) Creating a partition with fdisk is easy to do. After starting fdisk, you simply indicate you want to
create a new partition. You can then create three kinds of partitions.
5) Primary Partitions These are written directly to the master boot record of your hard drive. After
creating four primary partitions, you can’t add any more partitions—even if there is still a lot of disk space
available.
6) Extended Partition Every hard drive can have one extended partition. You cannot create a file
system in an extended partition. The only thing you can do with it is to create logical partitions
7) Logical Partitions A logical partition (not to be confused with a logical volume) is created inside an
extended partition. You can have a maximum of 11 logical partitions per disk
8. What is NetworkManager configuration file? Explain any five network configuration file
variables.
Ans
1) In the directory /etc/sysconfig/network-scripts, you’ll find a Configuration file for each network interface
on your server. The names of all of these files start with ifcfg- and are followed by the names of the
specific network cards.
2) If your network card is known as p6p1, for example, its Configuration is stored in
/etc/sysconfig/network-scripts/ifcfg-p6p1. Different variables are defined in the Configuration file.
9. What are Snapshots? Give steps to manage Snapshot.
Ans
1) Snapshots are also commonly used to create backups safely.
2)Instead of making a backup of the normal LVM volume where files may be opened, you can create a
backup from the snapshot volume, where no file will be open at any time.
3) When initially creating a snapshot, the file system metadata is copied to the newly created snapshot
volume.
4) The file blocks stay on the original volume, however, and as long as nothing has changed in the
snapshot metadata, all pointers to the blocks on the original volume remain correct.
5) When a file changes on the original volume, the original blocks are copied to the snapshot volume
before the change is committed to the file system.
This means that the longer the snapshot exists, the bigger it will become.
6) Every snapshot has a life cycle; that is, it’s not meant to exist forever.
7) If you no longer need the snapshot, you can delete it using the lvremove command.
8) Steps to Manage Snapshots
1. Creating a Snapshot (LVM Example)
Use the lvcreate command with the -s flag to create a snapshot.
Example:
lvcreate -L <size> -s -n snapshot_name /dev/volume_group/logical_volume
Replace <size> with the desired size of the snapshot (e.g., 1G).
Replace snapshot_name, volume_group, and logical_volume with appropriate names.
2. Mounting a Snapshot
mount /dev/volume_group/snapshot_name /mnt/snapshot
3. Deleting a Snapshot
lvremove /dev/volume_group/snapshot_name
10. Explain useradd, usermod, userdel commands. Explain the following options of passwd
command: -l, -u, -S, -e, -n min, -c warn, -i intact.
Ans
1. useradd : Used to create a new user account in Linux
useradd username
2. usermod : Used to modify an existing user account.
usermod -aG groupname username
3. userdel : Used to delete a user account.
userdel username
1. -l (Lock Account)
Locks a user account by disabling the password.
Example:
passwd -l username
2. -u (Unlock Account)
Unlocks a previously locked user account.
Example:
passwd -u username
3. -S (Status of Password)
Displays the password status of a user.
Example output:
username P 07/17/2023 0 99999 7 -1
(Indicates if the account is locked, password age, and expiration).
4. -e (Expire Password Immediately)
Forces the user to change their password on the next login.
Example:
passwd -e username
5. -n <min> (Set Minimum Password Age)
Specifies the minimum number of days before a user can change their password again.
Example:
passwd -n 7 username
6. -c <warn> (Set Warning Period)
Sets the number of days before expiration that the user is warned to change their password.
Example:
passwd -c 5 username
(Warns user 5 days before the password expires).
7. -i <inactive> (Set Inactivity Period)
Sets the number of days after password expiration that the account will be disabled if not changed.
Example:
passwd -i 10 username
(Disables the account 10 days after password expiration).
11. What are Pluggable Authentication Modules? What are its two parts? Explain.
Ans
1) On Linux, pluggable authentication modules (PAM) are what is used to make authentication pluggable.
2) Every modern service that needs to handle authentication passes through PAM.
3) There are two parts in PAM. First there are the configuration files in use.
4) Every service has its own configuration file in the directory /etc/pam.d.
5) For instance, the login service uses the configuration file /etc/pam.d/login
6) The PAM file for login defines how to handle login.
7) This file has three columns that define the login process.
8) In the first column, the authentication process is split into four different phases: auth, account,
password, and session.
9) These are the stages that are typically passed through in the authentication process, but in the end,
the writer of the PAM module decides which of these to implement.