Tips & Tricks for AIX
Tips & Tricks on AIX
How to get service console on AIX
diag
OR
smitty
Check machine type and firmware on AIX
lsmcode
Stop aix
shutdown -F 0
Check cluster configuration on AIX
scstat or cluster status
Tips & Tricks on AIX
How to get service console on AIX
diag
OR
smitty
Check machine type and firmware on AIX
lsmcode
Stop aix
shutdown -F 0
Check cluster configuration on AIX
scstat or cluster status
How to check the disk usage on AIX
list physical volume
lspv
list volume group details
lsvg volume_group
export volume group
exportvg
take out the hdisk
chpv -c hdisk0
Check cluster and failover in AIX
Here’s one utility command you can use to check clustering… smitty!
smitty hacmp
To stop cluster
smitty hacmp
System Management (C-SPOC) > PowerHA SystemMirror Services > Start/Stop/Show
To failover, failback resources
smitty hacmp
System Management (C-SPOC) > Resource Group and Applications > Move Resource Groups to Another Node
To look into cluster node status
lscluster -m
To look up cluster configuration
lscluster -c
Here’s a way to replace root disk on HP-UX
we are using Integrity (Itanium) 11.31 – Persistent DSF
1. Save hardware paths information of the disk (printout or file).
#ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
# ioscan -m hwpath -H 64000/0xfa00/0x4
Lun H/W Path Lunpath H/W Path Legacy H/W Path
====================================================================
64000/0xfa00/0x1b
1/0/0/2/0.0×6.0x0 1/0/0/2/0.6.0
Notes:
When the failed disk is replaced, a new LUN instance and LUN hardware path will be created. To identified the disk once is replaced, you must use the lunpath hardware path (1/0/0/2/0.0×6.0x0).
If the server is rebooted to execute the change, only the new LUN instance will be show. The old LUN will disappear from the ioscan output. Keep the output of the previous commands in a secure place.
2. Detach the physical volume from the volume group.
pvchange -a n /dev/disk/disk2_p2
3. Hot swap the disk.
4. Notify the mass storage subsystem that the disk has been replaced.
# scsimgr replace_wwid -D /dev/rdisk/disk2
Note:
This command allows the storage subsystem to replace the old disk’s LUN World-Wide-Identifier (WWID) with the new disk’s LUN WWID. The storage subsystem will create a new LUN instance and new device special files for the new disk. This command is not requiered if you rebooted the server.
5. Replace the new disk on the Hotswap bay.
6. Determine the new instance number for the disk.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk NO_HW DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
…
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk # 64000/0xfa00/0x# esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk# /dev/rdisk/disk#
7. Create a description file by doing the following:
# cat >> /tmp/idf << EOF
3
EFI 500MB
HPUX 100%
HPSP 400MB
EOF
8. Use idisk to setup the disk partitioning using the file created above and create the persistent device special files.
# idisk -wf /tmp/idf /dev/rdsk/disk2
Note:
There will be a prompt with a message saying the operation may be destructive and asks to continue. Be sure to answer ‘yes’ for the operation to be successful. If the prompt is answered with ‘y’ only, an error is received along with a message saying “user aborting”.
# insf -e -H 64000/0xfa00/0x#
insf: Installing special files for esdisk instance # address 64000/0xfa00/0x#
9. Verify the state of the mass storage subsystem after creating the EFI partitions.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk NO_HW DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
…
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk # 64000/0xfa00/0x# esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk# /dev/disk/disk#_p2 /dev/rdisk/disk# /dev/rdisk/disk#_p2
/dev/disk/disk#_p1 /dev/disk/disk#_p3 /dev/rdisk/disk#_p1 /dev/rdisk/disk#_p3
10. Assign the old instance number to the replacement disk.
# io_redirect_dsf -d /dev/disk/disk2 -n /dev/disk/disk#
Note:
If you miss to create the efi partition before using io_redirect_dsf, the command will fail gracefully with the following error message:
# io_redirect_dsf -d /dev/disk/disk2 -n /dev/disk/disk#
Number of old DSFs=8.
Number of new DSFs=2.
The number of old and new DSFs must be the same.
11. Verified that the io_redirect_dsf has properly attach the disk to the previous persistent dsf ant that the physical volume is claimed.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
12. Use mkboot to format and populate the newly created EFI partition:
# mkboot -e -l /dev/dsk/disk2
13. Change the AUTO file contents to the proper mode:.
A) Primary boot disk.
# cat >> /tmp/auto << EOF
boot vmunix
EOF
# efi_cp -d /dev/rdsk/disk2_p1 /tmp/auto /efi/hpux/auto
B) Alternate boot disk.
# cat >> /tmp/auto << EOF
boot vmunix -lq
EOF
# efi_cp -d /dev/rdsk/disk2_p1 /tmp/auto /efi/hpux/auto
14. Restore the LVM reserved areas (PVRA/VGRA).
# vgcfgrestore -n vg00 /dev/rdsk/disk2_p2
15. Reattach the new disk:
# pvchange -a y /dev/rdsk/disk2_p2
16. Reactivate the volume group to attach the physical volumen.
# vgchange -a y vgXX
Note: In case that the volume group don¡¯t start to synchronize the logical volumes automatically, you can force synchronization with:
# vgsync vgXX
17. Use lvlnboot to ensure that the LVM logical volumes are prepared to be root, primary swap or dump volume.
# lvlnboot -R
# lvlnboot -v
Monitor volume group syncronization
If you need to monitor the advance of the volume group sincronization, you can use this script to quickly monitor extends that are still “stale”. Running this command should give a lower value each iteration until it reachs zero.
while true
do
for lv in $(vgdisplay -v <vgname> | grep “LV Name” | awk ‘{print $3}’)
do
lvdisplay -v $lv
done | grep -i stale | wc -l
sleep 10
done
Example:
# while true
> do
> for lv in $(vgdisplay -v vg00 | grep “LV Name” | awk ‘{print $3}’)
> do
> lvdisplay -v $lv
> done | grep -i stale | wc -ldone | grep -i stale | wc -l
> sleep 10
> done
5
0
There’s a smart way to check the physical disk status on the Linux OS.
By using the tool named “smartmontools” ! which as obvious as it sounds, is a tool used to monitor and control the OS storage systems.
SMART stands for the Self-Monitoring, Analysis and Reporting Technology (SMART) system
It should help sysadmin to monitor the reliability of the hard drive, and predict the drive failure ahead of actual failure to prevent any incidents!
Here’s the command to scan and print out all the devices
smartctl –scan
Here’s the command to print out all the SMART information about specified disk
*it is sdd in this example
smartctl -a /dev/sdd
Here’s the command to print out all the SMART & non-SMART information about specified disk
*it is sdd in this example
smartctl -x /dev/sdd
Now that you have extended the disk space from VMWare ESXi. Lets check into the OS level and extend it from the OS level.
here is an example using Linux Virtual Machine (VM)
list all the disks available on the target Linux VM so we can identify which one’s extended
lsblk
once you’ve identified the target disk, you can have system rescan the disk
*sda can be changed to your target disk name
echo 1 > /sys/class/block/sda/device/rescan
use below command to make sure the device size is changed successfully
dmesg
Run command parted and resize partition to use new free space
*note that sda can be changed to your target disk name
# parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 365GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1075MB 1074MB primary xfs boot
2 1075MB 258GB 257GB primary lvm
Use command resizepart inside parted to resize existing partition
(parted) resizepart
Partition number? 2
End? [258GB]? 365GB
Use command print inside parted to list current partition table (note that p is short for print)
(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 365GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1075MB 1074MB primary xfs boot
2 1075MB 365GB 364GB primary lvm
Use command quit inside parted to exit to bash CLI
(parted) quit
Information: You may need to update /etc/fstab.
force the kernel to re-read partition table from sda
# partprobe /dev/sda
It is optional but you can force to re-read all the partitions in the system (usefull if you particularly created a new disk/partition)
# pvscan
# partx -v -a /dev/sda
We can now see the change and increase the size of LVM PV (the disk you just resize)
# pvresize /dev/sda2
You will now see free space in VG, that you can use as you wish.
Here’s other helpful tips if you want to create new logical volume after extending disk space
# pvresize /dev/sda#
# pvscan
# lvcreate -n “nameOfVolume” -L “sizeInG” “volumeGroupName”
# lvscan
# mkfs.xfs “nameOfVolume”
# mount -t xfs “nameOfVolume” “pathToMount”
# vi /etc/fstab
Here’s the tips and tricks to extend the disk space on VMWare Virtual Machine
my apologies as I only have license key to the vmware esxi application.
Login to the VMWare ESXi
go to the navigator on the left side menu, click “Virtual Machines”
right click onto the target system you want to extend the disk space
left click onto the “Edit settings”
on the list of settings to change, you will see the option “Hard disk #”
from there you can increase, and/or add another hard disk as you desire.
the new increase will not automatically increase the disk space on the OS level, you would need to update to the sysadmin so that they can rescan the disks!
after multiple hours and attempt spent to connect to ftp server via Windows CLI (command line interface), I’ve come to realize that Windows command-line FTP excludes using passive mode altogether.
this ends up you being able to login and change directory, but cannot execute commands such as ls, dir put or get.
what’s ftp server good for if we can’t upload or download..? well… nothing much except to go back and use FTP via Windows Explorer!
here’s how to connect to FTP server via Windows Explorer
1) open Windows Explorer
2) click on the address bar
3) type “ftp:// followed by the ftp site address whether it be IP address, or domain name
4) press enter
5) enter the credentials when asked, you have option to be anonymous user, and save your password
6) logon
now you’ll be able to see the contents on the ftp server!