Changes

Jump to: navigation, search

Lab 5 Warnings / Debrief

4,625 bytes added, 09:13, 17 March 2016
no edit summary
LVM allows more flexibility and growth potential for Linux systems (for example, having Logical volumes span multiple hard disks). CentOS uses LVM by default upon installation. Other Linux distributions may provide the capacity to install LVM,
== Any Simple Comparisons for LVM !?! ==
==LVM Tools==[[Image:lvm1.png|thumb|400px|right|The '''Certainlysystem-config-lvm''' application allows the Linux system administrator to manage LVMs Graphically.Your LVM information for '''centos2''' VM should be similarly displayed.]] * There is a choice for managing LVM: Graphically or via Command-Line.* A graphic program is called: '''system-config-lvm'''.This graphical application is useful, but may be deprecated (i.e. "being phased out").* There are various commands to manage LVM (some include)::*'''lvextend''':*'''lvcreate''':*'''lvreduce''':*'''pvcreate''':*'''vgextend'''<br><br>* There are also commands to obtain LVM information::*'''vgs''':*'''pvs''':*'''lvs''' 
== Any Simple Comparisons for LVM !?! ==[[Image:lvma.png|thumb|right|800px700px|'''LVM''' ('''Logical Volume Manager''') is a program to manage file system size in an efficient manner. If this diagram was displayed <u>vertically </u> as opposed to <u>horizontally</u>, you could visualize building a large cake with many layers!]]
'''Certainly... Think of Using LVM like "building a cake":'''
* A cake needs to rest on a '''platter'''.
'''Need a Bigger Cake? Add More Layersfor the unexpected guests!'''
* We can grow a larger cake by adding more <u>layers</u>.* In our case, we define add layers by defining and add adding '''physical Volumes''' to our Volume Group.* Some think of physical volumes as <u>partitions</u>.
* When you want to make a bigger cake, add more layers (in our case, add more physical volumes to volume group
* The partitions should be created and formatted('''fdisk''', '''mkfs'''), then can be added as physical volumes to the volume group('''pvcreate''')
'''Logical Volumes are like the "Hungry Unexpected Guests" at the Party (ai.ke.a the "cake inhalers"larger number of guests that expected)'''
* As hungry guests sample some can and want more, they can grab more layers of cake.
* In fact, they can also have the ability to grab pieces from different cakes (i.e. from different plattersor Volume Groups).
* A Logical Volume is simply a directory (mount-point) that is associated to a physical Volume or a group of physical volumes
* In our case, if we want more file size, simply create and format a partition, add it to the volume group, and then extend logical volume ('''lvextend''') so that directory or file system can grow.* If we want to reduce size of logical volume, we can use the '''lvreduce''' command.* There used to be problems if you reduced the logical volume size smaller than its unused capacity, but using the -r option prevents this from occurring.
* We can do these type of LVM operations without having to reboot the machine!
* You will also learn to simulate adding new hard disks by creating a virtual hard drive, partition & format new drive, add physical volume to volume group ('''pvcreate''', '''vgextend''') and extend the logical volume.
'''LVM Tools'''
* There are a choice for managing LVM: Graphically or via Command-Line.
* A graphic program is called: '''system-config-lvm'''. This graphical application is useful, but may be deprecated (i.e. "being phased out").
* There are various commands to manage LVM (some include):
:*'''lvextend'''
:*'''lvcreate'''
:*'''lvreduce'''
:*'''pvcreate'''
:*'''vgextend'''<br><br>
* There are also commands to obtain LVM information:
:*'''vgs'''
:*'''pvs'''
:*'''lvs'''
==Additional File System Maintenance==
[[Image:mount.png|thumb|400px700px|right|Using the '''mount''' command with no arguments displays file-systems that are already mounted. The Linux system administrator can use the '''mount''' and '''umount''' commands to connect and disconnect different partitions from the file-system to perform maintenance.]]
'''<u>Mounting and Un-Mounting File-Systems</u>'''
The Linux system administrator also has the ability to manually '''mount''' (connect) and '''un-mount''' (disconnect) partitions in order to perform maintenance on the file system (for example un-mounting the '''/home''' partition to install software and prevent users from logging in during that process). Those command are called: '''mount''' and '''umount''' (that is NOT a typo)!
 
A useful example of un-mounting and mounting manually would be if a software update is to be performed, and users are not allowed to access the system. In this case, the system administrator could send an alert for the users to log-off the system due to system maintenance, un-mount the '''/home''' directory to prevent any regular users to login, and then update the software. Once the software has been updated, then mount the '''/home''' directory to allow user access.
[[Image:disk_usage.png|thumb|700px|right|The '''df''' and '''du''' commands are useful tools for Linux system administrators to flag disk space issues and investigate their causes.]]
Since administrators may need to log into the system with their regular user accounts, and then issue the '''su''' command to connect into the '''root''' account, there is a dilemma: How can /home be unmounted when you are logged in as a regular user. The solution would be to reboot the machine and boot into single-user mode (demonstrated in '''lab3'''). This allows the system administrator to connect into the system in a text-based system automatically logged in as root. Remember that '''the root account has its own home directory''' (i.e.'''/root''') which is not associated with the ''/home'' directory (which can now be un-mounted and mounted for system maintenance).
'''<u>Monitoring File System Space</u>'''
[[Image:disk_usage.png|thumb|300px|right|The '''df''' and '''du''' commands are useful tools for Linux system administrators to flag disk space issues and investigate their causes.]]
Another essential duty of a Linux system administrator is to anticipate problems and take preventative measures to avoid computer system problems <u>before</u> that occur.
Monitoring disk space activity helps provide Linux system administrators information to help take corrective action before problems can occur. The '''df''' and '''du''' commands are simply yet useful commands to help a Linux system administrator analyze and take corrective action to fix low disk space issues.
If we need more space, then we can use LVM to help us out!
Cron Tables (crontabs) allow the Linux System Administrator to run useful shell scripts or shell script that we have created at specific dates/times. It would be silly to expect a system administrator to stay up late (eg. 2 a.m.) to manually run a shell script to terminate processes or to re-boot Linux servers. Database files (tables) are used to provide instructions on how frequent shell scripts or commands can be run. The '''cron''' daemon is used to refer to these files and to run them on a pre-determined basis. The term '''cron''' comes from the old word '''chronograph''' meaning a special type of watch (actually a ''stop-watch'') to help monitor and schedule routine tasks.
Scheduling commands, shell scripts, or other programs to be run are contained in a file called: '''/etc/crontab'''. This file stores the list of jobs to do that are run on a particular schedule. This file cannot be edited manually via a text editor. Instead, the '''crontab''' utility is used to create, edit and remove that file. Here some ways to use the crontab utility: Crontab utility is very easy to use. '''crontab -e''' (creates or edits crontab file)'''crontab -u username -e''' (for specified user)'''crontab -l''' (lists current crontab file)'''crontab -r''' (remove crontab file)  <u>'''Typical field layout for a crontab entry (or multiple entries)'''</u> <pre style="font-size:14pt">.---------------- minute (0 - 59)| .------------- hour (0 - 23)| | .---------- day of month (1 - 31)| | | .------- month (1 - 12) (or jan,feb,mar,apr ...) | | | | .---- day of week (0 - 6) (Sunday=0 or 7) | | | | | (or sun,mon,tue,wed,thu,fri,sat)| | | | |* * * * * command to be executed</pre>(NOTE: The asterisk (*) indicate to run for that unit of time)  <u>'''Example of crontab entry (using the ''crontab'' command to edit the '''/etc/crontab''' file)'''</u> <pre style="font-size:14pt;font-family:courier;"># Check every minute for logins by user “elvis”* * * * * who | grep 'elvis' # Run a script called "ascript.bash" every odd hour (1,3 5...) during the week0 1,3,5,7,9,11,13,15,17,19,21,23 * * 1-5 /home/bob/ascript.bash # Run "ascript.bash" every half hour during the week0 */2 * * 1-5 /home/bob/ascript # Same... just doing it a different way0 */2 * * mon,tue,wed,thu,fri /home/bob/ascript </pre> You will learn in the lab how to create and use crontabs the crontab utility to run periodically a shell script automatically and periodically that will send an e-mail warning to the system administrator if disk space capacity has reached a level for immediate resolution.
== Lab 5 Debrief = == Preparing for the Quizzes == # What is a VG? PV? LV? # What is the total size of the "main" VG on your system?# How do you create an LV?# How do resize an LV?# How would you add the disk partition '''/dev/sdb7''' to your volume group "main"?# How would you increase the size of the root filesystem by 50 MB?# How can you determine if a partition has been mounted onto a system?# How can you unmount an existing partition from the file-system?# How can you temporarily mount a partition on a file-system?# How can you permanently mount a partition on a file-system upon boot-up?# What are the separate elements (fields) of the '''/etc/fstab''' file?# Describe the tools that a Linux system administrator have to monitor disk space usage.
13,420
edits

Navigation menu