Changes

Jump to: navigation, search

OPS235 Lab 5

320 bytes added, 12:15, 5 August 2020
Part 2: Adding Additional Virtual Hard Drives
[[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===
#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 httphttps://csict.senecacollege.ca/~ops235/lab5labs/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.
# You can create a partition by using the fdisk command. Issue the following command: <br><b><code><span style="color:#3366CC;font-size:1.2em;">fdisk /dev/vda</span></code></b> (or fdisk /dev/sda if there is no /dev/vda).
#At the '''fdisk''' prompt, issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">p</span></code></b>. What does this do?
#Now issue the commands <b><code><span style="color:#3366CC;font-size:1.2em;">n</span></code></b> (new partition), <b><code><span style="color:#3366CC;font-size:1.2em;">p</span></code></b> (primary partition), <b><code><span style="color:#3366CC;font-size:1.2em;">3</span></code></b> (i.e. next available partition number). When prompted for initial block, press '''enter''' to accept the default beginning block size, and type: <b><code><span style="color:#3366CC;font-size:1.2em;">+3G</span></code></b> at ending block (create 2GB for a 3GB partition) and press '''enter'''.
#At the fdisk prompt, issue the command <b><code><span style="color:#3366CC;font-size:1.2em;">p</span></code></b> to review the partition information.
#Enter the command <b><code><span style="color:#3366CC;font-size:1.2em;">w</span></code></b> to save partition table and exit (ignore WARNING message).
<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 default prompts would workand '''type w to write your changes'''!), restart your '''centos2''' VM and then .<li> Format your new ''vdb1'format''' that partition for with 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>
= LAB 5 SIGN-OFF (SHOW INSTRUCTOR) =
===Exclusively for Summer 2020 term, submissions are accepted only online!===
Follow the submission instructions for lab 5 on Blackboard.
{{Admon/important|Time for a new backup!|If you have successfully completed this lab, make a new backup of your virtual machines as well as your host machine.}}
# 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://csict.senecacollege.ca/~ops235/lab5labs/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.
[[Category:OPS235]]
[[Category:OPS235 Labs]]
[[Category:CentOS 7]]
[[Category:SSD2]]
[[Category:Digital Classroom]]

Navigation menu