Open main menu

CDOT Wiki β

Changes

OPS235 Lab 5 - CentOS7 - SSD

No change in size, 02:46, 12 June 2016
no edit summary
Monitoring disk space activity helps provide Linux system administrators information to help take corrective action before problems can occur.
# Remain in your '''centos3centos2''' VM for this section.
# Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">df -h</span></code></b>
# Note the disk space usage for '''/''', '''/home''', and '''/archive''' partitions.
=== Part 1: Manage LVM Graphically===
[[Image:lvm1.png|thumb|500px|right|The '''system-config-lvm''' application allows the Linux system administrator to manage LVMs Graphically. Your LVM information for '''centos3centos2''' VM should be similarly displayed.]]# Let's learn to administer (manage) our LVM graphically for our '''centos3centos2''' Virtual Machine.# Launch your '''centos3centos2''' VM and open a shell terminal.
# CentOS provides a tool called '''system-config-lvm''' to graphically administer LVM.<br><br>'''NOTE:''' This tool may be replaced by a future graphical LVM management tool and is NOT currently available in the default repositories. We will now perform a "work-around" in order to make the system-config-lvm utility work in our system.<br><br>
# Issue the following command to download the system-config-lvm rpm:<br><b><code><span style="color:#3366CC;font-size:1.2em;">wget https://kojipkgs.fedoraproject.org//packages/system-config-lvm/1.1.18/1.fc19/noarch/system-config-lvm-1.1.18-1.fc19.noarch.rpm</span></code></b><br>(Although it is an rpm file for the Fedora Distribution, it will also work for Centos7).<br><br>
<li>Now issue the commands '''n''' (new partition), '''p''' (primary partition), '''3''' (i.e. next available partition number). When prompted for initial block, '''press enter to accept the default beginning block size''', and '''type: +2G''' at ending block (create 2GB for partition) and '''press enter'''. </li>
<li>At the fdisk prompt, issue the command '''p''' to review the partition information, then type '''w''' to save partition table and exit (ignore WARNING message).</li>
<li>You <u>'''must'''</u> restart your centos3 centos2 VM to allow changes to take effect</li>
<li>Open a terminal as root, and format your newly-created partition by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">mkfs -t ext4 /dev/vda3</span></code></b><br>(or ''mkfs -t ext4 /dev/sda3'')</li>
</ol>
<li>'''Restart system-config-lvm'''. You should notice a section at the bottom indicating <u>Unallocated</u> Physical Volumes. Click on the <u>unallocated</u> partition /dev/vda3 and then click '''Add to Existing Volume Group''' (click on other button in next screen to continue). The screen should now show the partition ''/dev/vda3'' contained in our default Volume Group (refer to diagram on right-side for reference).</li>
<li>Click on Logical View (i.e. above home, root, swap), and then click on '''Create New Logical Volume''' button and fill out the details for this new logical volume including: size: '''1GB''', LV Properties: '''linear''', file system: '''ext4''' file system name: '''archive''', select '''mount''' and mount it at: '''/archive'''. Have the system create the directory ''/archive'' if it does not exist (Refer to diagram on right for reference).</li>
<li>Confirm that this new Logical Volume now exists by changing to the directory /archive. Did you need to restart your centos3 centos2 VM to confirm that the '''/archive''' directory is now on your '''centos3centos2''' VM?</li>
<li>Use system-config-lvm to resize (i.e. edit) the '''archive''' logical volume to '''1.5 GB''' and verify your results.</li>
</ol>
[[Image:mount.png|thumb|700px|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.]]
# Perform this part in your '''centos3centos2''' VM.
# As you may recall in Part 1 of Investigation 1, we created another logical volume called '''archive''' using the graphical application '''system-config-lvm'''. This logical volume should be mounted (connected) to our existing file-system (2GB).
# Issue the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">mount</span></code></b>
# View the contents of the file-system table /etc/fstab by issuing the following command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">cat /etc/fstab</span></code></b>
# Note the line that automatically mounts a file-system (''/dev/sda3'', type ''ext4'') to '''/archive'''. This was automatically performed for you via the '''system-config-lvm''' utility.
# View and record the fields for the '''/archive''' mount in your lab logbook, and then issue the following command to reconnect or mount '''/archive''':<br><b><code><span style="color:#3366CC;font-size:1.2em;">mount &nbsp; -t ext4 &nbsp; /dev/centos_centos3centos_centos2/archive &nbsp; /archive</span></code></b><br><br>'''NOTE:''' If you are having problem mounting, use the /dev pathname listing in your /etc/fstab file.<br><br># Confirm that this file-system has been properly mounted. Note: You could have also issued the command: '''mount -a''' to <u>automatically</u> mount the file-systems contained in the '''/etc/fstab''' file.<br><br>Tip: If you had to do manually configure /etc/fstab (eg. only in text-based mode - centos4), you could have issued the command (as root):<br> <b><code><span style="color:#3366CC;font-size:1.2em;">echo "/dev/centos_centos3centos_centos2/archive /archive ext4 defaults 1 2" >> /etc/fstab</span></code></b><br>(although we don't need to do this, since it was already done).<br><br>
# '''A curious question''': If root needs to unmount the '''/home''' directory for maintenance but we had to first login in graphically as a regular user, then su to "root", isn't our regular user still logged in so we can't un-mount the /home directory?!? How can we as a Linux System Administrator get around the problem (hint: you already learned it somewhere in lab3!!! Wow, using what we already taught can pay-off in the future ... lol!).
'''Perform the Following Steps:'''
# Make certain that your '''c7host''', '''centos3centos2''', and '''centos4''' VMs are running.# Switch to your '''centos3centos2''' VM, open a shell terminal, and issue the Linux command: <b><code><span style="color:#3366CC;font-size:1.2em;">wget http://matrix.senecac.on.ca/~murray.saul/ops235/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> '''centos3centos2''' VM:<blockquote><ul><li>'''Logical Volume''', '''Physical Volume''', and '''Volume Group''' information </li><li>Contents of '''/etc/fstab''' file</li><li>Proof that '''/archive''' has been mounted</li></ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''centos4''' VM:<blockquote><ul><li>Proof of virtual hard disk creation</li><li>'''Logical Volume''', '''Physical Volume''', and '''Volume Group''' information </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></ul></blockquote><span style="color:green;font-size:1.5em;">&#x2713;</span> '''Lab5''' log-book filled out.
13,420
edits