A 0 in the following suggests syncing time with DOM0:
/proc/sys/xen/independent_wallclock
However, when DOMU is unable to keep time sync with DOM0, the following may be tried:
echo 1 > /proc/sys/xen/independent_wallclock
If you have a ntpd setup elsewhere:
/usr/sbin/ntpdate <ntpd_server>
To update over the network:
rdate -s http://time-a.nist.gov
To manually set the date:
date -s "<date>
Monday, May 23, 2011
Updating Time Zone in Linux
Following should work on RHEL, Oracle Linux, Centos, Ubuntu, and similar may work on others:
Update /etc/sysconfig/clock with the desired timezone from /usr/share/zoneinfo
Backup current localtime:
mv /etc/localtime /etc/localtime.o
cp /usr/share/zoneinfo/ /etc/localtime
If the command is available, the above can be achieved by using:
system-config-date
Update /etc/sysconfig/clock with the desired timezone from /usr/share/zoneinfo
Backup current localtime:
mv /etc/localtime /etc/localtime.o
cp /usr/share/zoneinfo/
If the command is available, the above can be achieved by using:
system-config-date
Simple Oracle listener.ora
$ORACLE_HOME/network/admin/listener.ora:
listener= (ADDRESS_LIST =
(ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
)
SID_LIST_listener = (SID_LIST=
(SID_DESC=(SID_NAME=)(ORACLE_HOME=))
)
--
$ lsnrctl <start|stop|status>
listener
(ADDRESS=(PROTOCOL=tcp)(HOST=
)
SID_LIST_listener
(SID_DESC=(SID_NAME=
)
--
$ lsnrctl <start|stop|status>
Sunday, May 22, 2011
Drop missing data file on ORA-01110
* May not be appropriate in production env *
Sometimes in test env, if a datafile, which is no longer required, is deleted without first dropping the tablespace, then to cleanup:
startup mount;
alter database datafile '' offline drop;
alter database open;
drop tablespace including contents;
Sometimes in test env, if a datafile, which is no longer required, is deleted without first dropping the tablespace, then to cleanup:
startup mount;
alter database datafile '
alter database open;
drop tablespace
Configuring HugePages with Oracle JRockit JVM
Making JRockit JVM use Linux hugepages requires the following 2 configurations:
[1] Mount hugetlbfs
mount -t hugetlbfs nodev /mnt/hugepages
chmod 777 /mnt/hugepages
[2] Use JVM options
-XXaggressive: usually auto enables hugepages, and will use hugepages, if enough available
-Xlargepages: explicitely enables hugepages, and will use if enough hugepages are configured on the system
-Xlargepages:exitOnFailure=true: Will exit if could not use hugepages for any reason
[1] Mount hugetlbfs
mount -t hugetlbfs nodev /mnt/hugepages
chmod 777 /mnt/hugepages
[2] Use JVM options
-XXaggressive: usually auto enables hugepages, and will use hugepages, if enough available
-Xlargepages: explicitely enables hugepages, and will use if enough hugepages are configured on the system
-Xlargepages:exitOnFailure=true: Will exit if could not use hugepages for any reason
Configuring RSH without Password
Tried on RHEL and Oracle Linux:
[1] Install rsh-server*.rpm from the Linux distribution for your system or using yum.
[2] Add the following to /etc/securetty:
rsh
rexec
rlogin
[3] Edit the rsh, rexec, and rlogin files in /etc/xinetd.d/ and change value of disable from yes to no
[4] /etc/init/d/xinetd restart
[5] Add list of hosts to /etc/hosts as:
[6] Add the hosts to ~/.rhosts as:
[7] chmod 600 ~/.rhosts
Also, ensure .rhosts is owned by the right user:group. Otherwise use chown as well.
[8] Repeat steps 1 to 7 on all hosts
Now, you should be able to rsh among the hosts on which you have setup rsh-server correctly.
[1] Install rsh-server*.rpm from the Linux distribution for your system or using yum.
[2] Add the following to /etc/securetty:
rsh
rexec
rlogin
[3] Edit the rsh, rexec, and rlogin files in /etc/xinetd.d/ and change value of disable from yes to no
[4] /etc/init/d/xinetd restart
[5] Add list of hosts to /etc/hosts as:
[6] Add the hosts to ~/.rhosts as:
[7] chmod 600 ~/.rhosts
Also, ensure .rhosts is owned by the right user:group. Otherwise use chown as well.
[8] Repeat steps 1 to 7 on all hosts
Now, you should be able to rsh among the hosts on which you have setup rsh-server correctly.
Mounting RamFS, TmpFS, ISO image
Mount Ramfs
mount -t ramfs -o size=1g ramfs /mnt/ram
Remember that specifying size with ramfs does not limit the /mnt/ram. The ramfs is bound by the free RAM on the system, after which the system will start swapping and performance will be severely degraded.
Mount Tmpfs
mount -t tmpfs -o size=1g tmpfs /mnt/tmp
Mount ISO
mount -o loop,ro <img>.iso <destination>
[Ref] Nice article on Ramfs and Tmpfs available on thegeekstuff
mount -t ramfs -o size=1g ramfs /mnt/ram
Remember that specifying size with ramfs does not limit the /mnt/ram. The ramfs is bound by the free RAM on the system, after which the system will start swapping and performance will be severely degraded.
Mount Tmpfs
mount -t tmpfs -o size=1g tmpfs /mnt/tmp
Mount ISO
mount -o loop,ro <img>.iso <destination>
[Ref] Nice article on Ramfs and Tmpfs available on thegeekstuff
SSH without Password
In order to ssh from Host1 to Host2 without password, the following needs to be done:
user1@Host1:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory '/home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
If ~/.ssh doesn't exist on Host2 as user2, create one:
user2@Host2:~> mkdir -p .ssh
user2@Host2:~> chmod 700 .ssh
Append user1's public key to authorized_keys and authorized_keys2 in user2@Host2:.ssh/:
user1@Host1:~> cat .ssh/id_rsa.pub | ssh user2@Host2 'cat >> .ssh/authorized_keys'
user1@Host1:~> cat .ssh/id_rsa.pub | ssh user2@Host2 'cat >> .ssh/authorized_keys2'
user2@Host2:~> chmod 640 .ssh
Now ssh from user1@Host1 to user2@Host2 should be possible without password:
user1@Host1:~> ssh user2@Host2\
Avoid Host Verification
ssh -o "StrictHostKeyChecking no" user@host
Debugging
Set LogLevel to DEBUG in /etc/ssh/sshd_config
/etc/init.d/sshd restart
Then try to ssh, debug messages will be logged to /var/log/secure
PS: Once you have resolved the issue remember to switch back LogLevel to INFO and again restart sshd.
user1@Host1:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory '/home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
If ~/.ssh doesn't exist on Host2 as user2, create one:
user2@Host2:~> mkdir -p .ssh
user2@Host2:~> chmod 700 .ssh
Append user1's public key to authorized_keys and authorized_keys2 in user2@Host2:.ssh/:
user1@Host1:~> cat .ssh/id_rsa.pub | ssh user2@Host2 'cat >> .ssh/authorized_keys'
user1@Host1:~> cat .ssh/id_rsa.pub | ssh user2@Host2 'cat >> .ssh/authorized_keys2'
user2@Host2:~> chmod 640 .ssh
Now ssh from user1@Host1 to user2@Host2 should be possible without password:
user1@Host1:~> ssh user2@Host2\
Avoid Host Verification
ssh -o "StrictHostKeyChecking no" user@host
Set LogLevel to DEBUG in /etc/ssh/sshd_config
/etc/init.d/sshd restart
Then try to ssh, debug messages will be logged to /var/log/secure
PS: Once you have resolved the issue remember to switch back LogLevel to INFO and again restart sshd.
Editing Xen System.img
This post is useful when you want to change system configuration files of a stopped guest VM without botting up the guest first. This method can be used especially when your guest VM crashes or hangs during boot up due to a configuration error.
The following steps have been tested on Xen 4 and Oracle VM 2.2 as well for a Linux guest VM. From DOM0:
Check FS Type
fdisk -u -l System.img
If FS type is ext3, you can directly mount a partition using lomount, otherwise follow the mounting LV's steps.
Mount Ext3 Partitions
Linux system.img with ext3 partitions can be mounted as:
lomount -diskimage System.img -partition 2 /mnt
Mounting LV's
# Mounting guest's root partition locally
# Find a free loop device
loop_dev=`losetup -f`
# Now bind the image file to that loop device
losetup ${loop_dev} System.img
# Next, scan the loop device for partitions
kpartx -av ${loop_dev}
# If /dev/mapper doesn't list LVs for the partitions from kpartx, find LV:
vgscan
vgchange -ay sysvg
# Mount the desired LVM
mount /dev/mapper/loop0p2 /mnt
LVs UnMounting
# After editing in /mnt, unmount and remove partitions:
umount /mnt
# Disable the LV
vgchange -an /dev/mapper/loop0p2
# Remove the discovered partitions
kpartx -dv ${loop_dev}
# Delete the loop device
losetup -d ${loop_dev}
The following steps have been tested on Xen 4 and Oracle VM 2.2 as well for a Linux guest VM. From DOM0:
Check FS Type
fdisk -u -l System.img
If FS type is ext3, you can directly mount a partition using lomount, otherwise follow the mounting LV's steps.
Mount Ext3 Partitions
Linux system.img with ext3 partitions can be mounted as:
lomount -diskimage System.img -partition 2 /mnt
Mounting LV's
# Mounting guest's root partition locally
# Find a free loop device
loop_dev=`losetup -f`
# Now bind the image file to that loop device
losetup ${loop_dev} System.img
# Next, scan the loop device for partitions
kpartx -av ${loop_dev}
# If /dev/mapper doesn't list LVs for the partitions from kpartx, find LV:
vgscan
vgchange -ay sysvg
# Mount the desired LVM
mount /dev/mapper/loop0p2 /mnt
LVs UnMounting
# After editing in /mnt, unmount and remove partitions:
umount /mnt
# Disable the LV
vgchange -an /dev/mapper/loop0p2
# Remove the discovered partitions
kpartx -dv ${loop_dev}
# Delete the loop device
losetup -d ${loop_dev}
Subscribe to:
Posts (Atom)