Leaderboard (728 x 90)

Thursday, May 6, 2010

How do I mount an ISO image in Virtuozzo container?

In Parallels Virtuozzo Containers 4.0 you may use FUSE (filesystem in userspace) to mount ISO image inside a container.

1. Make sure that 'fuse' module is loaded on hardware node:

~# lsmod | grep fuse

If it is not there, use:

~# modprobe fuse
~# lsmod|grep fuse
fuse 45320 0

In case you would like to load 'fuse' module automatically before starting the service 'vz' please implement init script '/etc/rc.modules' on your node, as described in the article:

---8<--- http://kb.parallels.com/en/696
...
In order to automate modules loading before Virtuozzo services are started you may install 'openvpn' package from Virtuozzo distrib (in HW/RPMS directory) and enable it in default runlevel (use 'chkconfig' utility to do that). Please also use instructions on automated module loading suitable for base OS installed on hardware node.
Just for example, for RedHat-based systems (such as Fedora Core, RedHat AS3/AS4, CentOS 3/4) it should be enough to add 'modprobe tun' command into /etc/rc.modules file and make it executable:

# chmod a+rx /etc/rc.modules
--->8---


and then put the command 'modprobe fuse' inside the file.

After that please restart the hardware node to make sure that 'fuse' module is loaded correctly before the service 'vz'.

2. Grant a container #101 the permission to work with /dev/fuse character device and create corresponding device inside a container (run these commands on Virtuozzo server):

~# vzctl set 101 --devices c:10:229:rw --save
~# vzctl exec 101 mknod -m 666 /dev/fuse c 10 229
~# vzctl exec 101 cp -a /dev/fuse /lib/udev/devices/


In case the file /dev/fuse already exist please make sure it has proper access permissions. Also if the directory '/lib/udev/devices' does not exist, please create it and set correct access permissions:

# vzctl exec 101 mkdir /lib/udev/devices
# vzctl exec 101 chmod 755 /lib/udev/devices/



Check these files:

~# vzctl exec 101 ls -l /lib/udev/devices/fuse
crw-rw-rw- 1 root root 10, 229 Oct 25 19:37 /lib/udev/devices/fuse

# vzctl exec 101 ls -l /dev/fuse
crw-rw-rw- 1 root root 10, 229 Oct 25 19:37 /dev/fuse


3. Install packages fuseiso and fuse into container. Names of packages may be different on different Linux distributions: for Debian and Ubuntu install fuseiso and fuse-utils packages (available in repository) for RHEL/CentOS 3/4/5 use DAG's packages fuse-iso and fuse for Fedora 7/8 both fuseiso and fuse are available from the main/updates repositories for Fedora 6, fuse is available from extras repo, use dries for fuse-iso To mount an ISO image run the command inside a container:

~# fuseiso IMAGE.iso /mnt

Replace IMAGE.iso in the command above with the exact name of ISO image (including path) on filesystem, replace /mnt with path where you want ISO image to be mounted.

To umount image use this command:

~# fusermount -u /mnt

Again - replace /mnt with exact path where ISO image was mounted.

Reference: http://kb.parallels.com/en/4628

How to allow container to use device on hardware node in Virtuozzo Container?

Make sure the device has been already loaded on the hardware node using lsmod. If doesn't load, using modprobe command to load it.

Example:
# lsmod | grep tun
If it is not there, use
# modprobe tun


run the command on hardware node
vzctl set 101 --devices c:10:200:rw --save

where

101 means container ID 101 will be granted permissions to use the device
c:10:200:rw means allow read/write permissions over character device with major number 10 and minor number 200

Then run the command
vzctl exec 101 mknod /dev/net/tun c 10 200

where /dev/net/tun
is device file for character device with major number 10 and minor number 200

Check for major number and minor number of the device for devices.txt in kernel documentation.

Saturday, April 24, 2010

some iptables functions don't work after install virtuozzo

Symptom:
some iptables function that relate with connection tracking module aren't functional after you install virtuozzo.
Example: -m state --state ESTABLISHED,RELATED

Cause:
kernel module named ip_conntrack is disabled by default on hardware node or container 0 (ve0).

Resolution:
Enable ip_conntrack for ve0 by add following line to /etc/modprobe.conf file.

options ip_conntrack ip_conntrack_enable_ve0=1

and if you see these following line in the file

options ip_conntrack ip_conntrack_disable_ve0=1

then change the parameter to 0 as following.

options ip_conntrack ip_conntrack_disable_ve0=0


Sunday, January 24, 2010

Changing the name of a SQL Server machine

Overview
If you change the machine name of a machine with SQL Server installed, you need to do a few things in SQL Server after the machine name change. This article outlines those steps. The article applies to SQL Server 7.0, 2000, 2005 and 2008.

Note: If the SQL Server is installed in a cluster, you should reinstall or hire an expert (who probably will tell you to reinstall). Thanks to SQL Server MVP Geoff N. Hiten for catching that.

Step 1 (7.0)
The SQL Server service will not start after the machine name change. You will get a Windows error message box: "Your SQL Server installation is either corrupt or had been tampered with (unknown package id) Please rerun setup."
All you have to do is to follow the advice. Pop in the SQL Server CD and run setup again. Setup will not reinstall anything, it will only make the adjustments needed so you can start SQL Server again.

Step 2 (all versions)
After starting SQL Server, you need to take care of the sysservers table in the master database. SQL Server stores the local machine name here and this will not match if you have renamed the machine in Windows. This is also easy to fix:

EXEC sp_dropserver 'oldservername'
GO
EXEC sp_addserver 'newservername', 'local'
GO

You need to replace above with the old machine name and with the new machine name.

Step 3 (7.0 and 2000)
In this last step, you need to handle the sysjobs table in the msdb database. There is one row in sysjobs for each SQL Server agent job. In the column originating_server, you find the name of the server where the job was created. This is to support master and target server (MSX). If a job is created on a master server, you cannot modify the job definition on the targer server; all modifications has to be done on the master server.

So, if you changed the machine name, SQL Server will think that the job originated on a master server, and you will not be able to do anything with that job definition. You can handle this in two ways:

1. Rename the machine back to the old name, script the job definitions, delete the jobs, rename the machine to the new name again and use the script to re-create the jobs. See Error 14274 Occurs When You Update a SQL Agent Job After Renaming Windows Server for more information.

2. I find it easier to modify the sysjobs table directly. Note that this isn't supported and if you don't feel confident with doing below, don't; use above steps instead.

DECLARE @srv sysname
SET @srv = CAST(SERVERPROPERTY('ServerName') AS sysname)
UPDATE sysjobs SET originating_server = @srv

If this is a target server (you have jobs sent from a master server), you have to exclude them, so you don't convert those jobs into local jobs:

WHERE originating_server = ''

You need to replace above with the old machine name.

Read this if you deploy images with SQL Server installed
The "Distributed Transaction Coordinator" service (DTC) creates a GUID in the registry when it is installed. Below is an example of a path for the key, for a SQL Server instance named "Fresh":
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\FRESH\MSSQLServer\ResourceMgrID

If you image such an installation using Ghost or some other imaging software, you will have duplicates of this GUID on your machines and your distributed transactions will fail. You can delete this key and a new key with a unique value will be created next time the SQL Server is started. Make sure that you don't have any open distributed transactions when doing this.

Reference: http://www.karaszi.com/SQLServer/info_change_server_name.asp

Friday, January 22, 2010

How to know w3wp.exe process belong to which apppool

run this command:
cscript c:\windows\system32\iisapp.vbs