Thursday 20 September 2018

Migrating SMSQL Database from 7-mode 8.1.4 LUN to ONTAP 9.4 LUN

Ingredients required:
1. Existing SnapDrive
2. Existing SnapManager for SQL

(Both Licensed)

SnapDrive 7.0 for Windows no longer requires that you have cluster credentials. You are required only to set up your virtual storage server credentials. You are required to have SnapRestore and FlexClone licenses before setting up your virtual storage server credentials.

My lab setup:
SnapManager for SQL Server NetApp, Inc. Version: 7.2.3.2841
SnapDrive Management SnapIn NetApp, Inc. Version: 7.1.5
SQL Server 2012 [11.0.5058]
7-mode : 8.1.4 [Simulator]
cDOT   :  9.4   [Simulator]
Protocol : iSCSI via Microsoft Software Initiator

















In order to migrate the Database LUNs from 7-mode to cDOT, you should have added both the storage systems to the SnapDrive console.













Make sure the LIF [192.168.0.214] is dedicated iSCSI Mgmt LIF for SVM, with data-protocol-access set to none.






Before Migration, create exactly similar (7-mode) LUNs via SnapDrive on cDOT filer to match with 7-mode LUNs.










Run SnapManager for SQL wizard - Run 'configure wizard:


To move the LUNs to cDOT, select the database and click 'Reconfigure' :

Next, select the existing LUN [Drive] and the LUN [Drive] to be migrated to:

Once done, go to next screen and do the same for 'Snapinfo' directory location, change it to the LUN on cDOT:








Just follow the prompts and it should do the trick:

Once it is successfully migrated, all the 'data' will be removed from the 7-mode LUNs [Drive], and  if you go to the Windows Drive, they will be empty, all the data would have been moved to cDOT mapped LUNs Windows Drive.

Run a new Full backup, to make sure the migration has happened smoothly.


Cannot modify 'email notifications' for the existing backup jobs for VSC/SMVI 5.x and onwards...

In SMVI/VSC 5.0 onwards, one cannot modify email notifications on the existing backup jobs after the SMTP server address has changed.

Cause:
This is a known bug:836088


Solution:
Thankfully we don't have to re-create jobs, following workaround will fix this problem.

1. Close vSphere Web Client.

2. Stop the following services from services.msc:


  •  Virtual Storage Console for VMware vSphere Server
  •  NetApp SnapManager for Virtual Infrastructure


3. Edit the following fields in the 'scheduledBackups.xml' file for every job:

C:\Program Files\NetApp\Virtual Storage Console\smvi\server\repository\

-----------------------------

    <notification>

    <addresses>

    <address>New_To_Address@example.com</address>

    </addresses>

    <smtphost>NEW_IP_Address</smtphost>

    <fromAddress>New_From_Address@example.com</fromAddress>

    <type>ALL</type>

    </notification>

4. Save and close scheduledBackups.xml

5. Start services that were stopped in step 2.

6. Open vSphere Web Client to see the changes made.

Tuesday 18 September 2018

Device driver : Sounds familiar, isnt it ? But, it's the single largest contributor to OS code.

Device driver : is a software component that provides an interface between OS and a Hardware device. It is a module of code that can be compiled into kernel or independently of other code.

Purpose : To configure and manage the device and convert requests from the kernel into requests to the Hardware.

Textbook oriented definition of 'device driver' : A device driver can be thought of a translator, that has two functions INPUT (commands) and OUTPUT (Instructions):


  • INPUT     : High level commands such as "retrieve block 123"
  • OUTPUT : Low-level hardware specific instructions used by the hardware-controller, which interfaces the IO device to the rest of the system.


Drivers rely on three interfaces:
1. Interface between Driver and Kernel
2. Interface between Driver and Device
3. Interface between Driver and BUS

There are 3 categories of drivers:
1. Character drivers   = byte-stream oriented   [Media/video/sound]
2. Block drivers         = random-access oriented [ata/ide/scsi]
3. Network drivers    = packet-stream oriented [Ethernet/wireless/infiband]

Sounds informative, but there is plenty that goes into it, and google is your good friend.

Sunday 16 September 2018

NFS and ONTAP9

If your NFS file system is mounted across a high-speed network, such as 10/40Gigabit Ethernet using JUMBO frame, then larger read and write packet sizes might enhance NFS file system performance.

The chunk size that works best for your NFS configuration depends primarily on the network configuration (MTU) and the applications performing I/O. If your applications are doing lots of small I/O, then a large chunk size might negatively affect the performance.

If the applications are using a mixture of I/O payload sizes, then you must do some experimentation with variable block sizes to select the 'sweet spot size'. However, once you have determined that the 'larger block size' is best for your environment, then MTU size can be very important because it determines 'packet fragments' on the network. If your chunk size is 8KB and the MTU is 1500, it will take six Ethernet frames to transmit the 8KB. If you increase the MTU to 9000 (9,000 bytes), the number of Ethernet frames drops to one.


Chunk  vs MTU fragments [1500 bytes] | JUMBO [9000 bytes]
8KB      =                                 6                           1
32KB    =                                22                          4
64KB    =                                43                          8


In general factors that affect NFS performance are:
1. OS buffer size
2. NFS wsize/rsize
3. RPC slots
4. TCP Window (Static or Dynamic)
5. Ethernet MTU (Standard / Jumbo)
6. NFS threads

To avoid potentially causing denial of service on a cluster node, modify clients running RHEL 6.3 and later to use, at most, 128 RPC slots. This number corresponds with the current maximum number of RPCs available per TCP connection in ONTAP.

To do this, run the following on the NFS client (alternatively, edit the /etc/modprobe.d/sunrpc.conf file manually to use these values):

# echo "options sunrpc udp_slot_table_entries=64 tcp_slot_table_entries=128 tcp_max_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf

Centos7 machine in my lab:
[root@centos7 modprobe.d]# cd /etc/modprobe.d/
[root@centos7 modprobe.d]# ls
lockd.conf  mlx4.conf  truescale.conf  tuned.conf

Note: Looks like my client does not contain this file, let's create one.

[root@centos7 modprobe.d]# touch sunrpc.conf
[root@centos7 modprobe.d]# ls
lockd.conf  mlx4.conf  sunrpc.conf  truescale.conf  tuned.conf
[root@centos7 modprobe.d]# echo "options sunrpc udp_slot_table_entries=64 tcp_slot_table_entries=128 tcp_max_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf
[root@centos7 modprobe.d]# cat sunrpc.conf
options sunrpc udp_slot_table_entries=64 tcp_slot_table_entries=128 tcp_max_slot_table_entries=128
[root@centos7 modprobe.d]# reboot


In NetApp ONTAP® 9 and later, '-v3-tcp-max-read-size' and '-v3-tcp-max-write-size' have been deprecated.

The recommendation is to leverage the option '-tcp-max-xfer-size' instead. This change also allows TCP transfer sizes of 1MB for both reads and writes. ONTAP versions prior to ONTAP 9 only allowed 1MB for reads.


Following example shows - How to change the NFS 'wsize' & 'rsize' to 1MB. This is just an example showing the commands needed to change read/write size, and it's not a 'recommendation', as every environment (Infrastructure + Application IO requirement) is different.

To change the read/write size:

1) Check the current xfer size on NetApp first:
ONTAP94::*> nfs show -fields tcp-max-xfer-size
vserver tcp-max-xfer-size
------- -----------------
SVM_NFS 65536

2) Check the read/write size on the NFS client:
[root@centos7 /]# mount
192.168.0.215:/vol_NFS on /mnt/netapp-mnt type nfs
(rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.215,mountvers=3,mountport=635,mountproto=udp,local_lock=none,addr=192.168.0.215)

3) Change the xfer size on NetApp first:
ONTAP94::*> nfs modify -tcp-max-xfer-size 1048576 -vserver SVM_NFS
Warning: Setting "-tcp-max-xfer-size" to a value greater than 65536 may cause performance degradation for existing connections using smaller values. Contact technical support for guidance. Do you want to continue? {y|n}: y

Confirm it again:
ONTAP94::*> nfs show -fields tcp-max-xfer-size
vserver tcp-max-xfer-size
------- -----------------
SVM_NFS 1048576


4) unmount the existing connection(s) on NFS clients:
[root@centos7 /]# umount -f /mnt/netapp-mnt

5) mount it back:
[root@centos7 /]# mount -t nfs 192.168.0.215:/vol_NFS /mnt/netapp-mnt/

6) Confirm the new size:
[root@centos7 /]# mount
192.168.0.215:/vol_NFS on /mnt/netapp-mnt type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.215,mountvers=3,mountport=635,mountproto=udp,local_lock=none,addr=192.168.0.215)
[root@centos7 /]#


According to TR-4067: In some circumstances, the number of ports used to mount or for NFS operations might be exhausted, which then causes subsequent mount and NFS operations to hang until a port is made available.  For example, one scenario seen was with ESX using NFS datastores, because some legacy best practices would call for a data LIF/IP address per datastore. In environments with many volumes/datastores, this created a situation where NFS ports were overrun. The remediation for this situation would be to disable the mount-rootonly and/or the nfs-rootonly options on the NFS server. This removes the 1 to 1,024 port range limit and allows up to 65,534 ports to be used in a NFS server.

Courtesy: TR-4067 (Must read article)

Monday 10 September 2018

Mapping NetApp's inode (hexadecimal) to Linux inode (decimal)

OS: ONTAP 9.4
LINUX:Linux centos7 3.10.0-693.el7.x86_64


vserver :SVM_NFS
Volume  :vol_NFS
Protocol: NFSv3


First mount the NFS vol to Linux: [Assuming you have already exported the NFS vol to the Linux client(s)]
[root@centos7 /]# mount -t nfs 192.168.0.215:/vol_NFS /mnt/nfs-mount/


Create a text file using touch command:
[root@centos7 nfs-mount]# touch test

Use vi editor to write something inside the file, I have written 'NetApp is fun to work with!!!'


Use cat command to verify what you wrote:
[root@centos7 nfs-mount]# cat test
NetApp is fun to work with!!!


Next : Lets identify the inode or a file-handle in ONTAP:

Go to advanced Cluster shell level: set adv
Use the following command: 'file show-filehandle' ; as shown below.


ONTAP94::*> file show-filehandle -vserver SVM_NFS -path /vol/vol_NFS/test
 Vserver                    Path
 ----------------------     ---------------------------
 SVM_NFS                     /vol/vol_NFS/test

 flags   snapid  fileid     generation      fsid             msid          dsid
 ------- ------  ---------      ----------  ----------  ------------  ------------
 0x0     0       0x5d09     0x1b15bd    0x402       0x80024296    0x402

ONTAP94::*>



There is an additional command at the 'node' level to view the file-handle (inode) is called 'showfh':

ONTAP94::*> node run -node ONTAP94-01 -command showfh /vol/vol_NFS/test
flags=0x00 snapid=0 fileid=0x005d09 gen=0x1b15bd fsid=0x000402 dsid=0x00000000000402 msid=0x00000080024296
ONTAP94::*>


At Linux OS, use the command 'stat and file name' to view the inode of the file:

[root@centos7 /]# stat /mnt/nfs-mount/test
  File: ‘/mnt/nfs-mount/test’
  Size: 30              Blocks: 0          IO Block: 1048576 regular file
Device: 2bh/43d Inode: 1117150473  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:nfs_t:s0
Access: 2018-09-10 09:28:40.581214000 +0100
Modify: 2018-09-10 09:28:40.581249000 +0100
Change: 2018-09-10 09:28:40.581294000 +0100
 Birth: -
[root@centos7 /]#

We found the inode for the file 'test' from Linux side: Inode: 1117150473

Inode: 1117150473 <---Convert this from decimal into hexadecimal (use google) and you obtain = 42965D09

Now, split this [42965D09] into two halfs = 4296 & 5D09 and compare the two with the output from the 'show-filehandle'command:

NetApp -> fileid (inode) = 0x5d09
Linux    -> inode             = 5D09

NetApp -> msid               = 0x80024296
Linux   -> part of inode   = 4296


This confirms they match as expected.


TIP: In Cluster ONTAP - Every volume has MSID and DSID [Master Data Set ID & Data Set ID], like Parent & Child relation of a object. Please remember, this will be unique for each new volume, exception if it's a Cloned volume or load sharing Mirrored volume, in which case the MSID will remain the same but DSID will be unique.


Now, let's use the hexdump to view the contents of the file 'test', remember what we wrote - 'NetApp is fun to work with!!!'

This command basically prints the output in hexadump format and contains an additional column shows the corresponding ASCII text translation.

Node level : priv set diag;

This output clearly shows - Where exactly the 'data' is stored, the actual disk, and the disk's block number and the Physical block (vbn or pvbn) which belongs to aggregate. Do not confuse vbn mentioned below with flex-vol block number which is represented by vvbn (virtual volume block number) and is used to represent blocks at flex-vol level (logical container) a way to virtualize storage.

ONTAP94-01*> dumpblock ifile -V vol_NFS 0x005d09
disk v2.19, dbn 63351, vbn 2874103
0x0000: 0x4946424d 0x000007ce 0x000006a5 0x00000000     <MBFI............>
0x0010: 0x00000004 0x00000000 0x00000000 0x00000000     <................>
0x0020: 0x00000000 0x00000000 0x00000000 0x00000000     <................>
0x0030: 0x00000000 0x00000000 0x00000000 0x00000000     <................>
0x0040: 0x00000004 0x00000000 0x00000000 0x00000000     <................>
0x0130: 0x00000000 0x00000000 0x00000000 0x00000000     <................>
0x0140: 0x00000000 0x00000000 0x00000000 0x00000000     <................>
0x0150: 0x00000000 0x00000000 0x00000000 0x00000000     <................>
0x0160: 0x00000104 0x00000000 0x00000000 0x00000001     <................>
0x0170: 0x00000002 0x00000000 0x00000000 0x00000000     <................>
0x0180: 0x5b9629be 0x1ae87168 0x5b9629be 0x1ae909c0     <.).[hq...).[....>
0x0190: 0x5b9629be 0x1ae99a48 0x5b9629be 0x1ae87168     <.).[H....).[hq..>
0x01a0: 0x0000001e 0x00000000 0x00000000 0x00000000     <................>
0x01b0: 0x4174654e 0x69207070 0x75662073 0x6f74206e     <NetApp is fun to>
0x01c0: 0x726f7720 0x6977206b 0x21216874 0x00000a21     < work with!!!...>

Please note: Even though Machine only understands  binary '0' & '1' at the lowest level, it is much efficient to save them in hexadecimal format in order to save space and it also makes it easy to read, interpret & debug for humans.