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
Sunday, October 9, 2011
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
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
• 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):
$ ssh-keygen -i -f id_dsa_2048_b.pub
ssh-dss AAAAB3NzaC1kc3MAAAEBAKueha6mfr5OUcscc88lmQUBBgYSZ08htHFaYzke2N
5WG6ql1NgwQsyY2mMRxvvGckBeInx2GvRlz1+izDs5p4UGhkMzG8qOoT2y2vLwTFQyxi4I
XET1e0E8VYC0dcLfs5Zg6RxEY7GA5FiydS6dceuPnLJgCYDfyb9Qbk4rVEvREODo8dV/KR
lZxecEgaeKOO7ZnEzaIVPRCVb6U6EaRtZvxKfGnNFI957AfZ+Hqevz1IeQNDCp00EmaNli
8Ow4rjOPlH7o818r35Ea8mMoV0hkirNQ25zf/Z1LvCS3649537YDi/SVmMMpGCvT93w/TR
vk5RKlwVVy+TH52C8/MKEAAAAVAOuDCV61LvfKz0bd8hYEJ/gGof9XAAABAQCFRhlpWtVO
hTxcWcrnZp9EbbVRZO16St5TPjL86khb7b/VjScOAgt0tslHwtEEQzImv1xRkk6ZQ1o9pv
Azb1fMZrZMGIy9zUXvL0v6LNXxCxN9YIjx14OXYfH8EIQDZJGRJoxHvEvUVjv3lHnTuxbd
Krcbagvakxvgjq1wVyEueilO+g+WhJm+Q+XIYRl0TK9qtsAVFmzxBxT5USZFJ+1kbG7ipp
fFSGWRd3KPUCVQ8iGO3IMjtIlfcuGOArbKB06kMlxsdjNjhcEIHtR0jpaEeB2X+HrVScQE
oXG4S8YkiIExlIvjhrVr571BTOuO9H5VHt4CtKUxeXxKZWslulYwAAABAHm3zlMsXxPL/H
Oq29qf7Lk90b7El+j19E2UkyssfSu6+/k4bFf6ax2n3yEn31S5bUdNvgqmlEjdERc4SkU6
5b5LW2ZI1v7kRoegG+bD2Q21N9Rv/lwS7CTprenKiMMRJ8TU7FMIVT3zEZkV+etC7cbaN+
09GoiFTt+h7IDmo7onlo64oSMrcc+xt++ZUzENTVBgDoS92jlpnELkyJqZgb1/fdEPT6wR
j132yBxWLqDGmbp9msmY1us+XNDY8isF80u9yTTXGTskOtCSaeavDDtPOKN5ZR20sHpIBg
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
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):
$ ssh-keygen -i -f id_dsa_2048_b.pub
ssh-dss AAAAB3NzaC1kc3MAAAEBAKueha6mfr5OUcscc88lmQUBBgYSZ08htHFaYzke2N
5WG6ql1NgwQsyY2mMRxvvGckBeInx2GvRlz1+izDs5p4UGhkMzG8qOoT2y2vLwTFQyxi4I
XET1e0E8VYC0dcLfs5Zg6RxEY7GA5FiydS6dceuPnLJgCYDfyb9Qbk4rVEvREODo8dV/KR
lZxecEgaeKOO7ZnEzaIVPRCVb6U6EaRtZvxKfGnNFI957AfZ+Hqevz1IeQNDCp00EmaNli
8Ow4rjOPlH7o818r35Ea8mMoV0hkirNQ25zf/Z1LvCS3649537YDi/SVmMMpGCvT93w/TR
vk5RKlwVVy+TH52C8/MKEAAAAVAOuDCV61LvfKz0bd8hYEJ/gGof9XAAABAQCFRhlpWtVO
hTxcWcrnZp9EbbVRZO16St5TPjL86khb7b/VjScOAgt0tslHwtEEQzImv1xRkk6ZQ1o9pv
Azb1fMZrZMGIy9zUXvL0v6LNXxCxN9YIjx14OXYfH8EIQDZJGRJoxHvEvUVjv3lHnTuxbd
Krcbagvakxvgjq1wVyEueilO+g+WhJm+Q+XIYRl0TK9qtsAVFmzxBxT5USZFJ+1kbG7ipp
fFSGWRd3KPUCVQ8iGO3IMjtIlfcuGOArbKB06kMlxsdjNjhcEIHtR0jpaEeB2X+HrVScQE
oXG4S8YkiIExlIvjhrVr571BTOuO9H5VHt4CtKUxeXxKZWslulYwAAABAHm3zlMsXxPL/H
Oq29qf7Lk90b7El+j19E2UkyssfSu6+/k4bFf6ax2n3yEn31S5bUdNvgqmlEjdERc4SkU6
5b5LW2ZI1v7kRoegG+bD2Q21N9Rv/lwS7CTprenKiMMRJ8TU7FMIVT3zEZkV+etC7cbaN+
09GoiFTt+h7IDmo7onlo64oSMrcc+xt++ZUzENTVBgDoS92jlpnELkyJqZgb1/fdEPT6wR
j132yBxWLqDGmbp9msmY1us+XNDY8isF80u9yTTXGTskOtCSaeavDDtPOKN5ZR20sHpIBg
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
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
Friday, May 14, 2010
How do I use cpio command under Unix?
Q. Can you explain how do I use cpio under Linux / UNIX?
A. GNU cpio is a tool for creating and extracting archives, or copying files from one place to another. It handles a number of cpio formats as well as reading and writing tar files. cpio command works just like tar, only better.
As I said earlier, cpio works like tar but it can read input from the "find" command. This is nifty feature. For example you can find out all *.c files and backup with cpio command.
# find / -name "*.c" | cpio -o --format=tar > c-file.backup.tar
# find / -iname "*.pl" | cpio -o -H tar > perl-files.tar
You can also specify file name using -F option:
# find / -iname "*.pl" | cpio -o -H tar -F perl-files.tar
Where,
-o: Create archive
-F: Archive filename to use instead of standard input or output. To use a tape drive on another machine as the archive.
-H format: Specify file format to use.
-i: Restore archive
You can extract archive with the following command:
# cpio -i -F perl-files.tar
You can list file inside archive i.e. list contents of the cpio file with following command:
# cpio -it -F perl-files.tar
You can write archive of /home to tape (drive /dev/nst0), type the following command:
# find /home | cpio -o -H tar -F /dev/nst0
Restore backup using following command:
# cpio -i -F /dev/nst0Backup /home dir,
to remote system tape drive:
# find /home | cpio -o -H tar -F user@backup.nixcraft.in:/dev/nst0 --rsh-command=/usr/bin/ssh
A. GNU cpio is a tool for creating and extracting archives, or copying files from one place to another. It handles a number of cpio formats as well as reading and writing tar files. cpio command works just like tar, only better.
As I said earlier, cpio works like tar but it can read input from the "find" command. This is nifty feature. For example you can find out all *.c files and backup with cpio command.
# find / -name "*.c" | cpio -o --format=tar > c-file.backup.tar
# find / -iname "*.pl" | cpio -o -H tar > perl-files.tar
You can also specify file name using -F option:
# find / -iname "*.pl" | cpio -o -H tar -F perl-files.tar
Where,
-o: Create archive
-F: Archive filename to use instead of standard input or output. To use a tape drive on another machine as the archive.
-H format: Specify file format to use.
-i: Restore archive
You can extract archive with the following command:
# cpio -i -F perl-files.tar
You can list file inside archive i.e. list contents of the cpio file with following command:
# cpio -it -F perl-files.tar
You can write archive of /home to tape (drive /dev/nst0), type the following command:
# find /home | cpio -o -H tar -F /dev/nst0
Restore backup using following command:
# cpio -i -F /dev/nst0Backup /home dir,
to remote system tape drive:
# find /home | cpio -o -H tar -F user@backup.nixcraft.in:/dev/nst0 --rsh-command=/usr/bin/ssh
HP-UX UNIX: Start / Stop and Configure Cron Services
Q. I need to run a backup and other stuff everyday. How do I check and start cron service under HP-UX UNIX operating system? How do I write cron jobs?
A. Cron service is required to run jobs and tasks such as backup.
You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
Task: Find out if cron is running under HP-UX
Type the following command at a shell prompt
# ps -ef | grep cron
Open /etc/rc.config.d/cron file
vi /etc/rc.config.d/cron
Set control variable to 1 to enable cron : CRON=1
Set control variable to 0 to disable : CRON=0
Close and save the file. To start or stop cron you can type the following command:
# /sbin/init.d/cron start <-- start cron
# /sbin/init.d/cron stop <-- stop cron
Task: HP-UX Start cron service
If cron is not running, simply type:
# cron
Task: Edit / create cron jobs
Type the following command to submit a cron job:
# crontab -e
List your cron file:
# crontab -l
Backup all your cron jobs:
# crontab -l > ~/backup.cron.jobs
Remove ALL cron job:
# crontab -r
Task: Crontab file format
Cron file format is as follows:
MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.sh
Easy to remember crontab file format:
* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
# crontab -e
Append following
0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
0 6 * * 1-5 /root/script/backup
A. Cron service is required to run jobs and tasks such as backup.
You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
Task: Find out if cron is running under HP-UX
Type the following command at a shell prompt
# ps -ef | grep cron
Open /etc/rc.config.d/cron file
vi /etc/rc.config.d/cron
Set control variable to 1 to enable cron : CRON=1
Set control variable to 0 to disable : CRON=0
Close and save the file. To start or stop cron you can type the following command:
# /sbin/init.d/cron start <-- start cron
# /sbin/init.d/cron stop <-- stop cron
Task: HP-UX Start cron service
If cron is not running, simply type:
# cron
Task: Edit / create cron jobs
Type the following command to submit a cron job:
# crontab -e
List your cron file:
# crontab -l
Backup all your cron jobs:
# crontab -l > ~/backup.cron.jobs
Remove ALL cron job:
# crontab -r
Task: Crontab file format
Cron file format is as follows:
MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.sh
Easy to remember crontab file format:
* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
# crontab -e
Append following
0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
0 6 * * 1-5 /root/script/backup
Subscribe to:
Posts (Atom)