Friday, August 4, 2017

rescan the increased fc lun size in RHEL


[root@oxygen ~]# multipath -ll mpathb
mpathb (9mxD76oL/xPu9FBVIItP6wFFt9Y23/A7Lw73wOd9bLRb) dm-0 DGC,VRAID
size=200G features='1 queue_if_no_path' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| |- 1:0:1:1  sdk  8:160  active ready running
| `- 2:0:1:1  sdaa 65:160 active ready running
`-+- policy='round-robin 0' prio=0 status=enabled
  |- 1:0:0:1  sdc  8:32   active ready running
  `- 2:0:0:1  sds  65:32  active ready running
[root@oxygen ~]# echo 1 > /sys/block/sdk/device/rescan
[root@oxygen ~]# echo 1 > /sys/block/sdaa/device/rescan
[root@oxygen ~]# echo 1 > /sys/block/sdc/device/rescan
[root@oxygen ~]# echo 1 > /sys/block/sds/device/rescan
[root@oxygen ~]# multipathd -k
multipathd> resize map mpathb
ok
multipathd>
[root@oxygen ~]# multipath -ll mpathb
mpathb (9mxD76oL/xPu9FBVIItP6wFFt9Y23/A7Lw73wOd9bLRb) dm-0 DGC,VRAID
size=700G features='1 queue_if_no_path' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=1 status=enabled
| |- 1:0:1:1  sdk  8:160  active ready running
| `- 2:0:1:1  sdaa 65:160 active ready running
`-+- policy='round-robin 0' prio=0 status=enabled
  |- 1:0:0:1  sdc  8:32   active ready running
  `- 2:0:0:1  sds  65:32  active ready running
[root@oxygen ~]# pvs
  PV                   VG       Fmt  Attr PSize   PFree
  /dev/mapper/mpathb   datavg   lvm2 a--  200.00g      0
[root@oxygen ~]# pvresize  /dev/mapper/mpathb
  Physical volume "/dev/mapper/mpathb" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@oxygen ~]# pvs
  PV                   VG       Fmt  Attr PSize   PFree
  /dev/mapper/mpathb   datavg   lvm2 a--  700.00g 500.00g
Share:

Tuesday, June 13, 2017

boot RHEL7/Centos 7 in single user mode

if you want to boot into single user mode of RHEL7 or Centos 7 in order to reset root password or do any other recovery work. You can follow the steps below.

1. Boot or reboot the server
2. Go to Grub2 OS boot selection menu
3. press e to go into edit mode.
4. append init=/bin/sh to line starting with linux.
5. Press Ctrl+x to boot to shell prompt
6. Now you can remount root partition with rw option ( #mount -o remount,rw /)
7. then change the password using passwd command.
Share:

Friday, February 17, 2017

get list of memory consuming processes

the below two commands will provide you the processes which are consuming maximum memory on Linux machine.

#ps -A --sort -rss -o comm,pmem | head -10
#ps axu | awk '{print $2, $3, $4, $11}' | head -1 && ps axu | awk '{print $2, $3, $4, $11}' | sort -k3 -nr |head -10
Share:

Monday, January 16, 2017

logrotate config for syslogs

here is an example of logrotate script/config file I use for syslogs.

[root@oxygen ~]# cat /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron 
{
    rotate 5
    compress
    size 50M
    create 0600 root root
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
Share:

Copyright © playbook | Powered by Blogger

Design by Anders Norén | Blogger Theme by NewBloggerThemes.com