If you need to automate you remote scripting, like I do and without having being bothered to enter 'Yes' when being prompted to accept the key or with any other prompts you might see.
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${user}@${host}
Thursday, December 18, 2014
Sunday, November 30, 2014
Linux - Extracting a single file from an RPM package
Create a temporary directory
# mkdir /tmp/1
# cd /tmp/1
# rpm2cpio /media/Packages/setup-2.8.14-20.el6_4.1.noarch.rpm | cpio -ivd
Copy the needed file out
# mkdir /tmp/1
# cd /tmp/1
# rpm2cpio /media/Packages/setup-2.8.14-20.el6_4.1.noarch.rpm | cpio -ivd
Copy the needed file out
Friday, November 7, 2014
Exadata X2-2 / Oracle Sun X4170 M2 - Faulty hard disk on MegaRAID SAS 2108
If you happen to be administrating an Oracle Sun X4170 M2, and should you happen to have the urge to verify that your disks are in proper working order, like I do, you'd do:
# PATH=$PATH:/opt/MegaRAID/MegaCli; export PATH
# MegaCli64 -pdlist -a0 | grep -iE "slot|firmware"
Slot Number: 0
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
Slot Number: 1
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
Slot Number: 2
Firmware state: Failed
Device Firmware Level: A2A8
Slot Number: 3
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
To view more details of the disk [252:2], you'd usually won't be bothered to read all (like I do)
# MegaCli64 -PDInfo -PhysDrv [252:2] -aALL
Enclosure Device ID: 252
Slot Number: 2
Drive's position: DiskGroup: 0, Span: 0, Arm: 2
Enclosure position: N/A
Device Id: 12
WWN: 5000CCA00AB44FEF
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.464 GB [0x22cee000 Sectors]
Sector Size: 0
Logical Sector Size: 0
Physical Sector Size: 0
Firmware state: Failed
Commissioned Spare : No
Emergency Spare : Yes
Device Firmware Level: A2A8
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000cca00ab44fed
SAS Address(1): 0x0
Connected Port Number: 3(path0)
Inquiry Data: HITACHI H103030SCSUN300GA2A81029G653XE
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive: Not Certified
Drive Temperature :19C (66.20 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s
Port-1 :
Port status: Active
Port's Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : No
Exit Code: 0x00
To view more info of the RAID-5 logical drive
# MegaCli64 -LDInfo -L0 -a0
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :DBSYS
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3
Size : 835.394 GB
Sector Size : 512
Is VD emulated : No
Parity Size : 278.464 GB
State : Degraded
Strip Size : 1.0 MB
Number Of Drives : 4
Span Depth : 1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disabled
Encryption Type : None
Is VD Cached: No
Exit Code: 0x00
# PATH=$PATH:/opt/MegaRAID/MegaCli; export PATH
# MegaCli64 -pdlist -a0 | grep -iE "slot|firmware"
Slot Number: 0
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
Slot Number: 1
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
Slot Number: 2
Firmware state: Failed
Device Firmware Level: A2A8
Slot Number: 3
Firmware state: Online, Spun Up
Device Firmware Level: A2B0
To view more details of the disk [252:2], you'd usually won't be bothered to read all (like I do)
# MegaCli64 -PDInfo -PhysDrv [252:2] -aALL
Enclosure Device ID: 252
Slot Number: 2
Drive's position: DiskGroup: 0, Span: 0, Arm: 2
Enclosure position: N/A
Device Id: 12
WWN: 5000CCA00AB44FEF
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.464 GB [0x22cee000 Sectors]
Sector Size: 0
Logical Sector Size: 0
Physical Sector Size: 0
Firmware state: Failed
Commissioned Spare : No
Emergency Spare : Yes
Device Firmware Level: A2A8
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000cca00ab44fed
SAS Address(1): 0x0
Connected Port Number: 3(path0)
Inquiry Data: HITACHI H103030SCSUN300GA2A81029G653XE
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive: Not Certified
Drive Temperature :19C (66.20 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s
Port-1 :
Port status: Active
Port's Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : No
Exit Code: 0x00
To view more info of the RAID-5 logical drive
# MegaCli64 -LDInfo -L0 -a0
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :DBSYS
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3
Size : 835.394 GB
Sector Size : 512
Is VD emulated : No
Parity Size : 278.464 GB
State : Degraded
Strip Size : 1.0 MB
Number Of Drives : 4
Span Depth : 1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disabled
Encryption Type : None
Is VD Cached: No
Exit Code: 0x00
Exadata X2-2 / Oracle Sun X4170 M2 - Locator LED on ILOM 3.0
This is especially useful should you need to arrange for a disk replacement for an Oracle Sun X86 servers in a remote site. Especially when any particular component of the server needs to be replace and this should also ease the assigned Field Engineer to physically locate the server.
# ipmitool sunoem cli "show /SYS/LOCATE"
Connected. Use ^D to exit.
-> show /SYS/LOCATE
/SYS/LOCATE
Targets:
Properties:
type = Indicator
ipmi_name = LOCATE
value = Off
Commands:
cd
set
show
-> Session closed
Disconnected
To turn off the locator LED:
# ipmitool sunoem cli "set /SYS/LOCATE value=off"
Connected. Use ^D to exit.
-> set /SYS/LOCATE value=off
Set 'value' to 'off'
-> Session closed
Disconnected
# ipmitool sunoem cli "show /SYS/LOCATE"
Connected. Use ^D to exit.
-> show /SYS/LOCATE
/SYS/LOCATE
Targets:
Properties:
type = Indicator
ipmi_name = LOCATE
value = Off
Commands:
cd
set
show
-> Session closed
Disconnected
To light up the locator LED:
# ipmitool sunoem cli "set /SYS/LOCATE value=fast_blink"
Connected. Use ^D to exit.
-> set /SYS/LOCATE value=fast_blink
Set 'value' to 'fast_blink'
To verify that the locator LED has been light up
# ipmitool sunoem cli "show /SYS/LOCATE"
Connected. Use ^D to exit.
-> show /SYS/LOCATE
/SYS/LOCATE
Targets:
Properties:
type = Indicator
ipmi_name = LOCATE
value = Fast Blink
Commands:
cd
set
show
-> Session closed
Disconnected
# ipmitool sunoem cli "set /SYS/LOCATE value=fast_blink"
Connected. Use ^D to exit.
-> set /SYS/LOCATE value=fast_blink
Set 'value' to 'fast_blink'
To verify that the locator LED has been light up
# ipmitool sunoem cli "show /SYS/LOCATE"
Connected. Use ^D to exit.
-> show /SYS/LOCATE
/SYS/LOCATE
Targets:
Properties:
type = Indicator
ipmi_name = LOCATE
value = Fast Blink
Commands:
cd
set
show
-> Session closed
Disconnected
To turn off the locator LED:
# ipmitool sunoem cli "set /SYS/LOCATE value=off"
Connected. Use ^D to exit.
-> set /SYS/LOCATE value=off
Set 'value' to 'off'
-> Session closed
Disconnected
Labels:
exadata,
ILOM 3.0,
ipmitool,
linux,
Oracle Sun X4170 M2
Thursday, January 30, 2014
Sunday, January 26, 2014
USB-to-Serial on Fedora 20
Oh boy, was I lucky my USB-to-serial works like a charm on my brand new Fedora 20 install. Plugged it in and it works, and I'll be damned.
And here's how my dmesg output looks:
[11619.109776] usb 3-4: new full-speed USB device number 3 using xhci_hcd
[11619.121660] usb 3-4: New USB device found, idVendor=0557, idProduct=2008
[11619.121666] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[11619.121669] usb 3-4: Product: USB-Serial Controller D
[11619.121672] usb 3-4: Manufacturer: Prolific Technology Inc.
[11619.513465] usbcore: registered new interface driver pl2303
[11619.513486] usbserial: USB Serial support registered for pl2303
[11619.513510] pl2303 3-4:1.0: pl2303 converter detected
[11619.514756] usb 3-4: pl2303 converter now attached to ttyUSB0
And here's how my dmesg output looks:
[11619.109776] usb 3-4: new full-speed USB device number 3 using xhci_hcd
[11619.121660] usb 3-4: New USB device found, idVendor=0557, idProduct=2008
[11619.121666] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[11619.121669] usb 3-4: Product: USB-Serial Controller D
[11619.121672] usb 3-4: Manufacturer: Prolific Technology Inc.
[11619.513465] usbcore: registered new interface driver pl2303
[11619.513486] usbserial: USB Serial support registered for pl2303
[11619.513510] pl2303 3-4:1.0: pl2303 converter detected
[11619.514756] usb 3-4: pl2303 converter now attached to ttyUSB0
And voila! I have /dev/ttyUSB0 ready for outgoing serial connections.
And due to the nature of my work I need to keep a log of what I do. Here's a script which I have loaded onto by bash profile (~/.bash_profile). I know it looks crude, basically all I need to know prior to connecting to the target serial connection is to know what hostname it has as reference. And call the log of the connection as hostname-date_X, where is the number of console log I may already have in existence, and if it already exists, creates a new one by adding a +1 to X.
I actually though of adding traps after read hostname, just to make sure the hostname I enter are appropriately hostnames, but doing it on bash is just cumbersome. Since it's my laptop and my subroutine, heck this should work.
initserial() {
serdev=/dev/ttyUSB0
if [ ! -c ${serdev} ]; then
echo "Usage: initserial"
echo " ttyUSB0 is not connected"
return 1
fi
echo -n "Please enter the target server hostname: "
read hostname
i=1
found_console_log_file=0
while [ $found_console_log_file -eq 0 ]; do
console_log=${hostname}-`date +%Y%m%d`
echo ${console_log}_$i | egrep "^(.*)_+[[:digit:]]$" 2>&1 >/dev/null
found_console_log=$?
if [ ! -f ${console_log}_$i ]; then
console_log_file=${console_log}_$i
found_console_log_file=0
break
fi
i=`expr $i + 1`
done
echo "Appending output to $console_log_file"
/usr/bin/script $console_log_file
/usr/bin/screen $serdev
}
Bye bye Windows 7 or at least I think I did
I finally took the plunge, reformatted my laptop and had it installed with Fedora 20.
So, yeah, I now have problems with Visio, because yeah I need to edit and create diagrams and stuffs for the systems I scribbled on paper and have it well properly drawn? Is that an actual proper description of what I do for a living. Haha. Oh well.
As of the moment, I only have 3 problems with this Fedora 20 installation
1. My touchpad is super-sensitive, I thought by enabling the option of disabling the touch pad when keyboard is active (somewhere along that description) should fix it but no. On windows 7 (unfortunately) there is sort of a led plus active area on the top left which you can tap two times, just in case if you want to disable the touchpad, and this doesn't work on Fedora 20, and as far as I can recall, it never worked on Fedora.
2. Printing on HP printers, haven't got the chance to get this fix yet. I am scared I might send garbage printouts to the office HP Laserjet printers
3. Visio, period.
So, yeah, I now have problems with Visio, because yeah I need to edit and create diagrams and stuffs for the systems I scribbled on paper and have it well properly drawn? Is that an actual proper description of what I do for a living. Haha. Oh well.
As of the moment, I only have 3 problems with this Fedora 20 installation
1. My touchpad is super-sensitive, I thought by enabling the option of disabling the touch pad when keyboard is active (somewhere along that description) should fix it but no. On windows 7 (unfortunately) there is sort of a led plus active area on the top left which you can tap two times, just in case if you want to disable the touchpad, and this doesn't work on Fedora 20, and as far as I can recall, it never worked on Fedora.
2. Printing on HP printers, haven't got the chance to get this fix yet. I am scared I might send garbage printouts to the office HP Laserjet printers
3. Visio, period.
Subscribe to:
Posts (Atom)