Changes

Jump to: navigation, search

OPS235 Lab 3 - CentOS6

22 bytes removed, 12:30, 24 September 2018
no edit summary
[[Category:OPS235]]
{{Admon/caution|THIS IS AN OLD VERSION OF THE LAB|'''This is an archived version. Do not use this in your OPS235 course.'''}}
 
=Logical Volume Management and Software Package Management=
'''Perform the following steps:'''
 
(Perform investigations 1 - 3 in your host machine (c6host)
# Using information from the man page for <code>rpm</code>, fill in this information:
# Issue the following command: <code>rpm -e lynx</code>
# Issue an RPM query to verify that lynx is no longer installed. Record this command in your lab log-book.
# Move to the appropriate sub-directory for packages that begin with the letter '''b'''.# Issue the following command: <code>rpm -i elinks-0.12-0.21.pre5.el6_3.x86_64.rpm</code> and note the result. Did it work? Explain in your lab log-book why this command may not have worked.
'''Answer the Investigation 2 observations / questions in your lab log book.'''
::* Based on the result, do you think that cups is a useful package for your system? If not, try removing it.
<ol>
<li value="8">Unused and unneeded software can present a security risk and ties up disk space needlessly. Find at least 4 other packages (for example: games, sound & video, etc) that you're not using on your system, and remove them. Be careful to ensure that removing those packages does not also remove other software that you do need.</li>
</ol>
'''LVM''' ('''Logical Volume Management''') is used to manage hard disk drives / partitions for Unix/Linux systems. LVM provides more flexibility than just working with hard disks / hard disk partitions. '''Volume Groups''' are areas used to define '''Physical Volumes''' (i.e. hard disks, disk partitions, or other forms of storage devices). '''Logical Volumes''' are then used to relate directories (mount points) to a specific physical volume or for a "range" or "span" of physical volumes.
Therefore, LVM allows more flexibility and growth potential for Linux systems (for example, having Logical volumes span multiple hard disks). Fedora CentOS uses LVM by default upon installation. Other Linux distributions may provide the capacity to install LVM, or later install and then use Logical Volume Management. '''Although the concept of LVM is simple, it takes practice and preparation (or "thinking ahead") in order to correctly use this valuable tool'''. It is important for students to gain an understanding of LVM, and how to manage their filesystems using LVM. It is recommended for students to read the following resource prior to this lab and/or return to the following resource while performing this lab: [[Logical Volume Management]] At this point, having completed [[OPS235 Lab 2 - CentOS6|Lab 2]] you should have roughly the following disk storage setup:
'''Although the concept of LVM is simple, it takes practice and preparation (or "thinking ahead") in order to correctly use this valuable tool'''. It is important for students to gain an understanding of LVM, and how to manage their file-systems using LVM. It is recommended for students to read the following resource prior to this lab and/or return to the following resource while performing this lab: [[Logical Volume Management]] At this point, having completed [[OPS235 Lab 2|Lab 2]] you should have roughly the following disk storage setup:<br />('''Note:''' These results are output from the '''vgs''', '''lvspvs''', and '''pvslvs''' commands that provide volume group, physical volume and logical volume information for each of the virtual machines that you created in lab2. Before proceeding, check these values with your own system to see if you are generally "on the right track".<br /><br />)
* '''fedora1centos1'''
VG #PV #LV #SN Attr VSize VFree
vg_fedora1 vg_centos1 1 2 0 wz--n- 9.50g 0
PV VG Fmt Attr PSize PFree
/dev/vda3 vg_fedora1 vg_centos1 lvm2 a-- 9.50g 0
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
lv_root vg_fedora1 vg_centos1 -wi-ao 8.03g lv_swap vg_fedora1 vg_centos1 -wi-ao 1.47g
* '''fedora2centos2'''
VG #PV #LV #SN Attr VSize VFree
vg_fedora2 vg_centos2 1 3 0 wz--n- 1419.50g 351g 7.25g77g
PV VG Fmt Attr PSize PFree
/dev/vda3 vda2 vg_fedora2 vg_centos2 lvm2 a-- 1419.50g 351g 7.25g77g
LV VG Attr LSize Pool Origin SnapData% Move Log CopyCpy% Sync Convert lv_home vg_fedora2 vg_centos2 -wi-ao ---- 1.97g 95g lv_root vg_fedora2 vg_centos2 -wi-ao ---- 7.81g lv_swap vg_fedora2 vg_centos2 -wi-ao ---- 1.47g 97g
* '''fedora3 centos3 (Note: This VM has no GUI installed)'''
VG #PV #LV #SN Attr VSize VFree
vg_fedora3 vg_centos3 1 3 0 wz--n- 914.51g 04.54g
PV VG Fmt Attr PSize PFree
/dev/vda3 vg_fedora3 vg_centos3 lvm2 a-- 914.51g 04.54g
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
lv_home vg_fedora3 vg_centos3 -wi-ao ---- 1.00g lv_root vg_fedora3 vg_centos3 -wi-ao ---- 8.00g lv_swap vg_fedora3 vg_centos3 -wi-ao 520---- 992.00m
* '''f17host c6host (i.e. "removable hard disk" or "disk pack")'''
Does not use LVM. Confirm this using the same commands used above.
== Investigation 4: Extend the size of lv_root using command-line tools ==
Perform this investigation in fedora3centos3.
Let's say that you have run out of disk space on your computer (fedora3centos3), you need more space on the root filesystem, perhaps to host more webpages or a larger database or new software. What are your options? Getting a replacement harddrive would probably require reinstallation of the operating system and backup/restore of the data.
Because we're using LVM though - we can avoid that. We can add a new harddrive (which will serve as a physical volume) to the volume group, and extend the root logical volume to make use of the new available space.
'''Perform the following operations to increase the size of lv_root in fedora3centos3:'''
<u>'''<font>Steps:</font>'''</u>
lvs
df -h</code>
<li>Open the fedora3 centos3 virtual machine console</li>
<li>Go to the hardware details view</li>
<li>Click "Add Hardware" and add a new storage device of 2GBs, make sure it's a VirtIO disk.</li>
<li>Go back to the console view</li>
<li>Run the same ls command now(performed in step 1), what's changed?</li>
<li>Now we'll make the new device as a physical volume, add it to the volume group, and extend lv_root:</li>
<code>pvcreate /dev/vdb
vgextend vg_fedora3 vg_centos3 /dev/vdb
lvextend -l L +100%FREE 2G -r vg_fedora3vg_centos3/lv_root</code>
<li>Now rerun the ls/pvs/vgs/lvs/df commands. What has changed and what caused those changes?</li>
<li>Among the changes, note that your root filesystem is now 2GB bigger - and you have not even rebooted your machine!</li>
'''Answer the Investigation 4 observations / questions in your lab log book.'''
== Investigation 5: How are LVMs is LVM managed using system-config-lvm? ==
'''Perform this investigation on the VM named ''<u>fedora2centos2</u>''.'''[[Image:Ops235_lab4_1.png|thumb|right|Screenshot of system-config-lvm in FedoraCentOS. Click to enlarge.]]# Let's learn to administer (manage) our LVM graphically for our '''Fedora2centos2''' Virtual Machine.<br />Fedora CentOS provides a tool called <code>system-config-lvm</code> to graphically administer LVM. It will appear on the menu as '''Application'''>'''Other'''>'''Logical Volume Management'''. The package may is not be installed by default, so you will need to install it by issuing: (<code>yum install system-config-lvm</code>).
<ol>
<li value="2">Use this tool to determine the current LVM configuration by clicking on the appropriate element and reading the properties in the right-hand panel -- write down the answers:
</ol>
</li>
<li>Increase the size of the home file-system to '''2 4 GB''':
<ol type="a">
<li>Click on the LV containing the '''home''' filesystem.</li>
<li>Click on ''Edit Properties''.</li>
<li>Change the size to '''2 4 GB''' and click ''Ok''.</li> </ol> <li>Create a '''new 2G LV''' (LV Properties: linear) containing an ext4 filesystem named lv_archive and mount it at '''/archive''' <ol type="a"> <li>Click on ''Logical View''.</li> <li>Click the ''Create New Logical Volume''.</li> <li>Set the name, size, filesystem, and mount point.</li> <li>Click ''Ok''.</li>
</ol>
<li>Create a '''new 3G LV''' (LV Properties: linear) containing an ext4 filesystem named lv_archive and mount it at '''/archive'''
<li>Backup <code>'''/etc'''</code> into <code>'''/archive'''</code></li>
</ol>
If you completed this lab correctly - please make sure you are still making full backups of your virtual machines.
Remember adding a new harddrive to fedora3centos3? You will need to back up that drive as well. If you don't - you will only have half of your machine backed up, which is of no use for a recovery.
= Completing the lab =
'''Arrange evidence for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:'''
# nled installed elinks application removed on the host (disk pack - main system f16hostc6host).
# Unnecessary/unused packages have been deleted (list at least 4, and show that they are no longer installed).
# Fresh backup of the virtual machines.

Navigation menu