QV0121X SG
QV0121X SG
QV0121X SG
cover
Student Exercises
ERC 1.6
Trademarks
IBM® and the IBM logo are registered trademarks of International Business Machines
Corporation.
The following are trademarks of International Business Machines Corporation, registered in
many jurisdictions worldwide:
DB2® HACMP™ System i™
System p™ System x™ System z™
Windows is a trademark of Microsoft Corporation in the United States, other countries, or
both.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, or service names may be trademarks or service marks of others.
TOC Contents
Exercise 1. LVM components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Introduction
This lab covers creating and manipulating the components of the
Logical Volume Manager.
Exercise Objectives
At the end of the lab, you should be able to:
• Create volume groups and logical volumes
• Adjust the t factor to determine physical partition sizes
Exercise instructions
Preface
This exercise includes information for you to read, and exercise steps for you to
perform. The following examples illustrate the numbered checklist format used to
identify exercise steps:
__ 1. (This is example step one.) Login to ...
__ 2. (This is example step two.) Execute the following ...
Two versions of these instructions are available: one with hints and one without. You
can use either version to complete this exercise (or move back and forth between the
two versions). Also, please don’t hesitate to ask the instructor if you have questions.
Part 1 of this exercise shows the command line and the SMIT menus in the Exercises
with Hints Guide.The remaining exercises only show the command line in the Exercises
with Hints Guide.
EXempty
__ 7. Try to remove a physical volume that belongs to labvg. (Do not force it.)
Could you do it? Why or why not?
__ 10. Create a volume group named ppsizevg (original type) with the smallest disk
available.
__ 11. Display the information for the volume group ppsizevg to answer the following:
a. Physical partition size: ____________
__ 12. Try to add a larger disk to the ppsizevg volume group. What happened?
__ 13. Modify the ppsizevg volume group to allow the larger disk to be added.
EXempty
__ 14. Display the information for the volume group ppsizevg to answer the following.
a. Physical partition size: ____________
Explain the differences in the values between now and before the second disk was
added.
__ 16. Create a volume group named ppsize2vg (original type) with the largest disk
available.
__ 17. Display the information for the volume group ppsize2vg to answer the following:
a. Physical partition size: ____________
__ 18. Try to add a smaller disk to the ppsize2vg volume group. What happened?
__ 19. Display the information for the volume group ppsize2vg to answer the following.
a. Physical partition size: ____________
Explain the differences in the values between now and before the second disk was
added.
__ 21. Create a volume group named ppsizesvg (scalable type) with the smallest disk
available.
__ 22. Display the information for the volume group ppsizesvg to answer the following:
a. Physical partition size: ____________
EXempty
b. Number of physical partitions: ___________
__ 23. Try to add a larger disk to the ppsizesvg volume group. How does the result
compare to what happened when a larger disk was added to an original type volume
group?
__ 24. Display the information for the volume group ppsizesvg to answer the following.
a. Physical partition size: ____________
End of exercise
Introduction
This lab covers creating mirrored logical volumes and mirror pools.
Exercise Objectives
At the end of the lab, you should be able to:
• Create mirrored logical volumes
• Create and use mirror pools
Exercise instructions
Preface
This exercise includes information for you to read, and exercise steps for you to
perform. The following examples illustrate the numbered checklist format used to
identify exercise steps:
__ 1. (This is example step one.) Login to ...
__ 2. (This is example step two.) Execute the following ...
Two versions of these instructions are available: one with hints and one without. You
can use either version to complete this exercise (or move back and forth between the
two versions). Also, please don’t hesitate to ask the instructor if you have questions.
Part 1 of this exercise shows the command line and the SMIT menus in the Exercises
with Hints Guide.The remaining exercises only show the command line in the Exercises
with Hints Guide.
Part 1 - Mirroring
__ 1. List the volume groups on your system. If there are any volume groups on the
system (with the exception of rootvg) delete them.
EXempty
__ 5. Create the logical volume with just one copy of each logical partition.
__ 7. Create a mirror for the logical volume lab_lv with the following specifications:
• Logical partition copies: 2
• Physical volume name: hdisk2
• Defaults for all other fields (make note of the defaults)
__ 8. Display the information for the logical volume lab_lv to answer the following:
a. Are the logical volume copies synchronized? _________
__ 9. If lab_lv is not synchronized, synchronize it. Verify that it is synchronized and that
there are no stale partitions.
__ 12. Verify that hdisk1 and hdisk2 are in the mirror pool, MirrorP1 in the myvg volume
group.
__ 13. Add hdisk3 into the myvg volume group and include it in the MirrorP1 mirror pool.
__ 14. Verify that hdisk3 is in the mirror pool, MirrorP1 in the myvg volume group.
__ 15. Try to add hdisk4 into mirror pool, MirrorP1. What happened?
__ 16. Do what you need to do, to get hdisk4 into the MirrorP1 mirror pool.
__ 17. Remove hdisk3 and hdisk4 from the MirrorP1 mirror pool.
__ 19. Verify that hdisk1 and hdisk2 are in MirrorP1, hdisk3 is in MirrorP2 and hdisk4 is
not in a mirror pool.
__ 23. Verify the logical volume, mylv1, is using MirrorP1 for the first copy and MirrorP2
for the second copy.
__ 24. Try to create a third copy of mylv1 on hdisk4. hdisk4 is not in a mirror pool. Did it
work?
EXempty __ 25. Turn on mirror pool strictness. Did it give you any messages regarding the logical
volume mylv1?
__ 26. Try to create a logical volume named mylv2 with 4 logical partitions in myvg. Did it
work?
» No. The strict policy is enforced for new logical volumes created.
__ 28. Confirm that the first copy of mylv1 is using MirrorP1 and the second copy is using
MirrorP2.
__ 29. Try to change mylv1 to use MirrorP2 for the first copy and MirrorP1 for the second
copy. Did it work?
__ 30. Bring mylv1 into compliance with the correct mirror pools. Look at the mapping of
mylv1 to confirm it’s in compliance.
__ 31. Remove the myvg volume group and its mirror pools, MirrorP1 and MirrorP2.
End of exercise
Introduction
This lab covers the use of informational high and intermediate level
commands to view LVM components and metadata.
Exercise Objectives
At the end of the lab, you should be able to:
• Identify LVM metadata information
• Repair a damaged file system
• Fix an ODM corruption
• Understand the quorum mechanism
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
Exercise instructions
Preface
This exercise includes information for you to read, and exercise steps for you to
perform. The following examples illustrate the numbered checklist format used to
identify exercise steps:
__ 1. (This is example step one.) Login to ...
__ 2. (This is example step two.) Execute the following ...
Two versions of these instructions are available: one with hints and one without. You
can use either version to complete this exercise (or move back and forth between the
two versions). Also, please don’t hesitate to ask the instructor if you have questions.
__ 1. Create a regular volume group named testvg using one unused disk. The lspv
command can be used to see which disks are currently used. (We will assume that
this disk is hdisk1 in the rest of this exercise.)
EXempty __ 2. Create a logical volume named lv1 in testvg that uses 5 partitions.
Note: You will be adding a file system to this logical volume later in these exercises.
__ 4. Use the lqueryvg -p hdisk1 -At command to view volume group information
from the VGDA on hdisk1.
This syntax says:
- Read the VGDA on hdisk1 (-p hdisk1)
- Display all attributes for the volume group (static attributes, logical volume
details and physical volume details) (-A)
- With descriptions or tags for each attribute (-t)
Execute the command and answer the following questions.
(Substitute your disk for hdisk1.)
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 7. Use lsvg testvg to get the VGID for testvg. Then, use the command
lquerypv -p <hdisk1_PVID> -N hdisk1 -At | grep <testvg_VGID>
to look at the partition map for hdisk1. The -A flag says to display the static
attributes and the partition map.
The partition map is large, one line for every physical partition on the disk. In this
example, we grep for the VGID to limit the output to just those partitions which have
been allocated. You could also send the output to more and page through it until you
get to the partitions which have been allocated.
What are the physical partition numbers being used for lv1 and lv2?
__ 9. Use the command getlvcb -AT LVname for each logical volume in testvg. This
verifies that the Logical Volume Control Block (LVCB) for each logical volume is
readable and contains data.
Note: The getlvcb command has many flags which can be used to extract specific
pieces of information from the LVCB. For more information, see:
SG24-5433 AIX Logical Volume Manager from A to Z:
Troubleshooting and Commands
__ 10. Use the command lquerylv -L <LVID> -p hdisk1 -At for each logical volume in
testvg. This displays the logical volume information stored in the VGDA. Compare
LVMAP lines with the PVMAP output from lquerypv. If this were a mirrored logical
volume, the 2nd and 3rd copies would also be listed.
__ 11. Compare the output for physical partitions of lquerylv -L <LVID> -p hdisk1 -At
with lslv lv1 and lslv -m lv1.
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 12. Create a JFS file system on lv1 with the mount point /lv1fs.
# crfs -v jfs -d lv1 -m /lv1fs
__ 14. Copy some files to the file system and verify that they are there.
EXempty __ 17. Try to mount the /lv1fs file system. What happened?
__ 18. Try to use the fsck command without any flags to repair the superblock.
# fsck /dev/lv1
What happened?
With the -p flag (preen mode), fsck analyzes the file system and performs simple
repairs without prompting. These simple repairs include repairing the superblock, if
corrupted, by copying the secondary superblock.
__ 20. Try to mount the /lv1fs file system again. What happened?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-7
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 21. You are going to delete some objects from ODM to simulate ODM corruption. As a
precaution, make a copy of the files in /etc/objrepos, just in case.
__ 22. In this step, you will simulate a corruption of the ODM by deleting the CuAt
information for the logical volume lv2.
__ a. First, take a look at the entries in CuAt for lv2. You will use the query from this
step for the query in step b.
__ 23. Try to create a file system on lv2 with the mount point /lv2fs. Did it work? If not, why
not?
__ 24. Fix the corruption. (Hint: What command removes volume group information from
the ODM? What command reads the VGDA and adds volume group information to
the ODM?)
EXempty __ 25. Create a file system on lv2 with the mount point /lv2fs.
Note: When you created a file system on lv2, another ODM object was created in
CuAt.
__ 28. Is the file system mounted on /lv2fs still mounted? Why or why not?
__ 29. Try to copy the files /bin/a* to the file system /lv2fs. Did it work?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-9
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 31. Try to increase the size of the file system /lv2fs by 1 GB. Could you increase it? If
not, why not?
__ 35. Use the lsvg command to find the volume group information for the quorumvg
volume group.
a. Quorum: ________
__ 36. Use the lqueryvg -p hdisk1 -At command to find the volume group information
from the disk’s perspective.
a. Total VGDAs: ______________
__ 37. Add a second disk to the quorumvg volume group. (We will assume that this disk is
hdisk2 in the rest of this exercise.)
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-11
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 38. Use the lsvg command to find the volume group information for the quorumvg
volume group.
a. Quorum: ____________________
__ 39. Use the lqueryvg -p hdisk1 -At and lqueryvg -p hdisk2 -At commands to
find the volume group information from each disk’s perspective.
a. Total VGDAs: ______________
Was the information the same or different from the two disk’s perspective?
__ 40. Use the lspv command to get the PVIDs of the two disks in the quorumvg volume
group.
- PVID for hdisk1: ________________________________________
EXempty __ 41. Use the command lquerypv -p <PVID> -N <disk> -at for each disk to query the
attributes of each physical volume.
Is there a difference in the values on the two physical volumes?
__ 42. Make the second disk unavailable using the following steps.
a. Varyoff the quorumvg volume group.
b. Make the second disk unavailable (hdisk2 in our example) using rmdev. Do
not delete it from CuDv.
__ 44. Look in /usr/include/lvm.h to find the description for the status of the physical
volumes.
__ 45. Look in the error log file to see if any errors were logged.
__ 46. Use the command lquerypv -p <PVID> -N <disk> -at for each disk to query the
attributes of each physical volume. What happened?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-13
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 47. Use lqueryvg -p hdisk1 -At to look at the VGDA information on hdisk1 (the first
disk). Has it changed?
__ 48. Use the lsvg command to find the volume group information for the quorumvg
volume group. Has any of the following information changed?
a. Quorum: ________
__ 50. Use the command lquerypv -p <PVID> -N hdisk2 -at for hdisk2 disk to query
its attributes. Was it successful?
__ 51. Use the lsvg command to find the volume group information for the quorumvg
volume group. Has any of the following information changed?
a. Quorum: ________
__ 52. Try to create a logical volume with 1 physical partition on hdisk2. Did it work?
__ 53. Try running the command syncvg -v quorumvg to have hdisk2 recognized as
active by the lsvg command. Did it work?
__ 54. What do you think will bring hdisk2 into an active state in the quorumvg volume
group? Try it. (Look at the Hints if you do not know.)
Verify it worked by running the lsvg quorumvg command.
__ 55. In the previous steps, you removed the second disk that was added to a two disk
volume group. In the following steps, you will remove the first disk.
Make the first disk (hdisk1) unavailable using the following steps.
a. Varyoff the quorumvg volume group.
b. Make the first disk unavailable (hdisk1) using rmdev. Do not delete it from
CuDv. (Be sure you have the PVID for hdisk1 written down before you do
this step!)
__ 56. Try to varyon the quorumvg volume group. Did it varyon? If not, why?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-15
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 57. Look in the error log file to see if any errors were logged.
__ 58. Use the command lquerypv -p <PVID> -N <disk> -at for each disk to query the
attributes of each physical volume. What happened?
__ 59. Use lqueryvg -p hdisk2 -At to look at the VGDA information on hdisk2 (the
second disk). Has it changed?
__ 60. Try to run the lsvg command on quorumvg. Why didn’t it work?
__ 61. Varyon the quorumvg volume group using the force (-f) flag.
__ 62. Look in /usr/include/lvm.h to find the description for the status of the physical
volume for the disk that was made unavailable.
__ 63. Look in the error log file to see if any errors were logged.
EXempty
__ 64. Use the lsvg command to find the volume group information for the quorumvg
volume group. Has any of the following information changed from when the
quorumvg volume group had both disks available?
a. Quorum: ________
__ 65. The output of the lsvg quorumvg command showed that there were 2 VGDAs. In
our previous steps we saw that hdisk2 only had 1 VGDA (because it was the
second disk added to a two disk volume group). Since hdisk2 is the only disk active,
look at the VGDA information on hdisk2 to see what happened.
(Hint: Use the lqueryvg -p hdisk2 -At command.)
__ 67. Use the command lquerypv -p <PVID> -N <disk> -at for each disk to query the
attributes of each physical volume.
How do the values of Total VGDAs compare to what they were previously?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-17
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 68. Compare the VGDA information on each disk. Normally, the VGDA information
should be the same on both disks. Why aren’t they in this case?
(Hint: Use lqueryvg -p <disk> -At)
__ 69. Use the lsvg command to find the volume group information for the quorumvg
volume group. Has any of the following information changed from when the
quorumvg volume group had both disks available? Is it different from when hdisk2
was unavailable and then became available?
a. Quorum: ________
__ 70. In the previous test when we took the second disk (hdisk2) offline then brought it
back online, the varyonvg command rebuilt the VGDA information and brought the
volume group back to the original state.
Try the varyonvg command now, then the lsvg quorumvg command. Did it fix the
volume group VGDA information?
__ 71. Varyoff the quorumvg volume group and then vary it back on. Did it varyon? Are
both disks available?
EXempty
__ 72. Use the reducevg command to officially remove hdisk1 from the quorumvg volume
group.
__ 73. Use lqueryvg -p hdisk1 -At to look at the VGDA information on hdisk1. What
does it show?
__ 74. Use lqueryvg -p hdisk2 -At to look at the VGDA information on hdisk2. What
does it show?
__ 75. Now, add hdisk1 back into the quorumvg volume group. What did you have to do
to get it to work? Why?
__ 76. Use the command lquerypv -p <PVID> -N <disk> -at for each disk to query the
attributes of each physical volume.
Is there a difference in the values on the two physical volumes?
How does it differ from when the quorumvg volume group was originally created
with both disks (hdisk1 first and hdisk2 second)?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-19
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 77. Use the lqueryvg -p hdisk1 -At and lqueryvg -p hdisk2 -At commands to
find the volume group information from each disk’s perspective. Do they look
correct?
__ 78. Now, you will go through some steps to see what happens when quorum is turned
off. Turn off quorum on the quorumvg volume group.
__ 79. Use the lsvg command to find the volume group information for the quorumvg
volume group.
a. Quorum: ________
__ 80. Use the lqueryvg -p hdisk1 -At and lqueryvg -p hdisk2 -At commands to
find the volume group information from each disk’s perspective.
a. Total VGDAs: ______________
EXempty
__ 82. Make hdisk1 unavailable using rmdev. Do not delete it from CuDv.
__ 83. Try to varyon the quorumvg volume group. Did it varyon? Why or why not?
__ 84. Look at the VGDA information from hdisk2 (because that is the only disk that is
available in the quorumvg volume group). What does it show regarding quorum?
__ 86. Is quorum still disabled, or did forcing the varyon enable it?
© Copyright IBM Corp. 2012 Exercise 3. Working with LVM metadata 3-21
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises
__ 89. Run lsvg quorumvg to confirm that there are now 2 active physical volumes.
End of exercise
Introduction
This lab covers some problems with ODM corruption.
Exercise Objectives
At the end of the lab, you should be able to:
• Identify LVM problems when the /tmp file system is full
• Identify and fix ODM corruption with redefinevg and synclvodm
• Identify and fix a corrupted PVID
Exercise instructions
Preface
This exercise includes information for you to read, and exercise steps for you to
perform. The following examples illustrate the numbered checklist format used to
identify exercise steps:
__ 1. (This is example step one.) Login to ...
__ 2. (This is example step two.) Execute the following ...
Two versions of these instructions are available: one with hints and one without. You
can use either version to complete this exercise (or move back and forth between the
two versions). Also, please don’t hesitate to ask the instructor if you have questions.
EXempty __ 5. Create a file in the /b4fs file system. This can be done by issuing the following
command:
echo "Contents of file before full file system" > /b4fs/myfile
__ 9. Try to create a JFS file system in b4vg with the following specifications.
• Size of one physical partition
• Mount point /afterfs
Did it work?
__ 10. Try to create another volume group named aftervg using hdisk2. Did it work?
__ 11. Try to list the information about the aftervg volume group. Did it work?
__ 14. Try to list the volume groups on the system, then all the active volume groups. Did it
work?
__ 16. Try to remove the b4vg and aftervg volume groups. Did it work?
__ 17. Delete the /tmp/bigfile that was created to fill up the /tmp file system.
__ 21. Find and write down the following information about the mkvg volume group:
a. VGID: ________________________________
__ 22. Create a JFS file system in myvg with the following specifications:
• Size of one physical partition
• Two log partitions
• Mount point /myfs
__ 23. Display the logical volumes in myvg. Write down the logical volume names.
____________________________________
____________________________________
__ 24. Try to use the rendev command to rename the log logical volume, loglv00, to
mylog. Did it work? If not, why not?
__ 25. Change the name of the log logical volume to mylog using the command
chlv -n mylog loglv00 (assuming loglv00 is the name of the log device).
__ 26. Change the myfs file system to use the log device name mylog using the
command:
chfs -a log=/dev/mylog /myfs
__ 27. Change the name of the logical volume to mylv using the command
chlv -n mylv lv00 (assuming the original name is lv00).
__ 31. Create a file in the /myfs file system. This can be done by issuing the following
command: echo "Data for myfs" > /myfs/data
EXempty
__ 32. You are going to delete some objects from ODM to simulate ODM corruption. As a
precaution, make a copy of the files in /etc/objrepos, just in case:
__ 33. Issue the following commands (carefully!) to replicate a failure where all the
information about the myvg volume group is gone.
Note: It is always a good idea to test your query with the odmget command before
you do the odmdelete command.
# odmget -q "name LIKE my*" CuAt
# odmdelete -o CuAt -q "name LIKE my*"
__ 34. List all the volume groups on the system. There should be two, rootvg and myvg.
What did you see?
__ 35. List all the active volume groups (use the lsvg -o flag). There should be two,
rootvg and myvg. What did you see?
__ 36. Look at the information for the physical volume, hdisk1. What did you see?
__ 37. Look at the information for the logical volume, mylv. What did you see?
__ 38. You’ve seen that the ODM is missing information, but is the file system data really
gone? Issue the ls command for the /myfs file system. What happened?
__ 39. Try unmounting and mounting the /myfs file system. What happened?
__ 40. Issue the ls command for the /myfs file system. Are the files still there?
__ 41. Do you think any of the following actions will fix the problem? Give them each a try,
then explain what happened.
EXempty • exportvg
• varyonvg
• synclvodm
__ 43. The first thing to do is to regain basic ODM information regarding the myvg volume
group. This can be done with the redefinevg command. When inconsistencies
occur between the ODM and the LVM, the redefinevg command determines which
physical volumes belong to the specified volume group and re-enters this
information in the ODM. The redefinevg command checks for inconsistencies by
reading the reserved areas of all the configured physical volumes attached to the
system.The redefinevg command needs the volume group name and either a
VGID or a physical volume name.
The physical volume that was in myvg was hdisk1. To confirm the VGDA
information on hdisk1 is still correct, run the lqueryvg command:
# lqueryvg -p hdisk1 -At
__ 45. Check the state of the volume groups using lsvg and lsvg -o commands. Does it
show the myvg volume group?
__ 46. Use the lsvg -l myvg command to check the state of the logical volumes in the
myvg volume group. Has everything been fixed?
__ 47. Use the /home/qv012/find-odm-objects script to see what is defined in the ODM
regarding the myvg volume group and its logical volumes.
(Hint: search for the string my).
__ 48. There is no information for the logical volumes in the myvg volume group (only the
volume group information has been stored). The logical volume information needs to
be restored from the LVCBs.
The synclvodm command will synchronize or rebuild the LVCB, the ODM, and the
VGDAs on the physical volumes. To complete the repair, run the synclvodm
command.
EXempty
__ 49. Verify everything has been repaired for the myvg volume group and its logical
volumes.
Introduction
In this exercise, you will simulate disk corruption by writing zeros over the PVID of one
of your disks. Since the actual data in the logical volumes was not affected by this
corruption, it may be possible to recover the logical volumes on the corrupted disk
without having to restore or recreate the data. There are several important things to
note about this scenario:
• If you are not careful, your recovery actions could cause the partition map for the
affected logical volumes to be lost. Once the partition map is lost, the data is
inaccessible and is effectively lost. In this case, you would need to restore or
recreate the data.
• This underscores the importance of backups. Before you take any corrective
actions, make a backup of all logical volumes involved, if possible. Depending on
the problem, it may not be possible, but your first step should be to try.
• In the real world, you may never see this particular type of corruption. This
exercise will not give you a cookbook procedure that you can follow in every
case, but it should help you to understand some of the tools and structures so
that you can create your own recipes.
In this exercise, there are many references to the PVID, VGID, and LVID’s of the system
to be used for the exercise. The values used in the hints are examples. Your numbers
will be different.
Look at the solutions for explanations of what is happening at various steps.
Exercise
__ 52. List the physical volumes on your system and check to see if hdisk1 and hdisk2 are
available. If not, choose two other disks that are available. The rest of this exercise
assumes hdisk1 and hdisk2 are the disks being used.
Write down the PVIDs of the two disks you are using:
_________________________________________
_________________________________________
EXempty
__ 54. Create a logical volume called first on hdisk2 with 5 logical partitions.
__ 55. You’ve created a logical volume called first that is 5 logical partitions and have told
mklv to try to put those 5 partitions on hdisk2. You know this request was fulfilled,
because the logical volume was just created, but do you know the location and order
of the physical partitions that were used on hdisk2? Does it matter? To satisfy our
curiosity, let’s take a look and see what the created logical partitions look like.
Verify the logical partitions for the logical volume first.
__ 57. Create a logical volume called second with the map file (map) you just created. It
will have 5 logical partitions.
You use the map file to create a complex logical volume for our example. If and
when you successfully recreate a logical volume and it’s file system, you want it very
apparent that it wasn’t just luck.
__ 58. Verify that the logical volume was created in the manner you specified.
__ 59. Create and mount two JFS file systems with the following characteristics:
• File system 1: named firstfs, use the logical volume first
• File system 2: named secondfs, use the logical volume second
__ 60. Now, you will populate the file systems with data using the following shell script.
Create a shell script called vgtester with the information shown, set the
permissions to 755, and execute:
for copy in 1 2 3 4 5 6 7 8 9 10
do
cp /etc/inittab /firstfs/first.$copy
cp /etc/inittab /secondfs/second.$copy
done
__ 61. Create checksums for the file systems. You will use them later to provide validation
that you have successfully recovered the data. Redirect the checksums to a file
called checkfirst for /firstfs and checksecond for /secondfs:
# sum /firstfs/* > /tmp/checkfirst
# sum /secondfs/* > /tmp/checksecond
Note: We are using checksums to validate that the data in the file systems have
been successfully recovered. In point of fact, if the logical volume is not recovered
successfully, the file system won’t mount. The checksums just provide extra
validation.
__ 62. Unmount the /firstfs and /secondfs file systems, and varyoff the volume group
testvg.
EXempty
__ 64. Use lspv to examine what disks and volume groups are still on the system. What is
wrong with the output?
__ 65. Verify that hdisk1 really does not have a PVID with the following command:
# lquerypv -h /dev/hdisk1
lquerypv -h displays 256 bytes from the specified disk. It will start with address 0,
unless you specify an offset, for example: lquerypv -h /dev/hdisk1 0x100 would
display 256 bytes starting at address 100 hex. The PVID is 32 bytes starting at
address 0x80.
To see what a PVID should look like, compare this output with that for hdisk2.
# lquerypv -h /dev/hdisk2
__ 66. Use odmget to verify what the ODM knows about hdisk1.
__ 67. List the volume group information about testvg. What happened?
__ 68. Try to varyon the testvg volume group. Did it work? Why not?
__ 69. Now, what can you do to fix this? You can’t start the repair of a volume group unless
you can talk to the volume group to see how much damage was done with the
dd.command. And it looks like you can’t start the volume group until you repair the
damage.
Fortunately, there is a way around this.
In this case, you will need to force the varyon of the volume group (-f flag).
Note: You might think that you could change the quorum checking attribute.
However, turning off quorum checking only stops quorum checking once the volume
group is varied on. Turning off quorum checking actually makes it more difficult to
varyon a volume group. When quorum checking is turned off, all VGDAs must be
available to varyon the volume group.
Force the volume group to varyon. What happens?
__ 70. Try to mount the file system that still resides on hdisk2 (remember, this is /firstfs). It
should still be readable since only hdisk1 was lost. What happens?
__ 71. At this point, although the PVID has been removed from hdisk1, the actual data on
the disk should still be there. LVM can’t access hdisk1 because it can’t find a disk
with hdisk1’s PVID. And you can’t mount the file system from the logical volume on
hdisk2 because it needs the JFS log on hdisk1.
EXempty You will need to recreate hdisk1’s PVID, but the process of doing this will remove
the partition map of any logical volumes on hdisk1 from the good VGDA. Before you
recreate the PVID, you must collect information about the partition map for any
logical volumes that reside on hdisk1 and create a map file. This will allow you to
recreate the partition map so that you should not have to restore or recreate the
actual logical volume data.
Every VGDA on a disk not only has information about the logical volumes that are
on that particular disk, but it also contains information about the logical volumes on
OTHER disks. So you can use the VGDA on hdisk2 to get the information you
need.
With the uncertain status of what hdisk1 is really called and its uncertain PVID
status, you will want to use the VGID because the volume group is obviously active
and there isn’t more than one VGID. Now, go find the VGID and write it down.
VGID: _______________________________________________________
__ 72. Use lqueryvg and the VGDA on hdisk2 to query about the logical volumes on
hdisk1 and where they are located.
__ 73. Use lquerylv to identify where the logical volume second resides on hdisk1. Is it
in the same place that it was created in step 58?
__ 75. Create a map file called fixlog that correlates to the logical volume location.
This map file will be used in a later step to recreate the loglv00 logical volume.
__ 76. At this point you have a volume group which knows partially about the old hdisk1’s
PVID, which no longer exists. You have an ODM that only knows hdisk1 by the
missing PVID. But if the PVID is really missing from the corruption, how will you
remove something from the VGDA that doesn’t exist? LVM allows you to remove a
disk by its PVID. The PVID doesn’t really have to exist on the system anymore.
Another example of this problem occurs when someone replaces a dead disk
without running reducevg first.
Use reducevg to remove the history of the old PVID from the VGDA.
# reducevg -d testvg <PVID of hdisk1>
Because you didn’t use the -f flag, LVM will ask you if it’s okay to delete the defined
logical volumes that reside on hdisk1. You must answer yes to all these queries. It
is good to not use the -f flag because it is a double-check that you gathered all the
information on all the logical volumes that exist on hdisk1. Don’t be alarmed about
the concept of deleting the logical volume. The system doesn’t go out to the disk and
literally place zeroes in those physical partitions. It just removes the partition map for
that logical volume in the VGDA. This is why it’s very important to get the partition
map for the logical volumes and create a map file before using reducevg.
__ 78. Use rmdev to remove hdisk1 from the system, which will remove the existing PVID
from hdisk1.
Note. The rmdev at this point is EXTREMELY important. In the practice exercise to
generate these notes, this command was left out and left our system in a deadlock
situation where there is no way to recover the lost logical volumes.
EXempty
__ 80. After this completes, check to see if hdisk1 has come back clean and with no PVID.
__ 83. Make hdisk1 part of testvg by extending the volume group to include hdisk1. (You
may have to force it.)
Adding the disk into the volume group does wipe out any old remnants of the old
VGDA on hdisk1, but it does not zero out the data that resides in the physical
partitions that were used by the second and loglv00 logical volumes.
__ 84. Recreate the two missing logical volumes using the map files you created:
- map for second
- fixlog for loglv00
__ 85. When the reducevg was done in a previous step, the information for /secondfs was
removed from /etc/filesystems. This information needs to be reentered.
Edit /etc/filesystems and add the following:
/secondfs:
dev = /dev/second
vfs = jfs
log = /dev/loglv00
mount = false
account = false
__ 88. Create a checksum for the files in each file system and compare them to the
checksums initially created near the beginning of this optional exercise. Redirect the
checksums to a file called checkfirst2 for /firstfs and checksecond2 for
/secondfs.
Compare checkfirst to checkfirst2 and checksecond to checksecond2. This is to
verify that the data was correctly reconstructed.
The checksums should be the same. This confirms that everything was correctly
reconstructed.
EXempty
End of exercise
backpg
Back page