LUN scan and resize operations with multipath on Ubuntu 12.04

Here are some quick tips to discover newly attached LUNs or to rescan resized LUNs:

Scan to discover a newly attached LUN:

  1. for i in `ls /sys/class/fc_host`; do echo 1 > /sys/class/fc_host/${i}/issue_lip; done

Rescan resized LUN:

  1. Find the path of your LUN:
    multipath -l
  2. Execute following command to rescan your drives. Replace “dm-42” by the path you previously found:
    for i in `ls /sys/block/dm-42/slaves/`; do echo 1 > /sys/block/${i}/device/rescan ; done
  3. Resize multipath device. Replace “dm-42” by the path you previously found:
    multipathd -k'resize map dm-42'
  4. Resize the filesystem according to your needs.

Install Data Protector Disk Agent on Linux

Some quick notes to install Data Protector – Disk Agent on your Linux server.

  1. Install dependencies :
    • Ubuntu : sudo apt-get install xinetd rpm
    • CentOS / Red Hat : yum install xinetd
  2. Download required software from HP.  I’m using Data Protector 6.20.
  3. Untar file : tar -zxvf ESD_HP_DP_6.2_for_HP_UX_TD586_15001_01.tar.gz
  4. cd ESD_HP_UX_TD586_15001_01/TD586-15001-01/LOCAL_INSTALL
  5. Perform installation : ./omnisetup.sh -install da
  6. If required open ports on you server (for agent, backups, etc.
    • Backup Agent : 5555 (default)
    • Port range used by Data Protector : 6000-6050 (our configuration)
    • N.B.  To limit the range of port used by Data Protector, you need to edit the “omnirc” file, both on the cell manager and the client and add the line : OB2PORTRANGE=6000-6050

How to use SSH keys on linux : quick tips

By using SSH keys, you can easily and securely connect to one or multiple servers without having to type your password every time.  I’m assuming you already have and use openssh.  I’m using following procedure on Red Hat, Debian and Ubuntu servers.  You can also generate key pairs on Windows host with the puttygen.exe tool.

To generate a key of 4096 bits using RSA protocol version 2, type :

$ ssh-keygen -t rsa -b 4096

Generating public/private rsa key pair.
Enter file in which to save the key (/home/beset/.ssh/id_rsa): /home/beset/.ssh/id_beset  (I suggest you use a more descriptive name if you think you will need more than one key pair)
Enter passphrase (empty for no passphrase):  (I highly recommend you use a passphrase to protect your private key)
Enter same passphrase again:
Your identification has been saved in /home/beset/.ssh/beset.
Your public key has been saved in /home/beset/.ssh/beset.pub.
The key fingerprint is:
67:96:b1:b3:10:18:d9:eb:7f:fc:bf:87:a1:62:65:8c beset@carbon
The key's randomart image is:
+--[ RSA 4096]----+
|      .o         |
|      .o.        |
|      . ...      |
|        .. +     |
|       .S Bo     |
|        .=Eo+ .  |
|         ..+ . o |
|          + + . .|
|         . o ..o+|
+-----------------+

Two files will be generated in your local ~/.ssh folder, in this example : id_beset (private key) and id_beset.pub (public key).

To make things work, you have to copy the content of the public key file in the ~/.ssh/authorized_keys of the remote user on the remote server.

You can copy the key manually, or use the command :
ssh-copy-id -i ~/.ssh/id_beset.pub myUser@remoteHost

If you want to specify a port, you have to use quotes :
ssh-copy-id '-p4456 -i ~/.ssh/id_beset.pub myUser@remoteHost'

You should now be able to connect without having to type your password.  If it doesn’t work, you should look at the /var/log/auth.log (or /var/log/secure) for clues…  Usually, you will have to check permissions of .ssh folder (700) and public key (600) on remote host.

Finally, if you use many key pairs, verify the authorized_keys file of the remote server since ssh-copy-id has the annoying habit of copying all public keys instead of only the specified one…

Have fun!