• No results found

Using intermediate LVM commands

In document AN143XSTUDHINT (Page 117-124)

Exercise instructions with hints

Part 1: Using intermediate LVM commands

__ 1. Ensure that the lvmtestvg volume group does not exist. If it does, delete it. » Suggested commands are:

# lsvg » If needed:

# lsvg -p lvmtestvg # umount /lvmtestfs

# reducevg -d lvmtestvg hdisk2

__ 2. List the physical volumes on your system to verify that hdisk2 is available. If it belongs to a volume group, free the disk from that volume group.

» Suggested commands are: # lspv

» If needed:

» -- for VG with another disk --- # migratepv hdisk2 hdisk# # reducevg <VGname> hdisk2 » OR

» -- for VG with only hdisk2 --

#reducevg -d <VGname> hdisk2

__ 3. The problem we want to create is significant, so we will not use the rootvg for this. Instead, you have been provided with a script which will create a volume group (using hdisk2) and a file system with a special naming convention to match the problem setup script. The script is: /home/AN14/build_vg. Execute this script. » # /home/AN14/build_vg

__ 4. Display the online VGs and then list the logical volumes and physical volumes in the lvmtestvg volume group. Record the names of any physical volumes that belong to the lvmtestvg volume group:

________________________________________________________________ » Suggested commands are:

# lsvg -o lvmtestvg rootvg

# lsvg -l lvmtestvg lvmtestvg:

LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT

lvmtestlv jfs2 1 1 1 open/syncd /lvmtestfs

loglv00 jfs2log 1 1 1 open/syncd N/A # lsvg -p lvmtestvg

lvmtestvg:

PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION

hdisk2 active 1092 1090 219..216..218..218..219

__ 5. Verify that the new /lvmtestfs file system is mounted. » # mount

__ 6. Create a data file in the /lvmtestfs directory. » # echo “hello world” > /lvmtestfs/testfile

__ 7. In the /home/AN14 directory you will find a script called corrupt_odm3. Execute this script.

» # /home/AN14/corrupt_odm3

0518-307 odmdelete: 8 objects deleted. 0518-307 odmdelete: 2 objects deleted. 0518-307 odmdelete: 1 objects deleted. 0518-307 odmdelete: 2 objects deleted. 0518-307 odmdelete: 2 objects deleted.

__ 8. Display the online VGs and then list the logical volumes in the lvmtestvg volume group. What problems did you see?

EXempty » # lsvg -o

0516-304 : Unable to find device id 00c07f7f00004c0000000121ad0e4aee in the Device Configuration Database.

vgid=00c07f7f00004c0000000121ad0e4aee rootvg

» # lsvg -l lvmtestvg

0516-306 : Unable to find volume group lvmtestvg in the Device Configuration Database.

» # lsvg -p lvmtestvg

0516-306 : Unable to find volume group lvmtestvg in the Device Configuration Database.

__ 9. Try to increase the size of the /lvmtestfs file system by one block. Could it be done? _____________________________________________________________

» # chfs -a size=+1 /lvmtestfs

0516-306 /usr/sbin/getlvodm: Unable to find lvmtestlv in the Device Configuration Database.

chfs: Cannot get lv id from odm.

__ 10. Display the contents of the testfile that you created earlier. Were you able to access your data? _________________________________

» The suggested commands are: # cat /lvmtestfs/testfile hello world

» It is interesting that while the corruption prevents us from executing important LVM commands, it does not impact our ability to access the user data.

__ 11. We could try to solve the problem with the exportvg and importvg technique. Attempt to export lvmtestvg (you first need to close the logical volumes and vary the VG offline). How far can you get before you experience a problem?

________________________________________________________________ ________________________________________________________________ ________________________________________________________________ » Suggested commands are:

# umount /lvmtestfs # varyoffvg lvmtestvg

0516-306 getlvodm: Unable to find volume group lvmtestvg in the Device Configuration Database.

» The procedure fails before we can even try to execute the exportvg command, which requires that the volume group be inactive.

__ 12. Mount the /lvmtestfs file system. » The suggested command is:

» # mount /lvmtestfs

__ 13. Try using an intermediate level command that will synchronize the LVM information with the ODM. What happened?

_____________________________________________________________ » The suggested command is:

# synclvodm lvmtestvg

0516-306 : Unable to find volume group lvmtestvg in the Device Configuration Database.

0516-502 synclvodm: Unable to access volume group lvmtestvg.

» The command requires that certain volume group information be in the ODM. The corruption deleted this ODM information, preventing us from using the synclvodm command.

__ 14. Use an intermediate-level LVM command to redefine the lvmtestvg volume group in the ODM. Specify the disk which you recorded in step 4.

» The suggested command is:

# redefinevg -d hdisk2 lvmtestvg

__ 15. Display the online VGs and then list the logical volumes in the lvmtestvg volume group. What problems do you see?

» The suggested commands are: » # lsvg -o

lvmtestvg rootvg

» # lsvg -l lvmtestvg

lvmtestvg:

LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT lvmtestlv ??? 2 2 1 open/syncd /lvmtestfs loglv00 jfs2log 1 1 1 open/syncd N/A

# lsvg -p lvmtestvg

lvmtestvg:

PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk2 active 1092 1089 219..215..218..218..219

EXempty » The volume group and its physical volume and logical volume membership is

recovered, but the data for the logical volumes does not appear to be complete, given the type value of ???.

__ 16. Try to increase the size of the /lvmtestfs file system by one block. Could it be done? _____________________________________________________________

» # chfs -a size=+1 /lvmtestfs

0516-306 /usr/sbin/getlvodm: Unable to find lvmtestlv in the Device Configuration Database.

chfs: Cannot get lv id from odm.

» Even though the logical volumes are known to be in the volume group, the logical volume information needed by the chfs command is still missing. Specifically, it is missing the logical volume ID.

__ 17. Once again, try using an intermediate-level command that will synchronize the LVM information with the ODM. This failed prior to the execution of the redefinevg

command. What happens when you try it now?

_____________________________________________________________ » The suggested command is:

# synclvodm lvmtestvg » It succeeds this time.

» It should be noted that, if we had attempted an importvg command as our first fix attempt after creating the problem, it would have failed (gives error messages); but, the importvg command would have completed enough repairs to the ODM to allow the synclvodm command to run successfully. Under the covers, the importvg shell script executes the redefinevg command! As they say in New Orleans, there is more than one way to skin a catfish.

__ 18. Display the online VGs and then list the logical volumes and physical volumes in the lvmtestvg. How did the situation change? ____________________________

______________________________________________________________ » The suggested commands are:

» # lsvg -o

lvmtestvg rootvg

» # lsvg -l lvmtestvg

lvmtestvg:

LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT lvmtestlv jfs2 2 2 1 open/syncd /lvmtestfs loglv00 jfs2log 1 1 1 open/syncd N/A

» # lsvg -p lvmtestvg

lvmtestvg:

PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk2 active 1092 1089 219..215..218..218..219

» We no longer see any problems with the displays of LVM information.

__ 19. Try to increase the size of the /lvmtestfs file system by one block. Could it be done? _____________________________________________________________

» # chfs -a size=+1 /lvmtestfs

Filesystem size changed to 262144

EXempty

Part 2: Export and import a volume group

__ 20. Verify what the logical volumes are in lvmtestvg with the lsvg command. Fill in the following table with the logical volume information in lvmtestvg: » Suggested command and example output are:

»# lsvg -l lvmtestvg lvmtestvg:

LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT

lvmtestlv jfs2 5 5 1 open/syncd /lvmtestfs loglv00 jfs2log 1 1 1 open/syncd N/A

An example of the table filled in based on the results above are:

__ 21. Create some new files in the /lvmtestfs file system. » Suggested commands are:

# cd /lvmtestfs # touch m1 m2 m3

__ 22. Export the lvmtestvg volume group from your system.

Write down all the steps you executed to export the volume group.

____________________________________________________________ ____________________________________________________________ ____________________________________________________________ » Suggested commands are:

# cd

# umount /lvmtestfs # varyoffvg lvmtestvg # exportvg lvmtestvg

LV NAME TYPE MOUNT POINT

LV NAME TYPE MOUNT POINT

loglv00 jfslog N/A

__ 23. Analyze your system to see if it contains any reference to the exported volume group. For example, check whether the file system which you created exists. Check /etc/filesystems.

» Suggested commands are:

In document AN143XSTUDHINT (Page 117-124)