Open main menu

CDOT Wiki β

Changes

OPS235 Lab 4 - Fedora17

2,223 bytes removed, 12:31, 24 September 2018
no edit summary
[[Category:OPS235]][[Category:OPS235 Labs]]
{{Admon/caution|THIS IS AN OLD VERSION OF THE LAB|'''This is an archived version. Do not use this in your OPS235 course.'''}}= State when Storage Setup (prior to starting Lab 4 ) =
At this point, having completed [[OPS235 Lab 3|Lab 3]] you should have <u>roughly</u> the following disk storage setup:<br />('''Note:''' These results are output from the '''vgs''', '''lvs''', and '''pvs''' commands within each virtual machine. You will be using these commands in the following lab investigations)<br /><br />
* '''fedora1'''
This VM has a GUI and no free space in the VG.
/dev/vda2 vg_fedora1 lvm2 a- 9.80G 0
* '''fedora2'''
This VM has a GUI and free space in the VG.
VG #PV #LV #SN Attr VSize VFree
vg_fedora2 1 3 0 wz--n- 914.80G 34.95G07G
LV VG Attr LSize
lv_home vg_fedora2 -wi-ao 1000 1.00M 95G lv_root vg_fedora2 -wi-ao 37.91G 81G
lv_swap vg_fedora2 -wi-ao 992.00M
PV VG Fmt Attr PSize PFree
/dev/vda2 vg_fedora2 lvm2 a- 914.80G 34.95G07G
* '''fedora3'''
This VM has no GUI installed.
/dev/vda2 vg_fedora3 lvm2 a- 9.80G 3.83G
* host '''f17host (i.e. "disk pack")'''
Four PVs, minimum VG size 60G
20% of disk space unallocated to any partition (min 15G)
= Logical Volume Management (Continued) =
{{Admon/note|Recovering VMs|'''Most of these investigations will take place in you virtual machines. ''' If you make a significant mistake, your virtual machine may not boot. Remember that you created backups of your virtual machines in Lab 3, and you can '''restore them if something goes wrong'''.}}
== Resources ==
'''Please read this page to get an overview of LVM:'''<br /><br />('''Note:''' It is recommended to return to this guide as a reference when performing the next several investigations).<br /><br />
* [[Logical Volume Management]]
== Investigation 1: How are LVMs managed using system-config-lvm? ==
'''Perform this investigation on the VM named ''fedora2''.'''
[[Image:Ops235_lab4_1.png|thumb|right|Screenshot of system-config-lvm in Fedora 12. Click to enlarge.]]
# Fedora provides a tool called <code>system-config-lvm</code> to graphically administer LVM. It will appear on the menu as System>Administration>Logical Volume Management. Verify that this package is present, and install it if required.
# 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:
#* What are the names and sizes of the PVs?
#* What is the name and size of the VG?
#* What are the names and sizes of the LVs?
#* Is there any space in the VG which is not allocated to a LV?
# Increase the size of the home filesystem to 2 GB:
## Click on the LV containing the home filesystem.
## Click on ''Edit Properties''.
## Change the size to 2 GB and click ''Ok''.
# Create a new 2G LV containing an ext4 filesystem named lv_archive and mount it at /archive
## Click on ''Logical View''.
## Click the ''Create New Logical Volume''.
## Set the name, size, filesystem, and mount point.
## Click ''Ok''.
# Backup <code>/etc</code> into <code>/archive</code>
#* Copy the files in /etc into the filesystem mounted at <code>/archive</code> (use the graphical tools or the command line. If using cp, remember to use the -R option).
# Shrink the size of <code>lv_archive</code> to 1 GB.
# Try shrinking <code>/</code> -- what happens? Why?
== Investigation 21: How are LVMs are managed from the command line? using Command-Line Tools ==# You are going to repeat the same LVM management operations (as your did with the ''fedora2'Repeat the operations from Investigation 1' VM in '''lab3'''), but you will using command-line tools in the virtual machine ''fedora3'fedora 3''' (VM. Since the fedora3 VM only operates in command-line tools only)mode, you will need to refer to the '''"Logical Volume Management"''' link above. # Write down the exact commands used at each step, and record appropriate command output:'''## Determine the current LVM configuration using the <code>pvs</code>, <code>vgs</code>, and <code>lvs</code> command.## Grow the home filesystem to 2G using the command <code>lvextend</code> and <code>resize2fs</code>.## Create a new 2G LV containing an ext4 filesystem and mount it at /archive (use <code>lvcreate</code>, <code>mkfs</code>, <code>mount</code>, edit the file <code>/etc/fstab</code>, and then reboot to confirm automatic mount).## Copy the contents of <code>/etc</code> into <code>/archive</code>.## Shrink <code>lv_archive</code> to 1G (use <code>umount</code>, <code>resize2fs</code>, <code>lvreduce</code>, <code>resize2fs</code>, and <code>mount</code>)
== Investigation 32: How can a PV be added to an existing VG? =='''Add an additional 2 GB virtual disk to your ''<u>fedora1</u>'' system, and use it as an additional physical volume:'''
# Start <code>virt-manager</code>.
# Shutdown ''fedora1'' if it is running.
# Open the console window for ''fedora1''.
# Select the menu option View>Details.
# Click ''+ Add Hardware''button at the bottom left-hand corner.# In the ''Adding Virtual Hardwarenew virtual hardware'' window that appears, select a Hardware Type of ''"storage"'' and click ''"Forward"''.# Select ''File (Disk Image)'' for the Make certain option "Managed or other existing storage space" is selected. Click on the ''Browse'' button near the ''Location'' field, add a new volume (which creates a new file in <code>/var/libvirt/images</code>), then click on ''New Volume''.# Give the new virtual disk file a name of <code>fedora1b</code>, a format of ''raw'', with a ''Max Capacity'' and ''Allocation'' of 2000 MB. Click ''Finish''.# Select the new virtual disk file ''fedora1b.img'' and click ''Choose Volume''.
# Select a device type of ''Virtio Disk''.
# Finish creating the new virtual diskby clicking ''Forward'' and then ''Finish''.
# Boot the system. You should now have both <code>/dev/vda</code> and <code>/dev/vdb</code>.
# Record the size of the volume group and the amount of free space(Hint: use a command that you learned in a previous lab).# Partition /dev/vdb with a single partion partition that fills the whole disk.
# Check the messages printed when <code>fdisk</code> exits -- you may need to reboot the system in order for the new partition table to take effect.
# Run this command to format the physical volume: <code>pvcreate /dev/''vdb1''</code>
# Change your system configuration so that the new filesystem is mounted on <code>/home</code> from now on.
{{Admon/tip|SELinux relabelling may be required|Your system may report that the files are not present in the new /home filesystem when they are clearly there. This is due to the Security-Enhanced Linux system (SELinux) preventing access to the files, because the files were tampered with (moved) and are no longer recognized as home directory content. You can fix this problem by restoring the file context labels so that SELinux accepts the files as valid home directory content: <code>restorecon -r /home</code>}} == Investigation 43: How can I use LVM to manage storage on my disk pack? =='''On your host <u>f17host</u> (i.e. "disk pack"), using your choice of the GUI and/or command-line tools:'''
# Create a new logical partition ('''NOT a logical volume!''') - minimum 5G, leaving at least 10G free space in the extended partition.
# Add that partition as a PV into the existing VG (using the commands you used in the previous investigation).
# Grow the root filesystem to fill the available space.
= Package Management =
== Investigation 5: How do you query the RPM database? ==
 
RPM maintains a database of installed software. This information is very useful to system administrators. In Lab 3, you queried that database using RPM with the -q argument. When you query the RPM database, you can separately specify:
* Which packages you want information about, using a select-option
* What information you want about those packages, using a query-option
 
Steps:
 
1. Using information from the man page for <code>rpm</code>, fill in this information:
{|width="100%" border="1"
|-
!Option
!Meaning
!Is this a select-option or a query-option?
|-
| -a
|Select all packages
|select-option
|-
| -l
|
|
|-
| -p ''filename'''
|Select this uninstalled package
|
|-
| -i
|Show the package license, packager, URL, description, and other general information.
|
|-
| -f '''filename'''
|
|
|-
|'''packagename'''
|Select just this package
|select-option
|}
 
Make sure that your lab notes answer the Investigation 5 question.
 
== Investigation 6: How do you install and remove software with RPM? ==
 
# Change to the directory on your Installation DVD containing the lynx-2.8.6-23.fc12.x86_64.rpm
# Execute this command: <code>rpm -i lynx-2.8.6-23.fc12.x86_64.rpm</code>
# Issue an RPM query to check that lynx is installed.
# Issue this command: <code>rpm -e lynx</code>
# Issue an RPM query to verify that lynx is no longer installed.
# Issue this command: <code>rpm -i BackupPC-3.1.0-9.fc12.noarch.rpm</code>
 
Answer the Investigation 6 question.
 
== Investigation 7: How do you install and remove software with ''yum''? ==
 
{{Admon/note|Internet Connection|In order for yum to work you require a connection to the Internet. Establish this connection by using the browser to log into Senenet}}
 
# Change to your home directory.
# Issue the command: <code>yum install BackupPC</code>
# Answer "y" when asked about the installation. This will install the xpdf package. Where did yum get the package?
# Issue the command: <code>yum install BackupPC</code>
# Why could ''yum'' install BackupPC when rpm couldn't?
# Issue an RPM query to verify that BackupPC is installed.
# Issue the command: <code>yum remove BackupPC</code>
# Issue an RPM query to verify that BackupPC is no longer installed.
# Install <code>nled</code> using '''yum'''.
 
Answer the Investigation 7 question.
= User/Group Management =
== Investigation 84: The /etc/passwd file ==
# Look at the /etc/passwd file.
# Why do you think there are so many users?
# Look at the names of the users. What do you think these user names represent? Are they people?
# What is the numeric user ID (UID) of the root user?
# The user IDs of real users (people) are different from the user IDs of system accounts. What is the pattern?
== Investigation 95: Adding users ==
{{Admon/note|Use fedora1f17host|Perform these steps in the '''fedora1f17host''' system. Due to a configuration issue, these steps may not work normally in the fedora1 virtual machinehost (previous versions of this lab used fedora1 for this investigation).}}
# Read the man page for the useradd command.
# Add your matrix account user to '''fedora3'''.
== Investigation 106: Managing Groups ==
{{Admon/note|Use fedora1|Perform these steps in the '''fedora1''' virtual machine.}}
Be sure to record your observations in your lab notes.
== Investigation 117: Deleting users ==
{{Admon/note|Use fedora1|Perform these steps in the '''fedora1''' virtual machine.}}
# Delete the user ops235_2 using the same command with the option which removes the home directory of the user.
# Check the contents of the /home directory. What do you notice?
# Check the contents of the /etc/group directoryfile. What do you notice?
Be sure to record your observations in your lab notes.
 == Investigation 128: Modifying users ==
{{Admon/note|Use fedora1|Perform these steps in the '''fedora1''' virtual machine.}}
<!-- == Investigation 13: Security Tip: Removing Unnecessary Users and Groups ==
{{Admon/note|Use fedora1|Perform these steps in the '''fedora1''' virtual machine.}}
#* nfsnobody
#* nscd (if not using nscd)
#* uucp -->
= Completing the lab =
{{Admon/important|Time for a new backup!|If you have successfully completed this lab, make a new backup of your virtual machines. Remember to also make a backup of the new second virtual disk drive on ''fedora1''-- you now have two virtual disks on ''fedora1'', and therefore two image files, and therefore will need two backup files.}}
Arrange proof of the following on the screen:
# Two PVs on '''fedora1'''.
# Separate </code>/home</code> filesystem (on an LV) in '''fedora1'''.# Larger <code>/home</code> on '''fedora2''' and '''fedora3'''.!-- # Unnecessary accounts and groups have been removed on '''fedora1'''.-->
# Account created on '''fedora3''' matching your Matrix account.
# List contents of '''nled''' installed on '''fedora1/etc/group'''file (ops235 group).# Answer to this question: #* What is the license List contents of the '''nautilus/etc/passwd''' package?file (created accounts).
# Fresh backup of the virtual machines.
# What is a VG? PV? LV?
# What does yum do that rpm does not?
# What is the total size of the "main" VG on your system?
# How do you create a LV?
# How would you increase the size of the root filesystem by 50 MB?
# What is the purpose of <code>/etc/fstab</code>?
# What did you have to do in order to move is the home directories onto a new filesystem? Whypurpose of <code>/etc/shadow</code>?