Saturday 26 February 2011

PCNFS (Microsoft services for Unix) and Netapp howto

So you want to connect a Windows pc to a shared volume on a Netapp filer, but you either do not have the filer licensed for Cifs, or you want to make it more secure by using the ip to ip nature of nfs. This howto explains how to setup Microsoft services for Unix so that you can mount the volume via nfs (or in Microsoft speak pcnfs).

We will configure the Netapp filer first.

1. Make sure pcnfs is turned on. To do this open the web GUI on the Netapp and navigate to nfs, configure. Here you will find a number of settings, near the top you will find the one we are interested in: "PCNFS Enabled" - make sure this setting is set to "Yes" and apply the changes.

2. Set up the nfs export for the volume/qtree you wish the pc to access. This is done in the normal way for nfs exports through the web GUI, adding the ip address for the pc to either the read-only or read-write section depending on what permissions you need the pc to have. Once these changes have been made don't forget to press the 'Export all" button in order for the changes to take affect!

That concludes the required Netapp changes, we will now move into the pc side of things.

1. Create passwd.txt file in c:\maps directory. This will be used to map the pc username to the Unix username and id later. In this example we will use a user called "aaa" with an id of 63000, so the contents of our file will be:

aaa:x:63000:100:aaa:/home/aaa:/bin/bash

[Note: the 100 in the above line is our group id that this user belongs to, we will create this in the next step]

2. Create group.txt file in the c:\maps directory. This is used to map the group name to id later. In this example we will create the group bbb with an id of 100, so our file will look like this:

bbb:x:100:

3. Install Microsoft services for Unix - this howto will install it on a windows xp professional machine, the software for other Microsoft versions is also available on the Microsoft website, note however for windows 7 you must be on the versions higher than professional! The windows xp version of the software can be downloaded here. Download the file to the desktop.

4. Extract the downloaded file, by double clicking on it and selecting unzip.

5. Navigate to the directory, the files were unzipped to, this will be: c:\Documents and Settings\<username>\Local Settings\Temp and double click on the SfuSetup.msi file.

Then proceed with the installation as follows:

1. Click next on the welcome screen

2. Enter username and organisation followed by next

3. Accept the licence agreement and hit next

4. Select Standard installation and click next

5. Leave the security settings boxed unchecked and click next

6. Select "local user name" mapping and "password and group files" then click next

7. Enter c:\maps\passwd.txt for the password file and c:\maps\group.txt for the group file, then click on next

8. Windows services for Unix will now install

Once the initial installation is complete we need to make some changes. Find windows serviced for Unix, in control panel, add or remove programs, click on the entry and select change.

At the next screen, select add it remove, then hit next

Expand the authentication tools for nfs, click the red x against server for pcnfs line and select entire feature will be installed on hard disk. Then click on next. The change will now be installed.

Once installed, we need to make sure the user name mapping service is set to automatic and is running. Do this in the normal manner by using the services screen of the control panel.

We now need to start the windows services for Unix GUI, so go to control panel, administrative tools and double click on "services for Unix administration"

First we need to configure the user name mapping, so click on "user name mapping" in the left hand side. Then click on "maps" along the top bar, followed by "show user maps".

Click on both list windows users and list Unix users, both boxes will then be populated with the user lists.

We will map the user, administrator to the aaa Unix user, so select administrator in the windows users list and aaa in the Unix users list, then press add map.

You should then see the mapping appear, so click on apply to save the changes.

We now need to sort out the pcnfs side of things, so click on server for pcnfs on the left hand side. Click on groups as we will need to create the group before we can map the user to it. Enter the group id of 100 and the group name of bbb. Then click on add.

You should then see the group in the current groups table. Click on apply to save the change.

Now click on users tab, followed by new. Enter the following details into the pop-up box:

User name: aaa
User logon name: aaa
Password: <your password>
Confirm password: <your password>
Primary group name: bbb
User id: 63000

Then click on ok, the user should then appear in the all users box.

Finally click on apply.

We are now in a position to test the setup.

Open my computer, and type the following into the location bar:

\\<Netapp filer ip address>\<volume/qtree name>

Eg if our Netapp filer has an ip address of 10.20.30.40 and we are connecting to qtree ddd in volume ccc our location would be:

\10.20.30.40\vol\ccc\ddd

Upon hitting enter we should see a listing of the files in this qtree.

Creating a new file in this qtree we should see that it is created as the user aaa (uid 63000) and group bbb (gid 100).




Sunday 20 February 2011

Sqlserver and cifs on Netapp

So, big weekend this weekend - moving data from the old single head Netapp to new active/active Netapp.

One of the tasks was to move the sqlserver databases, currently running as iscsi mounts to the Netapp. As these databases are largely obsolete in our environment and the fact that we find iscsi management very inflexible - we decided we would move to cifs.

We thought this would be an easy change - oh how we were wrong!

It seems that Microsoft has decided with sqlserver that you cannot use remote mounts, ie cifs, with its product!

The filesystem browser, ie choosing a backup destination, does not see the mapped drive at all.

Yet another reason why I much prefer Oracle over sqlserver! Good job most of our stuff is on oracle!

Sqlserver fail!

Thursday 17 February 2011

Adding virtual hard disk to SUSE VM on Vmware without reboot

So you need to add an additional hard disk to your VM running the SUSE family of operating system, but its in production and you can not reboot it.

So how do you go about it?

Well, it is rather easy!

First, open the "edit settings" window, within the vm, either from the console menu, or by right clicking in the vm through the virtual infrastructure client. Add a hard disk and configure it with the size you require. Finally accept the changes and close the window. After a few seconds, the virtual infrastructure client will shown the reconfiguration being complete.

Now logon to the operating system of the vm, as the root user - or use sudo.

You will see that the vm does not see the new disk, ie running the command:

fdisk -l

Shows only the existing disks, there is no sign of the new one.

What we need to do is, re-scan the SCSI bus, without rebooting the vm. To do this run the following command:

echo "- - -" >/sys/class/scsi_host/host#/scan

Where the # is replaced with the SCSI host value, usually 0

Now we re-run the command:

fdisk -l

We can now see our additional disk and can carry on configuring it using the usual tools, I.e. fdisk and mkfs or partitioner through yast, etc

Tuesday 8 February 2011

Configuring Netapp filer for rsh connections

So you need to connect to your Netapp filer via rsh. Maybe for example you wish to coordinate the snapshot on a volume with some other specific events in a script, as I did to perform consistent Oracle database backups.

So how do you set it up for this?

First we need to check that the Netapp settings allow rsh, it is allowed by default but it is worth us checking. Login to the filer via telnet and checks the rsh.enable parameter:

Netapp_filer> options rsh.enable
rsh.enable on

If it is set to off, we will need to turn it on with:

Netapp_filer> options rsh.enable=on

Now we need to allow our host to connect via rsh. We will also define it for a specific user as we don't want to.make the system too insecure by letting everyone run system commands on the filer!

First we need read/write access to the root filesystem on the Netapp, so we need to share the /vol/vol0 volume with read/write permissions through the nfs section of the GUI - I am not going to document that step here as it is a common task when setting up nfs shares. I will however remind you to hit the "export all" button once you have set it up, otherwise you will be left scratching your head as to why you cannot mount the filesystem as expected!

Now navigate to the /etc directory of this filesystem, and make a backup of the hosts and hosts.equiv files:

Linux> cd /vol0/etc
Linux> cp hosts hosts_080211
Linux> cp hosts.equiv hosts.equiv_080211

We know need to add our host to the hosts file, I.e. add the line:

1.2.3.4 our_host

Then we need to add the hostname and account name to the hosts.equiv file. Here we are using the Oracle account so the line we will add is:

our_host oracle

Once this is complete, we should be able to confirm the rsh command is working. To test try the following command whilst logged into the oracle account on our_host:

rsh -l root Netapp_filer df -k

This should return the df output of the filesystem on the Netapp filer.

Monday 7 February 2011

Single Oracle listener on multiple networks

I had the requirement today to move the application connection to our production database over to the SAN network, rather than over our internal network in the hope of seeing increased performance. I also wanted to keep the listener on the internal network, as our SAN network is segregated from the rest of the network, therefore by keeping the internal network connection it can be used to connect by the DBAs for administrative purposes.

I started by googling for the solution but found this surprisingly difficult to find the solution! Therefore I am now blogging about it!

To start with we ensure that both ip addresses for our Oracle server are in the /etc/hosts file, eg:

1.2.3.4 host_net1
2.3.4.5 host_net2

We then take our existing listener.ora file:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS =
(PROTOCOL = TCP)(HOST = host_net1)(PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME =
/home/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME =TESTSID)
      (ORACLE_HOME =/home/oracle/product/10.2.0/db_1)
      (SID_NAME =TESTSID)
    )
  )

Here we have a listener listening on host host_net1 on port 1521, for database sid TESTSID.

We now want to add the listener listening on the other ip address, host_net2. As this is another connection, we will need to change the port as well, so we will therefore choose port 1526, as this is generally recognised as the alternative listener port.

To edit, the listener.ora we need to locate the port line in the existing file, ie:

(PROTOCOL = TCP)(HOST = host_net1)(PORT = 1521))

And the copy and paste this line, replacing the HOST and PORT, so our completed file will now look like this:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS =
(PROTOCOL = TCP)(HOST = host_net1)(PORT = 1521))
(PROTOCOL = TCP)(HOST = host_net2)(PORT = 1526))
      )
      (ADDRESS_LIST =
        (ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC))
      )
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME =
/home/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME =TESTSID)
      (ORACLE_HOME =/home/oracle/product/10.2.0/db_1)
      (SID_NAME =TESTSID)
    )
  )

Finally save the file and then stop and start the listener in the usual manner.

You should then be able to confirm you are able to connect to the database via sqlnet from both networks.