Linux Commads
Linux Commads
Linux Commads
or
# cd /sys/class/scsi_host; for i in [0-9]; do cat host$i/device/fc_host/host$i/port_name; done
You can also find out he following in by changing the “port_name”
port_id
port_state
port_type
speed
or
systool -c fc_host –vv
Unmount Fs on source
Deactivate VG ---vgchange –an vgname
Export vg to the other server – vgexport vgname
Pvscan
Vgimport vgname
Activate Vg ----Vgchange –ay vgname
#mkdir –p mountpoint
Mount lv mountpoint
************************************************************************************
Set Time, Date Timezone in Linux from Command Line Use ntp
To have the correct time and date in Linux is very important, a lot of things depends on it. It does
not matter if you are using Linux to power your personal computer or you have a Linux server.
The server and system clock needs to be on time.
date
The hardware clock is the clock that runs in you PC hardware even if you disconnect it from the
main power supply. This is because it has a lithium battery in the modern computers and another
type of battery in the old ones.
hwclock --show
date
cp /usr/share/zoneinfo/America/La_Paz /etc/localtime
To have your system to automatically adjust time we need to install ntp . Get it from your
repository. Once installed you can configure it this way:
# With the default settings below, ntpd will only synchronize your clock.
#
# For details, see:
# - the ntp.conf man page
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
# NOTE: If you run dhcpcd and have lines like 'restrict' and 'fudge' appearing
# here, be sure to add '-Y -N' to the dhcpcd_ethX variables in /etc/conf.d/net
Be sure to start the daemon, and to make it start automatically when the system boots.
On Arch Linux is: /etc/rc.d/ntpd start on Debian and derivatives /etc/init.d/ntpd start
You can update the clock manually, without the need of the daemon with ntpdate
ntpdate 129.6.15.28
******************************************************************
RSYNC
rsync -av -e ssh root@pephap00020:/gis/shared/ /gis/shared/
(Keep the trailing / from the source file to avoid making a secondary directory)
To Tricke it slowly use –bw flag with slowes in bps (bits per second) –normally 1024 bps (about
160KBps) would be a good start.
Default behavoir
The following command will recursively copy all files from the local filesystem from /var/www
to the remote system at 10.1.1.1. Note the following:
1. Any files that do not exist on the remote system are copied over
2. Any that have been updated will be copied over, although note that rsync is extremely
efficient in that only the changed parts of files are copied and if the file is exactly the
same if it is not copied over at all
3. Any that have been deleted on the local system are deleted on the remote
1. Any files that do not exist on the remote system are copied over
1. Any files that do not exist on the remote system are copied over
2. Any files that exist on both local and remote that have a newer timestamp on the local
server are copied over. (Conversely, any files that have an older timestamp are not copied
over).
Combined with the --progress flag I have included in all the examples, --dry-run will output all
the directories it looks at and then all the files that would be copied
***********************************************************************
fdisk –l to verify
Then add:
Use fdisk to create a single partition on the new device, make it type 8e (LVM).
Initialize the new partition as a physical volume:
# pvcreate /dev/sdX1
Extend your volume group with the new PV:
# vgextend yourvolumegroup /dev/sdX1
Extend your logical volume with the free space of the VG:
# lvextend -l +100%FREE /dev/yourvolumegroup/yourlogicalvolume
Resize the filesystem online (only ext3 and ext4!):
# resize2fs /dev/mapper/yourvolumegroup-yourlogicalvolume
Verify your new partitions free space with 'df -h'.
**%FREE or whatever amount needed to attach.
Inserting a word at the beginig of each line in VI
:%s/^/foo: /
:%s/$/\*/g
Or
:%norm A*
rescan-scsi-bus.sh
lsscsi
pvs
multipath –l (multipathd –k gives a interactive console)
fdisk -l /dev/sda
fdisk -l /dev/sdg
fdisk -l /dev/sdi
fdisk -l /dev/sde
pvcreate multi-SYMM_7571_2554
fdisk -l | less
pvcreate /dev/mapper/multi-SYMM_7571_2554
partprobe
pvs
vgs
vgextend vgsw01 /dev/mapper/multi-SYMM_0B10_2554
vgextend vgsw01 /dev/mapper/multi-SYMM_7571_2554
vgs
df -h
lvextend -L +34G /dev/vgsw01/lvbea
resize2fs /dev/vgsw01/lvbea
df -h
df -h /bea
LVCreate
1. lvcreate -L 6G -n /dev/vgname/lvname
2. check filesystem type: df –T
3. mkfs -t ext3 /dev/vgname/lvname
4. mkdir –p directoryname
5. mount /dev/vgname/lvname /path/to/file
6. vi /etc/fstab
LV Reduce
1. su
2. umount filesystem (ex: /dev/mapper/vg01-smartstor2)
3. If device is busy,
fuser –m /dev/mapper/vg01-smartstor2
ps aux | grep (process #)
kill -9 process #
4. e2fsck –f /dev/mapper/vg01-smartstor2
5. resize2fs –p /dev/mapper/vg01-smartstor2 48G
6. lvreduce –L 48G /dev/mapper/vg01-smartstor2
7. e2fsck –f /dev/mapper/vg01-smartstor2
8. resize2fs /dev/mapper/vg01-smartstor2
9. mount /dev/mapper/vg01-smartstor2 (or give direct path name to the filesystem, look up
in /etc/fstab)
LV Extend
or
ext2online /dev/mapper/vg01-lvol1
lvs -o +devices
find . -type f -newermt 2018-04-04 ! -newermt 2018-04-09 -print0 | xargs -0 ls -l | awk '{print
$9}' | sort >>tmp/files
Sudo Commands
To check if a file is open you can run:
sudo lsof /path/to/file
grep -l UID * | grep -v XXX.users | xapply -f '[ -w %1 ] || co -l %1; sed -i "/UDI:/d" %1' -
grep –l ‘^@include bst’ *lp.{users,groups} | xapply –f ‘co –l %1; sed –i “/^@include bst/d” %1’
–
cat /path/to/filename |xapply -f "host %1 |grep 'has address' | cut -d '.' -f1 |Cluster -c -f -" - |cut -d
'-' -f1 |sort |uniq
xapply -f 'co -l %1-class.users || exit ; grep -q ms947915 %1-class.users || echo "ms947915:" >>
%1-class.users' - < /path/to/filename
Arguments are separated by ";"
The first argument co and locks a file, if the file is already locked then it does not proceed
further. It exits.
If the user is already in the file; it exits quietly. If the user is not in the file, it proceeds
with echo the username in the file (amends a line at the end of the file).
Grep for something and co a file but exit if the file is co by someone else:
grep -l '^@include wily' *.users | xapply -f 'co -l %1 || exit ; sed -i "$ a\appd:" %1' -
or to save a process:
grep -l '^@include wily' *.users | xapply -f 'co -l %1 || exit ; echo appd: >> %1'
VMWare Tools:
SCP:
scp user@xxxx.fedex.com:/directory/file /intended file
AWK:
Sorting and printing the first letter of files while grepping for something:
o grep generic * | awk -F: '{print $1}' |sort -n |cut -d- -f1 |uniq
Sendmail:
service sendmail stop
service sendmail start
mail emailaddress “test mail”
Partition Identifier
mount -v | grep "^/" | awk '{print "\nPartition identifier: " $1 "\n Mountpoint: " $3}'
To see in TB:
# parted /dev/sda unit TB print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
To see in GB:
# parted /dev/sda unit GB print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
To see in MB:
# parted /dev/sda unit MB print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
To see in bytes:
# parted /dev/sda unit B print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
To see in %:
# parted /dev/sda unit '%' print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
To see in sectors:
# parted /dev/sda unit s print free | grep 'Free Space' | tail -n1 | awk '{print $3}'
Change /dev/sda to whatever device you are trying to find the information about. If you are using
the result in any calculations, make sure to trim the trailing characters.
Locate a file:
ls -l $(locate libjli.so)
TOP processes:
TOP 10 CPU utilization processes:
echo " %CPU PID RUSER COMMAND" ;UNIX95= ps -ef -o 'pcpu pid ruser args'|sort -nr|head
-10
set -o
RDX /nas/dbnfs
### Rebuild New RDX Cartridge ####
/opt/syseng/admin/bin/disk_cart_recreate.ksh
/opt/syseng/admin/bin/system_backup_FUR_R7.ksh 0 (System level backup)(6hrs- start with
at)
/opt/syseng/admin/bin/make_system_recovery.ksh (BMR)
AT job:
at now <enter> and paste that cmd <enter> <cntl>d
FSCK:
fsck -t ext3 –y flesystemname
wget http://peplis00115.corp.pep.pvt/repo/tools/pepSMTsetup.sh
chmod +x pepSMTsetup.sh
sh pepSMTsetup.sh --host peplis00115.corp.pep.pvt
# zypper up --download-only
Files get in /var/cache/zypp/packages/
Rebuild rpm db
files to see
/var/adm/backup/rpmdb/ packages.---gz
/var/lib/rpm/packages.
RACADM:
GetHba:
mount prdlinux:/usr/mow /mnt
cp /mnt/scripts/linux/* /usr/bin/
umount /mnt/
HP hardware info:
hpacucli ctrl all show config detail
hpacucli ctrl all show config
hpacucli utility:
# hpacucli
# hpacucli help
NOTE: User can use the hpacucli command in a script after installing hpacucli
package (can be download separately as rpm / it also comes in PSP in Linux).
Controller commands:
hpacucli> ctrl all show config ## Display detail of Controller
Expand, Extend, add spare and deleting Logical drives in existing RAID:
hpacucli> ctrl slot=0 ld 4 delete
## To Delete LogicalDrives
HPONFCFG
GetHba
WWPN:
cd /sys/class/fc_host
for i in 0 1 2 3 4 5; do cat host$i/port_name; done
Timezone:
zdump -v /etc/localtime
zdump -v /etc/localtime | grep 2015
cat /etc/sysconfig/clock
zdump -v US/Eastern
zdump -v US/Eastern | grep 2015
ll /usr/share/zoneinfo/
ll /usr/share/zoneinfo/US/
zdump -v /usr/share/zoneinfo/US/Arizona
TCPDUMP:
Start tcpdump with
tcpdump –s 0 w /path/filename.pcap
End it with ctrl c
To read tcpdump
tcpdump -ttttnnr /path/filename.pcap | tail -50 or more (the file gets huge quickly)
tcpdump for a specific ip address and port number, here is how to do it.
Tar:
If you’re root but is not managing to become a user with su, you also need to reset the login
Onboarding a server
mount –o remount /
To install VMtools
To Release IP
ulimit
vi /etc/security/limits.conf
gidm soft nproc 8192
gidm soft nproc 8192
Core Dump
From
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
to
ulimit -c unlimited >/dev/null 2>&1
# The following line is added to send the contents of core dump to /tmp/core
kernel.core_pattern = /tmp/core-%p
For the programs started by a daemon or service, add the following line into /etc/sysconfig/init
DAEMON_COREFILE_LIMIT='unlimited'
Once done
#ulimit –c unlimited
And set it up
#sysctl –p
* soft core 0
* hard core 0
Storage team keeps a snapshot of NFS share daily for 6 days. We can restore stuff from .ckpt
directory. It will not show up in ls –la.
/var/log/mail
Locate main.cf
Fix the issues
Postfix reload or service postfix restart (if it doesn’t work)
/var/spool/postfix (should be owned by postfix)
Adding SWAP
# Swapoff -a
# mkswap /dev/sda3
# swapon –a
# swapon /dev/sda3
# create /etc/fstab entry for the newly created swap as well.
PACKET LOSS
Packet loss should be looked at the VM side first. If nothing works and there is some good memory on a
host, try increasing buffer size
#ethtool –g eth0
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 256
RX Mini: 0
RX Jumbo: 0
TX: 512
To resize buffer to a value
#ethtool –G eth0 rx 4096 tx 4096 (its set to max value)
Ps -eLf
ps -eLf | awk '{ print $12 }' | sort | uniq -c | sort -nr | head -10
cat /proc/sys/Kernerl/pid_max
CRONTAB
Crontab –l ( lists cron jobs)
Crontab –e ( ecit cron jobs)
If crontab is not working for a user, check cron.allow and cron.deny. Also check and see the password
expiry of the user
Memory:
cat /proc/buddyinfo
echo m > /proc/sysrq-trigger
grep Normal /var/log/messages | tail –l
ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5
systool -c fc_host -v | egrep "port_name|port_state"
AWK (example)
1014 uname -a | awk '{print $3}'
1015 echo ' a b c '|awk '{print $3}'
1016 uname -a | awk '{print $1,$2,$3}'
1017 uname -a | awk '{print $1 $2 $3}'
1018 uname -a | awk '{print $1-$3}'
1019 uname -a | awk '{print $1 - $3}'
for i in `cat xbc`; do printf "`echo $i` `cmd $i /usr/sbin/dmidecode -s system-product-name` `cmd $i
cat /etc/*release | grep -i version | grep -v LSB |awk '{print $3}'` `cmd $i cat /etc/*release | grep -i
PATCHLEVE | awk '{print $3}'` `cmd $i uname -a | awk '{print $3}'` `cmd $i uptime | awk '{print $3}'`
\n" >>list2; done
https://mycollab.mypepsico.com/communities/service/html/communitystart?communityUuid=6112e00
a-15eb-4afd-b38e-
3ea91cd281bb#fullpageWidgetId=W95ccc4d31c3c_4beb_8a74_ebdcab16754d&folder=%257BA0E8345
4-0000-CD18-BEE5-4901A1E25399%257D
As SQL DBA
sdbq,
sdgr,
Identifying the disks are connected over FC
transport=fc
node_name=0x20000000c9a19efe
port_name=0x10000000c9a19efe
port_id=0x017a40
speed=8 Gbit
supported_classes=Class 3
transport=fc
node_name=0x20000000c9f241df
port_name=0x10000000c9f241df
port_id=0x017a40
supported_classes=Class 3
0x10000000c9a19efe
0x10000000c9f241df
port_name = "0x10000000c9a19efe"
port_state = "Online"
--
port_name = "0x10000000c9f241df"
port_state = "Online"
Verified the identified disks are not being used in LVM and multipath
root@pbgldr00015:~# pvs
RACADM
ll Dell DRACs come with a default account set up as root / calvin which is a huge security risk if left!
The web interface doesn’t let you change the password but the firmware does when you boot the server.
A second way to change the password is with the racadm tool, if installed, at the command line! This
means you don’t have to reboot that precious production server!
In DRAC 4, the first index slot is root by default. In DRAC 5 and 6, index 1 is Administrator, index 2 isroot.
We can display the ID info using racadm command:
DRAC 4:
DRAC 4:
#:sar -d
#:sar -dp
#:sar -q
#:sar -b
#:sar -dp
#:sar -b
#:sar -p
#:sar –q
#:sar -d -f /var/log/sa/201607/sa05
#:sar -dp -f /var/log/sa/201607/sa16
Removal of a storage device is not recommended when the system is under memory
pressure, since the I/O flush will add to the load. To determine the level of memory
pressure, run the command vmstat 1 100; device removal is not recommended if:
o Free memory is less than 5% of the total memory in more than 10 samples per 100
(the command free can also be used to display the total memory).
o Swapping is active (non-zero si and so columns in the vmstat output).
1. Close all users of the device and backup device data as needed.
2. Use umount to unmount any file systems that mounted the device.
3. Remove the device from any md and LVM volume using it. If the device is a member of an
LVM Volume group, then it may be necessary to move data off the device using
the pvmove command, then use the vgreduce command to remove the physical volume,
and (optionally) pvremove to remove the LVM metadata from the disk.
4. If the device uses multipathing, run multipath -l and note all the paths to the device.
Afterwards, remove the multipathed device using multipath -f device.
5. Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device.
This is particularly important for raw devices, where there is
no umount or vgreduce operation to cause an I/O flush.
6. Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-
path or the major:minor number, in applications, scripts, or utilities on the system. This is
important in ensuring that different devices added in the future will not be mistaken for the
current device.
7. Finally, remove each path to the device from the SCSI subsystem. To do so, use the
command echo 1 > /sys/block/device-name/device/delete where device-name may
be sde, for example.
Note
The older form of these commands, echo "scsi remove-single-device 0 0 0 0" >
/proc/scsi/scsi, is deprecated.
REMOVING A VM DISK
First ensure the disk is nto part of any VG or even used in ASM
# Lsscsi -----------to find out the disk
#ll /sys/bus/scsi/drivers/sd/ (disk major:minor)/block/----confirms the disk is there
#cat /proc/scsi/scsi
To remove
Parted
Show disk partition info
parted -s /dev/sdae print
Removing the first partition
parted -s /dev/sdae rm 1 ( this could be used for any given partition)
*********************************************************
Using dd to wipe clean a disk
To wipe only the partition table, leaving the boot code intact:
Code:
To wipe the entire MBR (which is probably what you really want to do):
Code:
To wipe all of Track Zero (which contains the MBR and possibly a boot loader):
Code:
By wiping all of Track Zero, you wind up with a "blank" disk, unpartitioned, with no sneaky
boot sector viruses. The disk behaves like it did when it came from the factory (assuming it
didn't come from the factory already partitioned and formatted - some external disks come
this way).
=====
Background:
A sector is 512 bytes long. The first sector of a disk is the MBR (Master Boot Record). The
MBR contains 446 bytes of "boot code", followed by 64 bytes of "partition table", followed
by two bytes of who-konws-what (not used by Linux). The "partition table" contains four
"partition records", each being 16 bytes in length. Track Zero is the first 63 sectors of a disk
(and therefore contains the MBR plus 62 additional sectors). These 62 additional sectors are
sometimes used to hold a "boot loader", or part thereof. Ill-advised copy protection
schemes sometimes use these 62 sectors, often times with disastrous results for the user.
Actual "normal" data storage begins on Track One, which immediately follows Track Zero.
*********************************************************
UPGGRADING ILO from CLI
#ssh to ilo interface
</>hpiLO-> cd map1/firmware1
</map1/firmware1>hpiLO-> show ( you will see the firmware version for ILO here)
</map1/firmware1>hpiLO-> load –source (location) the ilo file sould end with .bin
You will see output as show below. You may have to wait several minutes for the update to
complete. You can run a ping –t against the ILO IP address and you will see it time out for a few
pings and come back. You will also be disconnected from your Putty session. These are good
indicators that the upgrade is complete.
Now you will have to sign back into ILO again using putty as you will have lost your connection
during the upgrade. When you log back, you will the version number is updated as shown below.
ILO location
root@peplgp00001:/Blade_FW/Blade/ilo-1.55# ll
total 8860
drwxr-xr-x 2 root root 4096 Nov 24 2015 ./
drwxr-xr-x 5 root root 4096 May 10 08:26 ../
-rw-rw-rw- 1 root root 162985 Jan 24 2013 CP018561.xml
-rw-r-xr-x 1 root root 5182 Jan 24 2013 README.TXT*
-rwxr-xr-x 1 root root 472396 Jan 23 2013 flash_ilo3*
-rw-r-xr-x 1 root root 8394340 Jan 24 2013 ilo3_155.bin*
root@peplgp00001:/Blade_FW/Blade/ilo-1.55#
Environment
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Desktop 10
SUSE Linux Enterprise Desktop 11
Situation
The kernel is crashing or otherwise misbehaving and a kernel core dump needs to be
captured for analysis.
Resolution
Prerequisites
Kdump stores kernel core dumps under /var. The partition that /var is on must have
enough available disk space for the vmcore file, which will be approximately the size of
the system's physical memory. By default, the system will attempt to keep 5 vmcore
files. The Kdump facility is available for SLES10 and SLES11 on x86, x86-64, ppc64
and ia64 architectures, and starting with SLES11 SP3, for IBM System z. See
Limitations under Additional Information below for more information.
For kernel problems other than a kernel oops or panic, a kernel core dump is not
triggered automatically. If the system still responds to keyboard input to some degree, a
kernel core dump can be triggered manually through a "magic SysRq" keyboard
combination (typically: hold down three keys simultaneously: the left Alt key, the Print
Screen / SysRq key and a letter key indicating the command - ' s' for sync, ' c' for core
dump) or a SYSTEM/PSW RESTART on System z, if this feature has been enabled.
For general documentation of the "magic SysRq" feature, please refer to the
Documentation/sysrq.txt file in the Linux kernel source.
For some kernel problems, a kernel core dump is not triggered and the system does not
respond to the keyboard anymore. For those situations, it may still be possible to trigger
a kernel core dump through magic SysRq sequences from a serial console.
Please refer to TID 3456486, Configuring a Remote Serial Console for SLES, for the
procedure.
Configure the system for capturing kernel core dumps (SLES 10)
1. Install the packages kernel-kdump, kdump, and kexec-tools.
The kexec-tools package contains the tools that make it possible to start the
capture kernel from the primary kernel.
2. Reserve memory for the capture kernel by passing appropriate parameters to the
primary kernel.
For the x86 and x86_64 architecture use the table below based upon how much
memory you have.
Memory crashkernel= 3.
0 - 12 GB 64M@16M
13 - 48 GB 128M@16M
49 - 128 GB 256M@16M
This can be done as follows: Start YaST, under System, select Boot Loader. On
the tab Section Management, select the default section and select Edit. Add
the settings to the field labeled Optional Kernel Command Line Parameter
, then select Ok and Finish to save the settings.
4. Activate the kdump system service.
Run
chkconfig kdump on
SLES 11 does not require the kernel-kdump package like in earlier versions of
SUSE LINUX Enterprise. The technical reason is that the normal kernel is
relocatable now and can be used as kdump kernel, i.e. it's possible to load and
execute the normal kernel at any address, not only the compiled-in address as
before.
The kexec-tools package contains the tools that make it possible to start the
capture kernel from the primary kernel.
2. Reserve memory for the capture kernel by passing appropriate parameters to the
primary kernel.
For the x86 and x86_64 architecture use the table below based upon how much
memory you have.
Memory crashkernel= 3.
0 - 12 GB 128M
13 - 48 GB 256M
49 - 128 GB 512M
5.
6. For the IBM PPC64 architecture use the table below based upon how much
memory you have.
Memory crashkernel=
2 - 4 GB 320M
5 - 32 GB 512M
33 - 64 GB 1024M
65 - 128 GB 2048M
129 GB & above 4096M
7.
o Note: the crashkernel no longer needs the offset of 16M on SLES 11 for x86 and
x86_64 architecture.
o Note: For SLES11 SP2 please double the values for needed memory. The
minimum need is 256M.
o Note: More memory needs to be reserved if the btrfs filesystem is used for root
rather than the ext3 filesystem.
o Note: For Xen installations, this parameter needs to be passed to the GRUB line for
the Xen hypervisor, not the module line for the Dom0 kernel.
o Note (*): There are hard-coded limits (kernel/kexec-tools) not allowing to allocate
1GB. If loading kdump with crashkernel=1G fails, please change the crashkernel
size to something smaller: 896M, 768M or 512M.
o Note: The minimum size of the crashkernel can vary (hardware/machine specific)
so it's best to test the size that will allow to load kdump.
Reserving memory can be done as follows: Start YaST, under System, select
Boot Loader. On the tab Section Management, select the default section and
select Edit. Add the settings to the field labeled Optional Kernel Command
Line Parameter , then select Ok and Finish to save the settings.
1. Activate the kdump system service.
Run
chkconfig boot.kdump on
If the root device is not using devicemapper devices, but the dump is to be captured
on a devicemapper device, you need to set:
KDUMP_COMMANDLINE_APPEND="root_no_dm=1 root_no_mpath=1"
in /etc/sysconfig/kdump.
If you use devicemapper devices for both, root and kdump, these options must not be
added.
To test the local kernel core dump capture, follow these steps.
If magic SysRq has been configured:
1. Magic-SysRq-S to sync (flush out pending writes)
2. Magic-SysRq-C to trigger the kernel core dump
On IBM System z, a kernel core dump can be manually triggered:
For SLES in an LPAR by executing the PSW RESTART task on the HMC
For SLES in z/VM by issuing #CP SYSTEM RESTART from the 3270 terminal
Please note that the RESTART mechanism does not provide a way to flush write
buffers and bears the risk of data loss. It should be used only if the SLES system is
completely unresponsive and can't be shut down properly.
Once the system becomes responsive again, verify that a capture file was created as
/var/log/dump/ date-time/vmcore. On SLES 11 look in
/var/crash/date.
Setup for network dump captures - prepare for non-interactive data transfers
1. for SLES10
The scp command (part of OpenSSH) will be used to transfer the dump over the
network.
This will make kdump act in a manner similar to the older netdump mechanism: the
capture environment will go up to runlevel 3 (where network connectivity is enabled)
and will use the secure copy command scp to transfer the kernel core dump to a
separate system.
2. for SLES11
In order to automatically set up a network device, pass the option "auto". This is
also the default.
For a custom setup, pass a string that contains the network device and the mode
(dhcp,static), separated by
a colon, for example: "eth0:static" or "eth1:dhcp".
If you use "static", you have to set the IP address with ip=ipspec. ipspec is
<client>:<server>:<gateway>:<netmask>:<hostname>:<device>:<proto>
as boot parameter. See mkinitrd(8) for details.
Pass the dumping method and the destination directory to the parameter:
KDUMP_SAVEDIR in /etc/sysconfig/kdump
Supported methods are:
See also: kdump(5) which contains an exact specification for the URL format.
NOTE:
When calculating the needed value for crashkernel, the number of dm-devices is
important. For each dm-device attached to the server an extra 4 MB is needed.
A too low configured value will cause the server to hang when booting in the crashkernel.
See also tid 7010542
Additional Information
Limitations
Kdump is not supported for Xen kernels prior to SLES 11 Service Pack 2.
On IBM System z, kdump is not supported prior to SLES11 Service Pack 3.
On the IA-64 architecture, kdump is only supported as of SLES 10 Service Pack 1.
IO Scheduler.
Ideally, there would be a single scheduler to satisfy all needs. It doesn't seem to exist yet.
The kernel often doesn't have enough knowledge to choose the best scheduler for your
workload:
noop is often the best choice for memory-backed block devices (e.g. ramdisks) and
other non-rotational media (flash) where trying to reschedule I/O is a waste of
resources
deadline is a lightweight scheduler which tries to put a hard limit on latency
cfq tries to maintain system-wide fairness of I/O bandwidth
cat /sys/block/sd*/queue/scheduler
Change IO Scheduler
To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
# echo 3 > /proc/sys/vm/drop_caches
The above are meant to be run as root. If you're trying to do them
using sudo then you'll need to change the syntax slightly to something like
these:
$ sudo sh -c 'echo 1 >/proc/sys/vm/drop_caches'
$ sudo sh -c 'echo 2 >/proc/sys/vm/drop_caches'
$ sudo sh -c 'echo 3 >/proc/sys/vm/drop_caches'
NOTE: There's a more esoteric version of the above command if you're
into that:
$ echo "echo 1 > /proc/sys/vm/drop_caches" | sudo sh
Why the change in syntax? The /bin/echo program is running as root,
because of sudo, but the shell that's redirecting echo's output to the root-
only file is still running as you. Your current shell does the
redirection before sudo starts.
Seeing what's in the buffers and cache
Take a look at linux-ftools if you'd like to analyze the contents of the
buffers & cache. Specifically if you'd like to see what files are currently
being cached.
fincore
With this tool you can see what files are being cached within a give
directory.
Swap
If you want to clear out your swap you can use the following commands.
$ free
total used free shared buffers
cached
Mem: 7987492 7298164 689328 0 30416
457936
-/+ buffers/cache: 6809812 1177680
Swap: 5963772 609452 5354320
Then use this command to disable swap:
$ swapoff -a
You can confirm that it's now empty:
$ free
total used free shared buffers
cached
Mem: 7987492 7777912 209580 0 39332
489864
-/+ buffers/cache: 7248716 738776
Swap: 0 0 0
And to re-enable it:
$ swapon -a
And now reconfirm with free:
$ free
total used free shared buffers
cached
Mem: 7987492 7785572 201920 0 41556
491508
-/+ buffers/cache: 7252508 734984
Swap: 5963772 0 5963772
Using the Job Control of bash to send the process into the background:
ps -aux
(or)
ps aux
Then identify the PID of the process for example. And put that number in the
PID field below.
Ever had a couple servers that although ILO was configured, the person who set it up had left and documented
have access to?
Fear not, at least if you can boot the box into some form of linux. It is trivial to reset the ILO credentials from L
running on an DL380 G6.
First, go to www.hp.com and download the Proliant Support Pack for your version of Linux and HP server.
It comes in a tar archive, extract it into a directory.
Make sure you have net-snmp installed on your server, if you don't, install it with `yum install net-snmp` or how
If you don't know for sure the user name, use hponcfg to retrieve your current ILO configuration (does not inclu
hponcfg -w currentcfg
In the xml file currentcfg, you will see a section that looks like:
<USER_INFO MODE="write">
<ADD_USER
USER_NAME = "Admin User"
USER_LOGIN = "AdminUser"
PASSWORD = "%user_password%">
<ADMIN_PRIV value = "Y"/>
<REMOTE_CONS_PRIV value = "Y"/>
<RESET_SERVER_PRIV value = "Y"/>
<VIRTUAL_MEDIA_PRIV value = "Y"/>
<CONFIG_ILO_PRIV value = "Y"/>
</ADD_USER>
</USER_INFO>
Note a user which has ADMIN_PRIV value of Y that you wish to reset.
Run hponcfg with the -f option specifying your xml. It will run and your ILO password should be reset.
hponcfg -f resetpw.xml
Redhat updated while registering the server
172.18.179.12:8081 (PDC/RDC)
LDC: 30.191.31.50:8080
FDC: 30.207.31.50:8080
SDC: 30.159.31.50:8080
cd /etc/yum.repos.d/
ll
vi RES6.repo
yum clean all
subscription-manager register
subscription-manager subscribe --auto
yum repolist
yum update --releasever=6.8
*****************************************************************
Core dump
https://www.suse.com/documentation/sles11/book_sle_tuning/data/cha_tuning
_kdump_basic.html
(11:21:53) Jackie Lam can now have full access to customer's computer.
#!/bin/sh
This document (7008279) is provided subject to the disclaimer at the end of this
document.
Environment
SUSE Linux Enterprise Server 11 (sles11)
SUSE Linux Enterprise Desktop 11 (sled11)
Support Pack 1 (sp1) may be installed.
Situation
GRUB boot loader is damaged for some reason and needs to be reinstalled.
Resolution
Boot to the SLED or SLES 11 DVD (the SP1 DVD is also fine), select "Rescue System" and
login as root. At the command line enter "grub" and follow this example:
******************
linux:~ # grub
grub> quit
******************
In this example the root partition is (hd0,0) as returned by the "find /boot/grub/stage1"
command. Use the correct root partition for your system as indicated by this command for the
two commands that follow the first one.
Reboot the system and GRUB should come up appropriately.
***************************************************************
for i in `cat servers`; do cmd $i df -Ph >>$i; echo $i >>Auto.master; cmd $i cat
/etc/auto.master | grep -v ^# >>Auto.master; echo " " >>Auto.master; echo
"****************************************" >>Auto.master; done
ggVGu
or uppercase
ggVGU
look at the command ggVG is used to select all the text if you want you can select the text
and use U or u to convert what was selected to uppercase or lowercase.
:%s/[A-Z]/\L&/g
or to uppercase (example)
:%s/[A-Z]/\U&/g
Controller status
/opt/hp/hpssacli/bin/hpssacli rescan
Enable smart array write cache when no battery is present (No-Battery Write Cache option)
*******************************************************************
SFTP-Passthru.
At the end of seesion, it wil show you the location where the file is copied.
Exit to kill sftp session
Run the following command on jump host to kill the sftp link
#/usr/local/bin/sftp-passthru-config –r
This document (7018716) is provided subject to the disclaimer at the end of this document.
Environment
By accident, existing volumes groups on a non mirrored or clustered device have been changed from a local
managed into a clustered state as shown by vgs output:
sles12sp2lvm:/etc/lvm # vgs -a
Skipping clustered volume group vg2
Skipping clustered volume group vg1
VG #PV #LV #SN Attr VSize VFree
system 1 1 0 wz--n- 25.75g 10.75g
to disable the affected volume groups and change the locking_type to 0. Then execute
vgchange -ay
cat details |perl -ne 'print unless (/^$/)'|perl -pe 's/^/ /'|perl -ne 'print unless
(/#####/)'|perl -pe 's/ \*\*\*/\*\*\*/'|perl -ne 'chomp;if (m/\*\*\*/) {print
"$_\n";} else { print " $_ "}'|curl -s -k --data-binary @-
'https://peplap02628.corp.pep.pvt/rest/utility/makecsv'
example
echo -e "DRAug2018\nDRAug2018" | passwd root
=I2+TIME(4,30,0)
zypper in lftp
cd /etc/alternatives/
rm ftp
ln -s /usr/bin/lftp ftp
sed -i 's/write_enable=NO/write_enable=YES/g' /etc/vsftpd.conf
systemctl restart vsftpd
*******************************************************************