• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Friday, May 26, 2017

    Hot swapping a broken HDD with SOFTWARE (RAID 1) on HP blades

    Ideally with RAID 1, RAID 5, etc once can easily do a hot HDD swap as they support mirroring at the hardware level but to do the same on a software raid 1 becomes tricky as ideally an OS shutdown is needed to avoid any application impact during the HDD swap.



    But with the article I will show you the steps to perform online HDD swap in case any one of your disk drive is broken.

    hpssacli rpm can be downloaded from HPE webpage so for the sake of this article I will assume you already have downloaded and installed one on your blade.

    NOTE: hpssacli is renamed to ssacli recently due to the HPE name rebranding and split of the industry but since I had older version of hpssacli installed the commands would use 'hpssacli' but the same commands can be used with 'ssacli'

    My setup:
    1. HP Proliant BL460c Gen9
    2. Two Internal Disks each 900 GB
    3. Hardware RAID 0 is configured with two Array (each having one disk)
    4. Software RAID 1 is configured on top of these arrays
    Correct Disk Maps
    Normally the HDD to logical drive mapping is like below
    Array A -> Logical Drive 1 (/dev/sda) -> Bay 1
    Array B -> Logical Drive 2 (/dev/sdb) -> Bay 2

    But still it is good to validate the mapping before starting with the disk swap to make sure correct disk is replaced.
    # hpssacli ctrl slot=0  show config detail | grep 'Array:\|Logical Drive:\|Bay:\|Disk'
       Array: A
         
    Logical Drive: 1
             Disk Name: /dev/sda  
           Mount Points: None
             Bay: 1
       Array: B
          Logical Drive: 2
             Disk Name: /dev/sdb  
           Mount Points: None
             Bay: 2

    Reverse Disk Maps
    Array A -> Logical Drive 1 (/dev/sda) -> Bay 2
    Array B -> Logical Drive 2 (/dev/sdb) -> Bay 1

    Here the output would like below
    # hpssacli ctrl slot=0  show config detail | grep 'Array:\|Logical Drive:\|Bay:\|Disk'
       Array: A
          Logical Drive: 1
             
    Disk Name: /dev/sda          Mount Points: None
             Bay: 2

       Array: B
          Logical Drive: 2
             Disk Name: /dev/sdb          Mount Points: None
             Bay: 1

    How to check if my disk is faulty?

    There are multiple locations (logs) where enough evidence can be collected to get more details on the faulty disk.

    On the iLO logs below message would be available
    Right Disk:
    Internal Storage Enclosure Device Failure (Bay 1, Box 1, Port 1I, Slot 0)
    Left Disk:
    Internal Storage Enclosure Device Failure (Bay 2, Box 1, Port 1I, Slot 0)
    The Syslog of the OS should contain below messages (assuming hp-ams tool is installed as they report all the hardware relaed alarms)

    Right Disk:
    Aug 27 07:27:31 mylinux hp-ams[12332]: CRITICAL: Internal Storage Enclosure Device Failure (Bay 1, Box 1, Port 1I, Slot 0)
    Left Disk:
    Aug 27 21:36:29 mylinux hp-ams[12854]: CRITICAL: Internal Storage Enclosure Device Failure (Bay 2, Box 1, Port 1I, Slot 0)
    One can also check the Logical Drive status using below command

    Logical Drive 1 Failed Status
    my-linux-box: # hpssacli ctrl slot=0 ld all show status

       
    logicaldrive 1 (838.3 GB, 0): Failed
       logicaldrive 2 (838.3 GB, 0): OK

    Logical Drive 2 Failed Status
    my-linux-box: # hpssacli ctrl slot=0 ld all show status

       logicaldrive 1 (838.3 GB, 0): OK
       
    logicaldrive 2 (838.3 GB, 0): Failed


    Logical Drive 1 (/dev/sda) Replacement

    Check the raid status
    # cat /proc/mdstat
    Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md2 : active raid1
    sda8[0](F) sdb8[1]
          870112064 blocks super 1.0 [2/1]
    [_U]
          bitmap: 1/7 pages [4KB], 65536KB chunk

    md0 : active raid1 sda5[0] sdb5[1]
          529600 blocks super 1.0 [2/2] [UU]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md3 : active raid1 sda7[0] sdb7[1]
          4200640 blocks super 1.0 [2/2] [UU]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md1 : active raid1 sda6[0] sdb6[1]
          4200640 blocks super 1.0 [2/1] [UU]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    Manually set the remaining partition as fail
    my-linux-box:~ # mdadm /dev/md0 --fail /dev/sda5
    mdadm: set /dev/sda5 faulty in /dev/md0

    my-linux-box:~ # mdadm /dev/md1 --fail /dev/sda6
    mdadm: set /dev/sda6 faulty in /dev/md1

    my-linux-box:~ # mdadm /dev/md3 --fail /dev/sda7
    mdadm: set /dev/sda7 faulty in /dev/md3




    Next re validate the raid status
    # cat /proc/mdstat
    Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md2 : active raid1
    sda8[0](F) sdb8[1]
          870112064 blocks super 1.0 [2/1] [_U]
          bitmap: 3/7 pages [12KB], 65536KB chunk

    md0 : active raid1 sda5[0](F) sdb5[1]
          529600 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    md3 : active raid1 sda7[0](F) sdb7[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md1 : active raid1 sda6[0](F) sdb6[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    unused devices: <none>

    Now remove the failed raid partition
    my-linux-box:~ # mdadm /dev/md0 --remove /dev/sda5
    mdadm: hot removed /dev/sda5 from /dev/md0

    my-linux-box:~ # mdadm /dev/md1 --remove /dev/sda6
    mdadm: hot removed /dev/sda6 from /dev/md1

    my-linux-box:~ # mdadm /dev/md3  --remove /dev/sda7
    mdadm: hot removed /dev/sda7 from /dev/md2

    my-linux-box:~ # mdadm /dev/md2 --remove /dev/sda8
    mdadm: hot removed /dev/sda8 from /dev/md3

    Next check the raid status to validate if all the failed partition have been removed
    # cat /proc/mdstat
    Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md2 : active raid1 sdb8[1]
          870112064 blocks super 1.0 [2/1]
    [_U]
          bitmap: 3/7 pages [12KB], 65536KB chunk

    md0 : active raid1 sdb5[1]
          529600 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    md3 : active raid1 sdb7[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md1 : active raid1 sdb6[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    unused devices: <none>

    Replace the failed disk with the new one, the syslog should contain similar message as to below
    Aug 18 15:53:12 my-linux-box kernel: [ 8365.422069] hpsa 0000:03:00.0: added scsi 0:2:0:0: Direct-Access     HP       EG0900FBVFQ      RAID-UNKNOWN SSDSmartPathCap- En- Exp=2 qd=30
    Re-enable the logical drive using  hpssacli

    After re-enabling the logical drive, its required to verify the status which should return “OK”.
    my-linux-box: # hpssacli ctrl slot=0 ld 1 modify reenable forced

    my-linux-box:# hpssacli ctrl slot=0 ld all show status

       
    logicaldrive 1 (838.3 GB, 0): OK
       logicaldrive 2 (838.3 GB, 0): OK

    sdax is now missing from RAID as expected.
    # cat /proc/mdstat
    Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md2 : active raid1 sdb8[1]
          870112064 blocks super 1.0 [2/1] [_U]
          bitmap: 5/7 pages [20KB], 65536KB chunk

    md0 : active raid1 sdb5[1]
          529600 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    md3 : active raid1 sdb7[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md1 : active raid1 sdb6[1]
          4200640 blocks super 1.0 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    unused devices: <none>

    Now copy partition table from sdb to sda.
    my-linux-box:~ # sfdisk -d /dev/sdb | grep -v ten | sfdisk /dev/sda –force –no-reread
    Checking that no-one is using this disk right now ...
    Warning: extended partition does not start at a cylinder boundary.
    DOS and Linux will interpret the contents differently.
    OK

    Disk /dev/sda: 109437 cylinders, 255 heads, 63 sectors/track
    Warning: extended partition does not start at a cylinder boundary.
    DOS and Linux will interpret the contents differently.
    Old situation:
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

       Device Boot Start     End   #cyls    #blocks   Id  System
    /dev/sda1   *      0+ 109437- 109438- 879054336    f  W95 Ext'd (LBA)
    /dev/sda2          0       -       0          0    0  Empty
    /dev/sda3          0       -       0          0    0  Empty
    /dev/sda4          0       -       0          0    0  Empty
    /dev/sda5          0+     66-     66-    529664   fd  Linux raid autodetect
    /dev/sda6         66+    588-    523-   4200704   fd  Linux raid autodetect
    /dev/sda7        589+   1111-    523-   4200704   fd  Linux raid autodetect
    /dev/sda8       1112+ 109435- 108324- 870112256   fd  Linux raid autodetect
    New situation:
    Units = sectors of 512 bytes, counting from 0

       Device Boot    Start       End   #sectors  Id  System
    /dev/sda1   *       512 1758109183 1758108672   f  W95 Ext'd (LBA)
    /dev/sda2             0         -          0   0  Empty
    /dev/sda3             0         -          0   0  Empty
    /dev/sda4             0         -          0   0  Empty
    /dev/sda5          1024   1060351    1059328  fd  Linux raid autodetect
    /dev/sda6       1060864   9462271    8401408  fd  Linux raid autodetect
    /dev/sda7       9462784  17864191    8401408  fd  Linux raid autodetect
    /dev/sda8      17864704 1758089215 1740224512  fd  Linux raid autodetect
    Warning: partition 1 does not end at a cylinder boundary
    Successfully wrote the new partition table

    Re-reading the partition table ...

    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)

    Erase possible RAID config data ( from a reused disk)



    After doing this it is important that possible remaining old SW RAID metadata has to be removed from the new attached disk before it is re-added to the RAIDs.
    my-linux-box:~ # mdadm --zero-superblock /dev/sda5

    my-linux-box:~ # mdadm --zero-superblock /dev/sda6

    my-linux-box:~ # mdadm --zero-superblock /dev/sda7

    my-linux-box:~ # mdadm --zero-superblock /dev/sda8

    Afterwards the logical volumes can be added again to the SW RAIDs.
    my-linux-box:~ # mdadm /dev/md0 --add /dev/sda5
    mdadm: added /dev/sdb5

    my-linux-box:~ # mdadm /dev/md1 --add /dev/sda6
    mdadm: added /dev/sdb6

    my-linux-box:~ # mdadm /dev/md3 --add /dev/sda7
    mdadm: added /dev/sdb7

    my-linux-box:~ # mdadm /dev/md2 --add /dev/sda8

    NOTE: Add individual raid partition only once the last added shows as [UU]

    How to install GRUB on the disk?

    Once md0 has synchronised the grub should be installed again on both disks calling the grub installer.
    Finally use the command grub-install which should without error message install the grub on both disks (hd0 and hd1).
    # grub-install


        GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

     [ Minimal BASH-like line editing is supported.  For the first word, TAB
       lists possible command completions.  Anywhere else TAB lists the possible
       completions of a device/filename. ]
    grub> setup --stage2=/boot/grub/stage2 --force-lba (hd0) (hd0,4)
     Checking if "/boot/grub/stage1" exists... yes
     Checking if "/boot/grub/stage2" exists... yes
     Checking if "/boot/grub/e2fs_stage1_5" exists... yes
     Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  17 sectors are embedded.
    succeeded
     Running "install --force-lba --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,4)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
    Done.
    grub> setup --stage2=/boot/grub/stage2 --force-lba (hd1) (hd1,4)
     Checking if "/boot/grub/stage1" exists... yes
     Checking if "/boot/grub/stage2" exists... yes
     Checking if "/boot/grub/e2fs_stage1_5" exists... yes
     Running "embed /boot/grub/e2fs_stage1_5 (hd1)"...  17 sectors are embedded.
    succeeded
     Running "install --force-lba --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,4)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
    Done.
    grub> quit

    Finally validate the raid status
    # cat /proc/mdstat
    Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md2 : active raid1 sda8[2] sdb8[1]
          870112064 blocks super 1.0 [2/2]
    [UU]
          bitmap: 6/7 pages [24KB], 65536KB chunk

    md0 : active raid1 sda5[2] sdb5[1]
          529600 blocks super 1.0 [2/2] [UU]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    md3 : active raid1 sda7[2] sdb7[1]
          4200640 blocks super 1.0 [2/2] [UU]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    md1 : active raid1 sda6[2] sdb6[1]
          4200640 blocks super 1.0 [2/2] [UU]
          bitmap: 0/1 pages [0KB], 65536KB chunk

    unused devices: <none>


     Similarly the disk replacement can be performed for second logical drive.

    I hope the article was useful.

    Related Articles:
    Collect Virtual Connect Support Dump of HP c-Class Blade Enclosures
    How to collect/generate "Show All" report for HP c-Class Blade Enclosures
    How to downgrade HP Emluex CNA NIC card firmware version

    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux

    Thursday, May 25, 2017

    Collect Virtual Connect Support Dump of HP c-Class Blade Enclosures

    In my last article I showed the steps needed to collect Onboard Administrator and Virtual Connect Show All report.

    In this article I will show you the steps to collect Virtual Connect Support Dump from HP c-Class Enclosures.


    To collect the VC SupportDump you would need Virtual Connect Support Utility i.e. vcsu. You can download the vcsu tool from official HPE page depending upon the platform where it has to be installed.



    Below is a link where you can get vcsu 1.12.0 for Windows platform
    vcsu-1.12.0
    NOTE: This link will take you to a third party website

    Once downloaded install it in your system, make sure the user has administrative privilege over the desktop/laptop where vcsu is being installed.

    Next navigate to the below folder.
    C:\Program Files (x86)\Hewlett Packard Enterprise\Virtual Connect Support Utility

    The above location may vary depending upon the vcsu version and architecture.

    Here click "VCSU-CommandPrompt.cmd" or open a "command prompt" by clicking "Shift + Right mouse (touchpad) button" and select "Open command window here" as shown below

    And type the below command in the provided syntax on the command window



    Syntax:
    vcsu -a supportdump -i <Active_OA_IP> -u HPadmin -p <OA_HPadmin_Password> -vcu HPadmin -vcp <VC_HPadmin_Password>
    For eg:
    C:\Program Files (x86)\Hewlett Packard Enterprise\Virtual Connect Support Utility>vcsu -a supportdump -i 192.168.0.100 -u HPadmin -p Passw0rd -vcu HPadmin -vcp
    Passw0rd

    -------------------------------------------------------------------------------
     HPE BladeSystem c-Class Virtual Connect Support Utility
     Version 1.12.0 (Build 16)
     Build Date: Mar 29 2016 07:18:21
     Copyright (C) 2006-2016 Hewlett Packard Enterprise Development LP
     All Rights Reserved
    -------------------------------------------------------------------------------

    SUCCESS: Support dump file downloaded and saved

    Total execution time: 00:03:34

    VCSU log file is available at the following location:
    C:\Users\deeprasa\AppData\Local\Temp\vcsu-2076.log

    The support dump is stored inside "C:\Users\deepak\AppData\Local\Temp\" as below
    vcSupportInfo-Deepak_domain-201705211708

    NOTE: The same command can be used on a Linux platform assuming vcsu rpm is installed to collect the VC Support Dump.

    I hope the article was useful.



    Related Articles:
    How to downgrade HP Emluex CNA NIC card firmware version

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    What is virtual memory, paging and swap space?
    10 examples to help you understand top command usage in Unix/Linux

    Monday, May 22, 2017

    How to collect/generate "Show All" report for HP c-Class Blade Enclosures

    There are multiple methods to generate "SHOW ALL" report of Onboard Administrator and Virtual Connect of a HP C-Class Enclosure.


    A Show All report would be the first thing requested by HPE engineers to debug a case or issue observed on the enclosure or blades.

    How to collect OA Show All report using OA GUI?

    Login to Onboard Administration GUI using a browser having java.

    Next navigate to "Enclosure Settings" -> "Configuration Scripts" under "Systems and Devices" as shown below

    Click on "SHOW ALL" which will generate the report on a new TAB of the browser.
    NOTE: It may take some time for the complete report to get generated


    How to collect OA Show All report using vcsu?

    VCSU stands for virtual connect support utility. This can be used to collect OA as well as Virtual Conect (VC) Show All report and the same can be used on Linux as well as Windows platform.

    Download vcsu using the below link for Windows Platform
    vcsu-1.12.0

    NOTE: This link takes you to a third party website.

    Install the vcsu utility on your laptop/desktop and navigate to the below folder.
    C:\Program Files (x86)\Hewlett Packard Enterprise\Virtual Connect Support Utility

    The above location may vary depending upon the vcsu version and architecture.

    Here click "VCSU-CommandPrompt.cmd" or open a "command prompt" by clicking "Shift + Right mouse (touchpad) button" and select "Open command window here" as shown below

    And type the below command in the provided syntax on the command window

    Syntax:
    vcsu -a  collect -i <OA_IP> -u HPadmin -p <OA_HPadmin_Password> -vcu HPadmin -vcp <VC_HPadmin_Password>
    For eg:
    vcsu -a  collect -i 192.168.0.100 -u HPadmin -p Passw0rd -vcu HPadmin -vcp Passw0rd

    C:\Program Files (x86)\Hewlett Packard Enterprise\Virtual Connect Support Utility>vcsu -a  collect -i 192.168.0.100 -u HPadmin -p Passw0rd -vcu HPadmin -vcp Passw0rd

    -------------------------------------------------------------------------------
     HPE BladeSystem c-Class Virtual Connect Support Utility
     Version 1.12.0 (Build 16)
     Build Date: Mar 29 2016 07:18:21
     Copyright (C) 2006-2016 Hewlett Packard Enterprise Development LP
     All Rights Reserved
    -------------------------------------------------------------------------------

    SUCCESS: Collect information saved

    Total execution time: 00:04:53

    VCSU log file is available at the following location:
    C:\Users\deeprasa\AppData\Local\Temp\

    The logs are stored inside "C:\Users\deepak\AppData\Local\Temp\" with below names
    vcmShowAll.txt
    oaShowAll.txt

    NOTE: Using this tool you can generate both OA and VC Show All reports and using the same commands the reports can be generated using a Linux platform.

    I hope the article was useful.

    Related Articles:
    How to downgrade HP Emluex CNA NIC card firmware version

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    What is virtual memory, paging and swap space?
    10 examples to help you understand top command usage in Unix/Linux


    Sunday, May 21, 2017

    How to forcefully stop and kill a process in Linux

    There are times when a process hangs or is responding very late when you feel like killing the process. The ultimate solution is to find the process id of the respective process and kill the same but below list of steps can also be used.

    How to forcefully stop a process?

    You can use "Ctrl + Z" to forcefully stop a process as used below
    # yum whatprovides */python-deltarpm
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Repository RHEL is listed more than once in the configuration
    RHEL                                                   | 2.9 kB  00:00:00
    RHEL/primary_db                                        | 3.7 kB  00:00:00
    RHEL/filelists_db                                      | 2.2 kB  00:00:00
    No matches found
    ^Z
    [1]+  Stopped                 yum whatprovides */python-deltarpm

    Now stopping this way does not means that the process is killed. If I see list of process
    # ps aux | grep -i yum
    root     10511  2.8  1.7 422324 71476 pts/2    T    19:09   0:00 /usr/bin/python /usr/bin/yum whatprovides */python-deltarpm
    Here as we see the stat shows "T" which means stopped.

    How do we list stopped processes?

    By executing "jobs" command as below
    # jobs
    [1]+  Stopped                 yum whatprovides */python-deltarpm

    This command will list you all the process which are in stopped state

    How to kill a stopped process?

    Here we need to use the identifier which is assigned to each stopped process. Here in our case as we see the identifier is [1]

    So the command to kill this particular process would be
    # kill %1

    [1]+  Stopped                 yum whatprovides */python-deltarpm

    Immediately now if I try to see the list of available stopped processes
    # jobs
    [1]+  Exit 1                  yum whatprovides */python-deltarpm

    Here now it is trying to Exit as we see above

    Again after few seconds if I give the same command
    # jobs
    No output so I do not have any stopped processes

    I hope this article was useful.

    Related Articles

    Follow the below links for more tutorials

    How to secure boot loader (grub menu) with password in RHEL 6
    How to check last login time for users in Linux
    What is the difference/comparison between Unix and Linux ?
    RAID levels 0, 1, 2, 3, 4, 5, 6, 0+1, 1+0 features explained in detail
    Step by Step Linux Boot Process Explained In Detail
    What is GRUB Boot Loader ?
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    How to do Ethernet/NIC bonding/teaming in Red Hat Linux
    How to install/uninstall/upgrade rpm package with/without dependencies
    What is the difference between ext3 and ext4 filesystem in Linux ?

    How to save %pre installation log file after installation in Red Hat 7

    We intend to write multiple scripts in the %pre and %post section of the kickstart files as per our requirement but since these scripts are executed in the background it is very important that we perform proper logging of individual section so that once the node is successfully installed those logs can be validated to make sure all the scripts were successfully executed and to debug further in case of failure.

    How to enable logging of %pre and %post scripts in kickstart?

    Below syntax can be used to enable the logging of individual %pre and %post section in a kickstart file
    %pre --log=/var/log/kickstart_pre1.log
    echo "Hello World"
    echo "This is first pre-installation script"
    %end

    %pre --log=/var/log/kickstart_pre2.log
    echo "Hello World"
    echo "This is second pre-installation script"
    %end


    %post --log=/var/log/kickstart_post1.log
    echo "Hello World"
    echo "This is first post-installation script"
    %end

    %post --log=/var/log/kickstart_post1.log
    echo "Hello World"
    echo "This is second post-installation script"
    %end

    How to store %pre section logs to be accessible after complete Red Hat Installation?

    Now this is the tricky part as all the logs stores for %post section would be accessible after a node is successfully installed but we have to take some extra steps to save the %pre script log files

    Since %post section is by default executed in chroot environment write an additional %post script as below to save both your %pre log files we used above

    %post --log=/var/log/kickstart_post_3.log --nochroot
    echo "Copying %pre installation script log files
    /bin/cp -rvf /var/log/kickstart_pre*.log /mnt/sysimage/var/log/
    %end

    So once your node is successfully installed check "/var/log" for your both the kickstart_pre*.log files and the %post section log files

    I hope the article was helpful.

    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux

    How to perform interactive kickstart installation on Red Hat

    Kickstart is used to perform an automated installation where no manual intervention would be needed but there are times when we want the end user to fill in some needed details for eg keyboard type, network details etc so kickstart must wait and prompt for these information before the installation is completed.

    Here I have written an article to automate a customized DVD installation using kickstart file

    Now suppose in the same DVD installation you want the installation to halt and prompt for network.

    This can be done using the %pre and %post installation scripts from the kickstart file.
    # vim ks.cfg
    ---
    ---
    ---
    
    # Network Information
    %include /tmp/network.ks
    --
    --
    --
    
    # Create a %pre section as below
    %pre --interpreter=/usr/bin/bash
    exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
    chvt 6
    
     read -p "Enter INS hostname    : " HOSTNAME
     read -p "Enter IP Address      : " IPADDR
     read -p "Enter NetMask         : " NETMASK
     read -p "Enter Gateway         : " GATEWAY
    echo
    sleep 1
    
    echo "network --bootproto=static --hostname=$HOSTNAME --device=eth0 --gateway=$GATEWAY --ip=$IPADDR --netmask=$NETMASK --noipv6 --nodns --onboot=on --activate" > /tmp/network.ks
    
    chvt 1
    exec < /dev/tty1 > /dev/tty1 2> /dev/tty1
    %end
    
    Here we are halting the automated installation, switching to terminal 6 and prompting user for hostname and network details and the same is populated into "/tmp/network.ks"

    which is added as in the ks,cfg
    %include /tmp/network.ks
    so kickstart will collect this input and store it in the ks.cfg. Once ks.cfg gets all the needed information we have to again switch back the console to tty1 where the actual installation was happening so we do it using the last two lines before %end.

    I have used these steps in Red Hat 6 and 7 and seems to work very well.


    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux