Posts

Extend/resize lvm

Physical volume (pv) Volume group (vg) Logical volume (lv) To extend lvm admins need to know if they needs to extend vg or lv. So if admins want to increase the space in lv then vg should have space then admins can increase, if vg doesn't have enough space then admins needs to add space in vg by create pv & then add space in vg. In following steps first add additional disk or you can use partitions if you using partitions in lvm. Step 1: Create pv on your new additional disk or paritition Command to create  physical volume " pvcreate /dev/sdc" Step2: Extend vg Command to extend vg is "vgextend datavg /dev/sdc" Step3: extend lv Command to extend lv is "lvextend datalv -l +3G datavg -r" -r resize the datalv -l option is to alternative way to resize the logical volume Step4: Create file system with xfs/ext mkfs.ext4 /dev/datavg/datalv Step5: Mount persistantly in /etc/fstab / dev/datavg/datalv /tmp/apps ext4  defaults 0 0

Create lvm step by step

Image
 Create LVM In this example /dev/sdc is used which is 3G Step 1: Creating physical volume (pv) Command to create pv is   "pvcreate /dev/sdc" Command to verify the pv is " pvs" Step 2: Creating volume group (vg) Command to create vg is "vgcreate <vgname> </dev/sdc>" Command to verify the vg is "vgs" Step 3: Creating  logical volume (lv) Command to create lv is "lvcreate -n <lvname> -L 1G  <vgname>" -n specify the logical volume -L absolute value Command to verify the "lvs" After creating lv thats how its looks Step 4: Create file system using xfs or ext4,ext3 Create file system on lvm using xfs or ext Step 5: Mount persistently in /etc/fstab In /etc/fstab entry will be like  </dev/datavg/datalv>   </mnt/datalvm>  <xfs> defaults 0 0 Follow this link to know about whats is lvm & why we create it: https://linuxgeekseasywords.blogspot.com/2022/09/what-is-logical-volume-manager-lvm-and....

What is Logical Volume Manager (lvm) and it's steps?

Image
  What is LVM? Lvm is a way to manage the storage dynamically (flexible). There are many reasons why administrator like to use lvm. 1. Lvm offers flexible solution to manage the storage means if logical volume (lv) is run out of space you can check if volume group (vg) has space you can extend the logical volume (lv) using the vg, if vg doesn't has same you can check physical volume (pv), if it has you can extend  the vg taking space from pv, if pv doesn't has space you can add additional disks to add space in pv. 2. Lvm has option that you can replace failing hard disk without any downtime. Below is lvm structure: Before you can create a lvm you need to make a physical volume (pv) then volume group (vg) and them logical volume (lv). What is physical volume (pv)? Pv is space which are disks and you create a pv on them , from which you can create a lvm. What is volume group (vg)? Volume group is consists of pv's. What is logical volume (lv)? Logical volume is to manage the s...

Create shell jobs and use mode of the jobs commands to manage the jobs

In this example four jobs are created then use fg, bg, ctrl z, ctrlz to manage the jobs. If you want to learn more about jobs use below link: https://linuxgeekseasywords.blogspot.com/2022/09/managing-processes.html   [root@geeks ~]# sleep 3212 &    first job/process in the background [1] 4481 [root@geeks ~]# sleep 43289 & second  job/process in the background [2] 4484 [root@geeks ~]# dd if=/dev/zero of=/dev/null &    third  job/process in the background [3] 4485 [root@geeks ~]# dd if=/dev/zero of=/dev/null &   fourth  job/process in the background [4] 4486 [root@geeks ~]# jobs  command to see background jobs [1]   Running                 sleep 3212 & [2]   Running                 sleep 43289 & [3]-  Running                 dd if=/dev/zero of=/dev...

Managing Processes

 What is a process? Any program that is active/running in your system it is a process. A program is an executable file which is save in the storages of the machine when you execute/run it create processes. Commands create process too because they are save in /bin and /sbin they are tiny programs that also save in your system when you execute a commands like uptime or ls it gives  you an output so they are process. Foregound processes(fg) and background processes(bg) Foreground processes: It take less time in executing so administrator run them in foregroung(fg). Background processes: When admins execute processes on shell some processes take time and take the terminal and while they executing/running admins can not do anything on terminal. So they use "&" end of programs/commands and system  take in the background(bg) to run. There are different stages of processes Running processes who are running in background Sleeping some processes depends on the provious procee...

kill, pkill, killall

What is difference between ps and jobs command? ps command is used to see the process of the current user it shows processes PID and their names and which terminal they were execute and time. jobs command shows only process state/status and their commands and names. Kill commands is used to kill processes/jobs it has two important flags kill -9   is called SIGKILL Kill -15 is called SIGTERM kill  is used to kill the processes/jobs by their Process ID (PID) pkill  is used to kill process/jobs by their name killall  also use to to kill processes who have same names create jobs then use ps to see the PID [root@geeks ~]# sleep 326718 & [1] 5480 [root@geeks ~]# sleep 789 & [2] 5481 [root@geeks ~]# dd if=/dev/zero of=/dev/null & [3] 5496 [root@geeks ~]# dd if=/dev/zero of=/dev/null & [4] 5499 [root@geeks ~]# dd if=/dev/zero of=/dev/null & [5] 5500 [root@geeks ~]# sleep 784  & [6] 5501 [root@geeks ~] # ps     PID TTY  ...

Working With Systemd and Manage the units files

Image
  Working With Systemd Understanding Systemd Systemd service is used to manage units. Units can be many things. One of the most important units type is service. Basically services are the processes that provides the specific functions in the system. To see Units types in systemd Understand systemd units location: / usr/lib/systemd/system contain units files which is default that install by rpm packages. /etc/systemd/system contains custom unit files that have been written by an  administrator.   You should never edit these files. Managing Units through systemd As an administrator to manages the systemd units to stop and start . Systemctl is the command to manage the services. The systemctl command has a lot of options. Don't be overwhelmed to see all the option just use bash-completition option. Systemd status overview Status                                    Description Lo...