umount /scratch
varyoffvg sparevg
# lspv
# hdisk0 00cb07a4cee0b389 rootvg active
# hdisk1 00cb07a42fb87e1d sparevg (disk id to be noted of each VG)
exportvg sparevg
After you run exportvg, lspv displays the volume group as None:
# lspv
# hdisk0 00cb07a4cee0b389 rootvg active
# hdisk1 00cb07a42fb87e1d None
Volume group descriptor area and volume group status area
Each of the disks in the volume group has management data, including a volume group descriptor area and a volume group status area. This management data is stored on each physical volume of the volume group. When you remove the disks from the ODM, the disk management data remains intact.
# rmdev -d -l hdisk1
hdisk1 deleted
new server
# cfgmgr
lspv
importvg -y sparevg hdisk1 (check of old server disk id then import with that disk)
VG Related Commands
lsvg lists the volume groups that are on the system
lsvg -o lists all volume groups that are varied on
lsvg -o | lsvg -ip lists pvs of online vgs
lsvg rootvg gives details about the vg (lsvg -L <vgname>, will doe not wait for the lock release (useful during mirroring))
lsvg -l rootvg info about all logical volumes that are part of a vg
lsvg -M rootvg lists all PV, LV, PP deatils of a vg (PVname:PPnum LVname: LPnum :Copynum)
lsvg -p rootvg display all physical volumes that are part of the volume group
lsvg -n <hdisk> shows vg infos, but it is read from the VGDA on the specified disk (it is useful to compare it with different disks)
getlvodm -j <hdisk> get the vgid for the hdisk from the odm
getlvodm -t <vgid> get the vg name for the vgid from the odm
getlvodm -v <vgname> get the vgid for the vg name from the odm
getlvodm -p <hdisk> get the pvid for the hdisk from the odm
getlvodm -g <pvid> get the hdisk for the pvid from the odm
lqueryvg -tcAp <hdisk> get all the vgid and pvid information for the vg from the vgda (directly from the disk)
(you can compare the disk with odm: getlvodm <-> lqueryvg)
Mirroring rootvg (i.e after disk replacement):
1. disk replaced -> cfgmgr <--it will find the new disk (i.e. hdisk1)
2. extendvg rootvg hdisk1 <--sometimes extendvg -f rootvg...
(3. chvg -Qn rootvg) <--only if quorum setting has not yet been disabled, because this needs a restart
4. mirrorvg -s rootvg <--add mirror for rootvg (-s: synchronization will not be done)
5. syncvg -v rootvg <--synchronize the new copy (lsvg rootvg | grep STALE)
6. bosboot -a <--we changed the system so create boot image (-a: create complete boot image and device)
(hd5 is mirrorred, no need to do it for each disk. ie. bosboot -ad hdisk0)
7. bootlist -m normal hdisk0 hdisk1 <--set normal bootlist
8. bootlist -m service hdisk0 hdisk1 <--set bootlist when we want to boot into service mode
(9. shutdown -Fr) <--this is needed if quorum has been disabled
10.bootinfo -b <--shows the disk which was used for boot
Export/Import:
1. node A: umount all fs -> varyoffvg myvg
2. node A: exportvg myvg <--ODM cleared
3. node B: importvg -y myvg hdisk3 <-- -y: vgname, if omitted a new vg will be created (if needed varyonvg -> mount fs)
if fs already exists:
1. umount the old one and mount the imported one with this: mount -o log=/dev/loglv01 -V jfs2 /dev/lv24 /home/michael
(these details have to added in the mount command, and these can be retreived from LVCB: getlvcb lv24 -At)
2. vi /etc/filesystems, create a second stanza for the imported filesystems with a new mountpoint.
---------------------------------------
VG problems with ODM:
if varyoff possible:
1. write down VGs name, major number, a disk
2. exportvg VGname
3. importvg -V MajorNum -y VGname hdiskX
if varyoff not possible:
1. write down VGs name, major number, a disk
2. export the vg by the backdoor, using: odmdelete
3. re-import vg (may produce warnings, but works)
(it is not necessary to umount fs or stop processes)
---------------------------------------
FRU, VPD:
FRU (Field Replaceable Unit) is the number used by IBM to identify the devices. (sometimes it is called 'Part Number') These are needed forhardware replacement.
VPD (Vital Product Data) is the basic data (infos) about the device which is stored in the EEPROM of the device and it can be read by the OS. It can be presented by the command 'lscfg' and it contains the FRU as well.
lsdev shows information about devices from ODM (-C Customized Devices, -P Predefined Devices
lscfg display vital product data (VPD) such as part numbers, serial numbers...
lsattr display attributes and possible values (the information is obtained from the Configuration database (ODM?), not the device)
----------------------------------
INFO ABOUT THE DEVICES:
prtconf displays system configuration information
lsdev -PH lists supported (predefined) devices (-H shows the header above the column; lsdev -Pc adapter -H)
lsdev -CH lists currently defined and configured devices (lsdev -Cc adapter -H)
lsdev -CHF "name status physloc location description" this will show physical location code and AIX location as well
(Devices with a location code are physical devices. Diveces without a location code are logical devices.)
lsdev -p fscsi0 displays the child devices of the given parent device (in this case the disks of the adapter)
lsdev -l hdisk0 -F parent displays the parent device of the given child device (in this case the adapter of the disk)
(it is the same: lsparent -Cl hdisk0
mkdev -l hdisk1 put from defined into available state (or creates an entry in customized db if there wasn't any)
rmdev -l hdisk1 put from available into defined state
rmdev -dl hdisk1 permanently remove an available or defined device
rendev -l hdisk5 -n hdisk16 it changes the name of the device (as long as it is not in a vg (in AIX 6.1 TL6))
odmget -q parent=pci0 CuDv shows child devices of pci0 (in the output look for the "name" lines)
odmget -q name=pci0 CuDv shows parent of pci0 (in the output look for the "parent" line)
lscfg -v displays characteristics for all devices
lscfg -vl ent1 displays characteristics for the specified device (-l: logical device name)
lscfg -l ent* displays all ent devices (it can be fcs*, fscsi*, scsi*...)
lsattr -El ent1 displays attributes for devices (-l: logical device name, -E:effective attr.)
lsattr -Rl fcs0 -a init_link displays what values can be given to an attribute
odmget PdAt |grep -p reserve_policy displays what values can be given to an attribute
lsslot -c pci lists hot plug pci slots (physical)
lsslot -c slot lists logical slots
lsslot -c phb lists logical slots (PCI Host Bridge)
cfgmgr configures devices and installs device software (no need to use mdev, rmdev)
cfgmgr -v detailed output of cfgmgr
cfgmgr -l fcsX configure detected devices attached to fcsX (it configures child devices as well)
cfgmgr -i /tmp/drivers to install drivers which is in /tmp/drivers automatically during configuration
smitty devices
---------------------------
Changing state of a device:
1.lsdev -Cc tape in normal case it shows: rmt0 Available ...
2.rmdev -l rmt0 it will show: rmt0 Defined
3.rmdev -dl rmt0 it will show: rmt0 deleted (the device configuration is unloaded from the ODM)
Now rmt0 is completely removed. To redetect the device:
4.cfgmgr after cfgmgr, the lsdev -Cc tape command shows: rmt0 Available ...
---------------------------
If rmdev does not work because: "... specified device is busy":
1. lsdev -C| grep fcs1 <--check the location (in this case it is 07-00)
2. lsdev -C| grep 07-00 <--check all the devices in this location
3. this will show which process is locking the device
for i in `lsdev -C| grep 07-00 | awk '{print $1}'`; do
fuser /dev/$i
done