Sunday, October 9, 2011

How to export and import a Volume Group

From the source Server do the these steps

unmount the filesystem(s) of the VG you want to export
umount /test (Ex. /test is the mount point)
vgchange -a n vg-test
vgexport -p -m vg-test.map vgtest (To preview and create the mapfile. To export omit -p)

on the New Server

ioscan –fnC disk (To find new disk entries)
insf –d sdisk (To install the disk device files)
ll /dev/*/group (To see what minor numbers have already been used)
mkdir /dev/vg-test (To create the directory)
mknod /dev/vgx/group c 64 0x00000 (To create the device file)
vgimport -m /dev/dsk/cxtxdx /dev/dsk/cxtxdx (To import the volume group)
vgchange -a y (to activate the volume group)
mkdir /test
and mount /dev/vg-test/lvxx /test

How to Configure DNS in HPUX

Create Primary DNS Server

1. Get your IP numbers for Primary and Secondary DNS first.

2. Create a list of host names and correspondence IP addresses in /etc/hosts file

3. #mkdir /etc/named.data

4. #cd /etc/named.data

5. Create a file named param that will be used by hosts_to_named to create DNS data files

Ex. -d boota.com
-n 192.168.3
-z 192.168.3.10
-b /etc/named.boot
-s
(-d = domain name, -n = network number, -z = configuration file for secondary server and IP no. of
primary server to download data files, -b for boot files used by named process, -s adds a name server
(NS) resource record in configuration file.

6. #hosts_to_named –f param

7. download the db.cache file from internet copy it to /etc/named.data directory

8. modify /etc/rc.config.d/namesvrs file (NAMED=1) to start named process automatically with m/c
boots

9. /sbin/init.d/named start
Create Secondary DNS Server

1. #mkdir /etc/named.data

2. copy boot.sec file as /etc/named.boot from the primary server if you don’t have much disk space.
or
copy boot.sec.save file as /etc/named.boot if you have much space to keep database file.

3. copy db.127.0.0 from the primary server to /etc/named.data directory

4. copy db.cache from the primary server to the /etc/named.data directory

5. if you want to create local database files download the remaining files from /etc/named.data from primary server to local /etc/named.data directory.

6. update the /etc/rc.config.d/namesvrs file to start named at boot time.

7. start named using /sbin/init.d/named start
Create Caching DNS Server

1. #mkdir /etc/named.data
2. copy named.cacheonly from primary sever as /etc/named.boot
3. copy db.127.0.0 from primary server to /etc/named.data directory
4. copy db.cache from primary server to /etc/named.data directory
5. update the /etc/rc.config.d/namesvrs file to start named at boot time
6. start named /sbin/init.d/named start command

Configuring DNS client

1. edit /etc/nssswitch.conf file & enter
hosts: dns files

2. edit /etc/resolve.conf and enter the name servers
Ex. search xyz.com
nameserver 192.168.3.10
nameserver 192.168.3.12

Updating Database files on Primary Server
1. edit and update /etc/hosts file on primary server
2. # cd /etc/named.data
3. run to regenerate database files
4. # hosts_to_named -f param
5. reload using “sig_named restart” command

Setting UP Quota on HPUX

Setting UP Quota on HPUX

• Mount the file system

# mount /dev/vg01/lvol4 /home

# cpset /dev/null /home/quotas 600 root bin ( empty file created with at the root of file system with owner root grp bin permission for
root)

# /usr/sbin/edquota user

• type the following to limit
fs /home blocks ( soft = 10000, hard=12000) inodes ( soft = 200, hard = 300 )

• to set the time limit
# edquota –t username

• type following
fs /home blocks time limit = 10.00 days, files time limit = 15.00 days

• turn on quotas
#quotaon –v /home

• check the file system for quota
#quotacheck /dev/vg02/lvol3

• report the quotas
#repquota /home

• report the summary of qwnership
#quot /home

• report individuals
#/usr/bin/quota –v

SSH: Convert OpenSSH to SSH2 and vise versa

SSH: Convert OpenSSH to SSH2 and vise versa

Connecting two server running different type of SSH can be nightmare if you does not know how to convert the key. In this tutorial, I will try to explain on how to convert the public key from OpenSSH to SSH2 and SSH2 to OpenSSH. To convert the key, it must be done in OpenSSH server.

Convert OpenSSH key to SSH2 key

• Run the OpenSSH version of ssh-keygen on your OpenSSH public key to convert it into the format needed by SSH2 on the remote machine. This must be done on the system running OpenSSH.

#ssh-keygen -e -f ~/.ssh/id_dsa.pub > ~/.ssh/id_dsa_ssh2.pub
Convert SSH2 key to OpenSSH key

• Run the OpenSSH version of ssh-keygen on your ssh2 public key to convert it into the format needed by OpenSSH. This needs to be done on the system running OpenSSH.

#ssh-keygen -i -f ~/.ssh/id_dsa_1024_a.pub > ~/.ssh/id_dsa_1024_a_openssh.pub
Steps involved to produce and convert the keys.

OpenSSH

To generate an OpenSSH sshv2 key

$ ssh-keygen -t dsa -f newkey
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in newkey.
Your public key has been saved in newkey.pub.
The key fingerprint is:
c6:db:3a:ff:4c:79:a7:d8:cb:be:82:e8:9d:db:8c:e9 brad@eta
To export to ssh.com

$ ssh-keygen -e -f newkey.pub
—- BEGIN SSH2 PUBLIC KEY —-
Comment: “1024-bit DSA, converted from OpenSSH by brad@eta”
AAAAB3NzaC1kc3MAAACBAJ7QKkrLoOE9TNPVmKVedk1GAr/S+Cruq3/GtjRnxvJqbBbfne
lWYUC+vbHc5a+7bgRsQfCgoCeGKH5wGD4CDWQMhy2XYomnGf1gUC86Hq77/Noqa02N441E
FSTIEoNlU2aYi8zwVQKlgP6e22mG9sK7zSaGX639ctaigHuST8qPAAAAFQC2az8dfxHkkD
ZAEw+RcvRn3cpXFQAAAIEAgYpPs6d+Kyw37ZaBarlMEaZoEfrxhUZ44SN+KoqBZYpSVwyH
J+/RB0zVUizXCmZ5RhYSsYZ57Iixx1bBmBxogaEh5d7xxUpg/9Xctf94Jsf7vxccjZ4XYA
RrVikq/0L9fuKOmo4ET9iAf+GL7w2u5gzxxZr+xX5jw/A7907lOCwAAACAMoHHk0o1XkG+
yeaPtuwbrHshGqTjpOUkJ/AYuQ8OBuVAOdqse1di9JpeHko26G0zoH3N+nDHMGdYYTNHzR
NYRd2q20ztcAP52crZo1rtpNdvs6c+RTEIgoP3oYh1e1+rg70tWKIW3R/NYB39CESHoyqs
AJ7vzOPm0iUOd36YECY=
—- END SSH2 PUBLIC KEY —-

SSH

To generate a key:
$ ssh-keygen
Generating 2048-bit dsa key pair

1 oOo.oO
Key generated.
2048-bit dsa, marshalb@obelix.cqu.edu.au, Tue Jul 15 2003 13:53:34 +1000
Passphrase :
Again :
Private key saved to /usr/users/staff/m/marshalb/.ssh2/id_dsa_2048_b
Public key saved to /usr/users/staff/m/marshalb/.ssh2/id_dsa_2048_b.pub

To convert from ssh.com to OpenSSH (using OpenSSH ssh-keygen):

$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Bg
t6zd6mm/zKD6OZo14BLSJr7ldwSRzNNYMtkLnNyFSYxAIrm9Y=

You can then use the output in authorized_keys file on an openssh box.

OpenSSH v2 -> SSH v2

On the OpenSSH box, create a DSA key via the following:

$ ssh-keygen -t dsa
Export the key into ssh.com v2 format:

$ ssh-keygen -e -f ~/.ssh/id_dsa.pub > newPubKey
Copy the converted ssh key to the ssh.com server
$ scp newPubKey server:.ssh2/id_dsa.pub
On the server, tell the ssh.com server that the public key is allowed:
echo “Key id_dsa.pub” >> ~/.ssh2/authorization
SSH v2 -> OpenSSH v2
On the ssh.com box, generate a DSA key:

$ ssh-keygen
Copy the generated key to the openssh box:

$ scp ~/.ssh2/id_dsa_1024_a.pub server:.ssh

Convert the public key to openssh format and append to authorized_keys:

$ ssh-keygen -i -f id_dsa_1024_a.pub >> ~/.ssh/authorized_keys
On the ssh.com box setup the private key:

$ echo “IdKey id_dsa_1024_a” >> ~/.ssh2/identification
SSH v2 -> SSH v2
On the ssh.com client, generate a DSA key:

$ ssh-keygen

Copy the generated key to the server:

$ scp ~/.ssh2/id_dsa_1024_a.pub server:.ssh2
On the server, tell the ssh.com server that the public key is allowed:

$ echo “Key id_dsa._1024_a.pub” >> ~/.ssh2/authorization
On the ssh.com client setup the private key:

$ echo “IdKey id_dsa_1024_a” >> ~/.ssh2/identification
OpenSSH v2 -> OpenSSH v2

On the OpenSSH box, create a DSA key via the following:
$ ssh-keygen -t dsa

Copy the ssh key to the server

$ scp ~/.ssh/id_dsa.pub server:.ssh/id_dsa.pub

Add the key to the authorized_keys file on the server
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

A quick guide to extend an LVM using OnlineJFS

A quick guide to extend an LVM with a VXFS Filesystem.

1. Verify OnLineJFS is installed

# swlist -l product | grep -i vxfs
# swlist -l product | grep -i online
Look for OnlineJFS or AdvJournalFS

2. It is a good practice to defrag the filesystem first before extending

# fsadm -d - D -e - E /mountpoint

3. Determine the Logical Volume where the filesystem is mounted.
# bdf /mountpoint
Example:[root@gmhpux02:/root]
# bdf /var/adm/crash

Filesystem kbytes used avail %used Mounted on
/dev/vg00/lv_crash 5357568 2266637 2897770 44% /var/adm/crash

4. Obtain the current size of the Logical Volume (Mbytes)
# lvdisplay /dev/volumegroup/logicalvolume
Example:
[root@gmhpux02:/root]
# lvdisplay /dev/vg00/lv_crash
--- Logical volumes ---
LV Name /dev/vg00/lv_crash
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 5232
Current LE 327
Allocated PE 654
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

5. Our current size is 5232 Mbytes. Let us say that we will extend the filesystem by 100 Mbytes. Get the sum of the current size and the size to be added. This will add to 5332 Mbytes. Take note of this.

6. Adjust the size of the Logical Volume.
# lvextend -L new_size_in_mbytes

Example:[root@gmhpux02:/root]

# lvextend -L 5332 /dev/vg00/lv_crash

Logical volume "/dev/vg00/lv_crash" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

7. Adjust the size of the Filesystem
# fsadm -b new_sizem /mountpoint

Example:[root@gmhpux02:/root]
# fsadm -b 5332m /dev/vg00/rlv_crash
fsadm: /etc/default/fs is used for determining the file system type
UX:vxfs fsadm: INFO: V-3-23585: /dev/vg00/rlv_crash is currently 524288 sectors - size will be increased

8. Verify new size of the filesystem
# bdf /mountpoint