Changes

Jump to: navigation, search

OPS235 Lab 5

128 bytes added, 00:31, 11 September 2019
no edit summary
[[Category:OPS235]]
 
=LAB PREPARATION=
{| width="40%" align="right" cellpadding="10"
[[Image:crontab.png|thumb|right|175px|Linux system administrators need to schedule Linux shell scripts and commands (via '''crontab''') to automatically run in order to be more productive.]]
|}
 
 
 
===Purpose / Objectives of Lab 5===
[http://man7.org/linux/man-pages/man8/pvdisplay.8.html pvdisplay]<br>
[http://man7.org/linux/man-pages/man8/lvdisplay.8.html lvdisplay]<br>
[http://manpages.ubuntu.com/manpages/trusty/man8/ssm.8.html ssm]<br>
|style="padding-left:20px;" |LVM Management
[http://manpages.ubuntu.com/manpages/trusty/man8/ssm.8.html ssm]<br>
[http://man7.org/linux/man-pages/man8/lvextend.8.html lvextend]<br>
[http://man7.org/linux/man-pages/man8/lvcreate.8.html lvcreate]<br>
[http://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800 Using crontab]
|}
 
= INVESTIGATION 1: MONITORING HARD DISK SPACE =
#Make certain you are logged in as '''root'''.
#Change to the '''/root/bin''' directory.
#Download the following shell script by issuing the following command: <br><b><code><span style=" pointer-events:none;cursor:default;color:#3366CC;font-size:1.2em;">wget https://scsict.senecac.onsenecacollege.ca/~murray.saulops235/lab5/monitor-disk-space.bash</span></code></b>
#Try to understand what this Bash Shell script does (refer to man pages for the '''awk''' command), and then run the script as root.
#Give execute permissions and run this shell script. This script is supposed to notify the root user by email if there are any potential partition size issues.
'''Answer INVESTIGATION 1 observations / questions in your lab log book.'''
 
=INVESTIGATION 2: MANAGING HARD DISK SPACE USING LVM=
<ol><li value="21">Reduce the file-size by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">lvreduce -r -L -0.5G centos_centos2/archive</span></code></b></li>
<li>Issue the '''ssm list''' command to verify.</li>
<li>Increase the file-size by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">lvextend -r -L +1G centos_centos2/archive</span></code></b></li>
<li>Issue the '''ssm list''' command to verify.</li>
</ol>
[[Image:Add_virtual_disk.png|thumb|right|400px|You can add virtual hard disks for a VM by changing to the Details section for the VM (as opposed to console), click Add Hardware, fill information in the Add New Virtual Hardware dialog box and clicking Finish.]]
|}
 
===Part 2: Adding Additional Virtual Hard Drives===
<li value="3">Record the size of the volume group and the amount of free space</li>
<li>At the top of your KVM window for '''centos2''', click the '''view''' menu and change view from '''Console''' to <u>'''Details'''</u>''' .</li>
<li>At the bottom left-hand corner, click '''Add Hardware''' and add a new storage device of '''2GBs''', make sure the '''Bus type''' is selected as: <u>'''VirtIOusing the same type as your first drive that's already there''' disk</u>. If your first drive is SATA, IDE, or VirtIO, select that.</li>
<li>Click the '''VM''' menu again, and return to the '''console''' view to access your centos2 VM display.</li>
<li>Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">ls /dev/vd*</span></code></b>, what has changed?</li>
<li>Use '''fdisk''' (''refer to how to use in Part 1'') to create a new single '''primary''' partition for '''/dev/vdb''' that fills the ''entire'' disk, save partition table (accepting defaults prompts would work), restart your '''centos2''' VM and then '''format''' that partition for file type: '''ext4'''.</li>
<li>Now we'll make the new device a '''physical volume''', add it to the '''volume group'''by issuing the following commands:<br><b><code><span style="color:#3366CC;font-size:1.2em;">pvcreate /dev/vdb1</span></code></b> (enter '''y''' to proceed - ignore warning)<br><b><code><span style="color:#3366CC;font-size:1.2em;">vgextend centos_centos2 /dev/vdb1</span></code></b><br><br>'''NOTE:''' If you experience an error message, issue the '''ssm list''' command, and check the '''volume group name''' under the '''"pool"''' section.<br>If the volume group name is different than '''centos_centos2''', then use that volume group name for all remaining commands that use "centos_centos2"<br><br></li>
<li>Re-issue the '''ssm list''' command to see if there is any change.</li>
<li>Issue the following command to extend the logical volume for the home file-system: <b><code><span style="color:#3366CC;font-size:1.2em;">lvextend -r centos_centos2/home --size +2G</span></code></b></li>
<li>Record the size of the volume group and the amount of free space. What has changed and what caused those changes?</li>
<li>Issue the '''ssm list''' command. Note that your home file-system is now 2GB bigger, and you have not even rebooted your machine since you used fdisk to create a partition!</li>
# Switch to your '''c7host''' machine.
# Open a shell terminal, '''su -''' into root, and change to the '''/root/bin''' directory., open a shell terminal
# Issue the Linux command: <b><code><span style="color:#3366CC;font-size:1.2em;">wget httphttps://matrixict.senecac.onsenecacollege.ca/~murray.saulops235/ops235lab5/lab5-check.bash</span></code></b>
# Give the '''lab5-check.bash''' file execute permissions (for the file owner).
# Run the shell script and if any warnings, make fixes and re-run shell script until you receive "congratulations" message.
#Arrange proof of the following on the screen:<br><blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''centos2''' VM:<blockquote><ul><li>Output from '''ssm list''' command.</li><li>Proof that '''/archive''' has been mounted</li></ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''c7host''' Machine:<blockquote><ul><li>Proof of creation of the shell script: '''monitor-disk-space.bash'''</li><li>Crontab entry for '''root''' account</li><li>Run the '''lab5-check.bash''' script in front of your instructor (must have all <b><code><span style="color:#66cc00;border:thin solid black;font-size:1.2em;">&nbsp;OK&nbsp;</span></code></b> messages)</li></ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''Lab5''' log-book filled out.
 
= Practice For Quizzes, Tests, Midterm &amp; Final Exam =
[[Category:OPS235]]
[[Category:OPS235 Labs]]
[[Category:CentOS 7]]
[[Category:SSD2]]

Navigation menu