Friday, April 20, 2012

SAN Storage : How To Remove LUN

I did this on SLES11, but i think it can be applied on other distro also.

1. Unmap the LUN from the SAN controller.
2. To list down the current mapped LUN : multipath -ll

360050768028082bde800000000000008 dm-2 IBM,2145
size=70G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 1:0:0:1 sdc 8:32 failed faulty running
| `- 2:0:0:1 sdg 8:96 failed faulty running
`-+- policy='round-robin 0' prio=0 status=enabled
|- 1:0:1:1 sde 8:64 failed faulty running
`- 2:0:1:1 sdi 8:128 failed faulty running

3. multipath -f (LUN Id)
regdb02:~ # multipath -f 360050768028082bde800000000000008

4. clean up the scsi device record :

regdb02:~ # echo "1" > /sys/class/scsi_device/1\:0\:0\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/2\:0\:0\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/1\:0\:1\:1/device/delete
regdb02:~ # echo "1" > /sys/class/scsi_device/2\:0\:1\:1/device/delete

5. list down back the mapped LUN :

regdb02:~ # multipath -ll
regdb02:~

* empty already

5. rescan the bus

regdb02:~ # cd /usr/bin/
regdb02:/usr/bin # ./rescan-scsi-bus.sh

Done

NTPD Error : Cannot update the dynamic configuration policy.

If you face this error during configuring ntpd server, here is the simple steps :

1. cat /etc/resolv.conf.netconfig
2. edit the /etc/resolv.conf and make it same with /etc/resolv.conf.netconfig
3. retry the ntpd configuration
4. change back /etc/resolv.conf to the old

We can trace the error when tailf /var/log/messages.

Thanks

How To Recover Lost Root Passwd on Linux Server (Using Rescue cd)

Situation

Lost or forgot the root password on Linux server

Resolution

  1. Boot server from the installation CD.
  2. Then select any installation method or Rescue System.
  3. At the first installation screen when selecting language, press ctrl-alt-f2 to open a virtual console.

    Note: If you selected Rescue System, select your keyboard language and then a Rescue Login prompt should appear. Login as root.

  4. Type
    fdisk -l
    to list the partitions. Locate the Linux root partition.
  5. Type
    mount /dev/sda4 /mnt
    (replace sda4 with the device name for the Linux root partition identified in the previous step).
  6. Run
    mount -o bind /dev /mnt/dev
    to make the device files available (this is needed for access to the urandom device which may be used by thepasswd command below).
  7. Enter
    chroot /mnt
  8. Now enter
    passwd root
    and reset the root password.
  9. Type
    exit
    to leave the chroot environment.
  10. Reboot the system.

How To Recover Lost Root Passwd on SLES or OpenSuse

It can be done many ways, but the easiest is by accessing single mode.

1. Need to reboot first.

2. Append boot option to single mode

If on other linux distribution, we can access to single mode by appending the kernel and type "single" and change the passwd after that.

But on SLES or OpenSuse, we need to add an parameter to boot option which is :

init=/bin/sh (refer to pic)




and dont forget to press enter.

3. After the single mode is loaded, kindly change passwd by using the "passwd" command

your-hostname:~ # passwd
Changing password for root.
New Password:

Reenter New Password:
Password changed.


4. Reboot and it was done successfully.