TEXT 32
System Admin Class 4 Guest on 29th October 2022 11:28:30 AM
  1. Cronjobs - a task scheduler
  2.  
  3.   .        .     .            .         .
  4. Minutes Hour  Day Of Month  Month    Weekly
  5.  
  6. Minutes (0-59)
  7. Hour (0-23)
  8. Day of Month (1-31)
  9. Month (1-12)
  10. Weekly (0-6)
  11. 0 is Sunday
  12.  
  13. Running script at 10:15 every Sunday
  14.  
  15. 15 10 * * 0
  16.  
  17. Every user has its own crontab
  18.  
  19. crontab -e - edit
  20. crontab -l - list
  21. crontab -r - remove
  22.  
  23. At command is useful for one-time tasks
  24.  
  25. # at 9:00 AM
  26. sh backup.sh
  27.  
  28. echo "sh backup.sh" | at 9:00 AM
  29.  
  30. atq - list of the scheduled jobs
  31.  
  32. atrm 3 - at remove, process id 3
  33.  
  34. Using VI, press I to insert, press ESC to remove "insert" mode
  35. Shift + : + q + !
  36. Shift + : + X
  37.  
  38. LVM (important topic)
  39.  
  40. Physical Volume > Volume Group > Logical Volume
  41.  
  42. Many disks can be combined, for example, three disks, and one disk is of 10 GB
  43.  
  44. So three disks are added into the Volume Group, VG. Which is total 30 GB now.
  45.  
  46. After that, a logical volume can be created with different partitions.
  47.  
  48. Workflow of LVM:
  49.  
  50. First create PV, then VG, then LV.
  51. Then file system and it is mounted.
  52.  
  53. When we have to add more disk after the LVs are already created.
  54. So, new disk is added as PV first and then to add into VG, use command vgextend
  55. After that, to add new disk into LV, lvextend is used. After this, then resize command is used to resize the file system.
  56.  
  57. First pvcreate /dev/sdb /dev/sdc /dev/sdd
  58.  
  59. pvs - to list down the physical volume
  60. Next step is to create Volume Group:
  61. vgcreate vg0 /dev/sdb /dev/sdc /dev/sdd
  62. to list down all vg, write vgs
  63. the following command can be also used to display vg: vgdisplay
  64.  
  65. To create LV, following command can be used:
  66. lvcreate -L 5G -n lv0 vg0
  67.  
  68. To display the list of LV, write lvs
  69.  
  70. Next step is to create the file system
  71.  
  72. mkfs.ext4 /dev/mapper/vg0-lv0
  73.  
  74. Then it is mounted
  75.  
  76. mount /dev/mapper/vg0-lv0 /mnt
  77.  
  78. Adding new disk to existing VG
  79. pvcreate /dev/sde
  80.  
  81. pvdisplay /dev/sde - shows all the physical drives
  82. vgdisplay vg0
  83.  
  84. Now use following command to extend VG
  85. vgextend vg0 /dev/sde
  86.  
  87. Now extend the LV using the following commands
  88. lvextend -L +5G /dev/vg0/lv0
  89.  
  90. Now to extend LV, file system must be updated, following command can be used:
  91. resize2fs /dev/vg0/lv0

Coding Base is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.