Investigation 1: Adding a physical volume
- Stop the VM "fedora1".
- Dump the XML for the virtual machine 'fedora1' into a file:
virsh dumpxml fedora1 >fedora1.xml
- Examine the file to determine the structure.
- Add another virtual disk to the XML configuration file. Use the filename
/var/lib/libvirt/images/fedora1-1.img
. - Redefine the VM using the XML configuration file:
virsh define fedora1.xml
- Create the tile
/var/lib/libvirt/images/fedora1-1.img
as an empty file with a size of 10G:dd if=/dev/zero of=/var/lib/libvirt/images/fedora1-1.img bs=1G count=10
- Start the VM.
- You should now have a new disk,
/dev/vdb
- Use
fdisk
to create a single primary partition that fills all of the new disk. - Use
pvcreate
to format the new partition as a physical volume:pvcreate /dev/vdb1
- Use
vgextend
to add the new PV to your volume group:vgextend InsertNameOfYourVGhere /dev/vdb1
- Use
lvextend
to extend the size of the root filesystem by 5G:lvextend InsertNameOfYourVGhere/InsertNameOfYourLVhere --size +5G -r
- Note that the
-r
resizes the filesystem withing the LV and is critically important!
- Note that the
- Confirm that the LV has been resized.
- Record notes about this investigation in your lab book.
Investigation 2: Creating, Growing, and Shrinking a Logical Volume
- On the VM 'fedora1', perform steps 1-11 from investigation 1 to add additional space to the volume group.
- Use
lvcreate
to create a new logical volume, 5 GB in size, called "data". - Use
mkfs
to format that logical volume with an ext4 filesystem. - Create a mountpoint named
/archive
- Edit
/etc/fstab
so that the logical volume "data" is mounted on/archive
each time the system is booted. The line will look like this:/dev/vg_fedora3/data /archive ext4 defaults 1 2"
- Note the meaning of each field in the <code>/etc/fstab file:
- Device node name
- Mountpoint
- Filesystem type (can be "auto")
- Mount options (can be "defaults")
- Whether the filesystem contains data that should be backed up (0 for no, 1 for yes) - this is used by the "dump" backup program (and some others).
- The order in which the filesystem should be checked at boot (1 for the root filesystem, 2 for all other filesystems which are to be checked, and 0 if the filesystem should not be checked).
- Test the
/etc/fstab
file:mount -a
# If any errors are reported, fix them before proceeding, or your system may not be able to boot! - Reboot the system to confirm that the
/archive
filesystem is mounted automatically. - Verify the size of the
/archive
filesystem using:df -h
# Record the size. - Copy the contents of the
/etc
directory to/archive
usingcp -R
- Shrink the size of the LV and filesystem to 1G using these commands:
-
umount devicename
-
fsck -f devicename
-
lvreduce vgname/lvname -r --size -1G
# The -r is critically important! -
mount devicename
-
- Note the function of each command, above.
- Verify the size of the
/archive
filesystem using:df -h
# The size should have been reduced by 1 GB. - Grow the
/archive
LV and filesystem by 3 GB while mounted usinglvextend
with the-r
option. - Verify that the filesystem grew.
- Unmount
/archive
, delete the lv, and remove the corresponding entry from/etc/fstab
Record notes about this investigation in your lab book.
Software Package Management
Investigation 3: 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
Perform the following steps:
- Using information from the man page for
rpm
, fill in this information:
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 |
Answer the Investigation 3 observations / table contents in your lab log book.
Investigation 4: How do you install and remove software with RPM?
- Change to the directory on your Installation DVD containing the file:
lynx-2.8.7-7.fc16.x86_64.rpm
- Execute this command:
rpm -i lynx-2.8.7-7.fc16.x86_64.rpm
- Issue an RPM query to check that lynx is installed.
- Issue this command:
rpm -e lynx
- Issue an RPM query to verify that lynx is no longer installed.
- Issue this command:
rpm -i BackupPC-3.2.1-6.fc16.x86_64.rpm
and note the result
Answer the Investigation 4 observations / questions in your lab log book.
Investigation 4: How do you install and remove software with yum?
- Change to your home directory.
- Issue the command:
yum install BackupPC
and answery
to the question about installation.- Where did yum get the BackupPC software?
- Why could yum install BackupPC when rpm couldn't?
- Issue an RPM query to verify that BackupPC is installed.
- Issue the command:
yum remove BackupPC
- Issue an RPM query to verify that BackupPC is no longer installed.
- Install
nled
using yum. - Issue this command:
yum info cups
- Based on the result, do you think that cups is a useful package for your system? If not, try removing it.
- Unused and unneeded software can present a security risk and ties up disk space needlessly. Find at least 4 other packages 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.
Answer the Investigation 5 observations / questions in your lab log book.
Completing the lab
When you have successfully completed this lab, make a new backup of your virtual machines. Remember to backup the additional image files you created!
Preparing for the Quizzes
- Describe the steps to switch between text-based and graphical consoles on your f16host system.
- List the steps required to swap sizes between lv_root and lv_home logical volumes on your f16host system.
- What is a VG? PV? LV?
- What commands are used to determine VG / PV / LV information?
- What does yum do that rpm does not?
- List the steps to install a package via rpm command.
- List the steps to determine detailed information regarding an install package.
- List the steps to remove a package via rpm command.
- List the steps to install a package using the yum command.
- List the steps to remove a package using the yum command.
- What is the total size of the "main" VG on your system?
- How do you create a LV?
- How do you delete an LV?
- How would you increase the size of the root filesystem by 50 MB?