Wednesday, 27 August 2008

Wednesday, 9 July 2008

Converting a flexible volume to a traditional volume.

A simple way to convert a flexible volume to a traditional volume is to use ndmp, within the same filer.

Firstly enable ndmp and turn it on.

filer>options ndmpd.enable on
filer>ndmpd on

Next create the volume that you want to migrate the data to. In this case, I create a traditional volume with 5 disks, and use raid4 protection rather than raid-dp.

filer>vol create vol0_trad -t raid4 5

The output of the command should look similar to this :-

Tue Jul 8 20:33:25 GMT [raid.vol.disk.add.done:notice]: Addition of Disk /vol0_trad/plex0/rg0/0d.4 Shelf 0 Bay 4 [SEAGATE ST3500630NSAH AQMZ] S/N [9QG7A9J2] t
o volume vol0_trad has completed successfully
Tue Jul 8 20:33:25 GMT [raid.vol.disk.add.done:notice]: Addition of Disk /vol0_trad/plex0/rg0/0d.0 Shelf 0 Bay 3 [SEAGATE ST3500630NSAH AQMZ] S/N [9QG7KTSY] t
o volume vol0_trad has completed successfully
Tue Jul 8 20:33:25 GMT [raid.vol.disk.add.done:notice]: Addition of Disk /vol0_trad/plex0/rg0/0d.3 Shelf 0 Bay 2 [SEAGATE ST3500630NSAH AQMZ] S/N [9QG7LHPR] t
o volume vol0_trad has completed successfully
Tue Jul 8 20:33:25 GMT [raid.vol.disk.add.done:notice]: Addition of Disk /vol0_trad/plex0/rg0/0c.6 Shelf 0 Bay 7 [SEAGATE ST3500630NSAH AQMZ] S/N [9QG7C91R] t
o volume vol0_trad has completed successfully
Tue Jul 8 20:33:25 GMT [raid.vol.disk.add.done:notice]: Addition of Disk /vol0_trad/plex0/rg0/0d.1 Shelf 0 Bay 1 [SEAGATE ST3500630NSAH AQMZ] S/N [9QG7LHVF] t
o volume vol0_trad has completed successfully
Creation of a volume with 5 disks has completed.
perfdevsrv015> Tue Jul 8 20:33:26 GMT [wafl.vol.add:notice]: Volume vol0_trad has been added to the system.

Next I use ndmpcopy to copy the files to the new volume. I use the -f switch since I am copying the root volume.
ndmpcopy -f /vol/vol0 /vol/vol0_trad

The output looks as below

Ndmpcopy: Starting copy [ 0 ] ...
Ndmpcopy: perfdevsrv015: Notify: Connection established
Ndmpcopy: perfdevsrv015: Notify: Connection established
Ndmpcopy: perfdevsrv015: Connect: Authentication successful
Ndmpcopy: perfdevsrv015: Connect: Authentication successful
Ndmpcopy: perfdevsrv015: Log: DUMP: creating "/vol/vol0/../snapshot_for_backup.0" snapshot.
Ndmpcopy: perfdevsrv015: Log: DUMP: Using Full Volume Dump
Ndmpcopy: perfdevsrv015: Log: DUMP: Date of this level 0 dump: Tue Jul 8 20:35:51 2008.
Ndmpcopy: perfdevsrv015: Log: DUMP: Date of last level 0 dump: the epoch.
Ndmpcopy: perfdevsrv015: Log: DUMP: Dumping /vol/vol0 to NDMP connection
Ndmpcopy: perfdevsrv015: Log: DUMP: mapping (Pass I)[regular files]
Ndmpcopy: perfdevsrv015: Log: DUMP: mapping (Pass II)[directories]
Tue Jul 8 20:36:21 GMT [asup.post.badUrl:warning]: Autosupport was not posted because there was an invalid or missing url specified (REBOOT)
Ndmpcopy: perfdevsrv015: Log: DUMP: estimated 235187 KB.
Ndmpcopy: perfdevsrv015: Log: DUMP: dumping (Pass III) [directories]
Ndmpcopy: perfdevsrv015: Log: RESTORE: Tue Jul 8 20:36:40 2008: Begin level 0 restore
Ndmpcopy: perfdevsrv015: Log: RESTORE: Tue Jul 8 20:36:40 2008: Reading directories from the backup
Ndmpcopy: perfdevsrv015: Log: DUMP: dumping (Pass IV) [regular files]
Ndmpcopy: perfdevsrv015: Log: RESTORE: Tue Jul 8 20:36:49 2008: Creating files and directories.
Ndmpcopy: perfdevsrv015: Log: RESTORE: Tue Jul 8 20:36:54 2008: Writing data to files.
Ndmpcopy: perfdevsrv015: Log: RESTORE: Tue Jul 8 20:37:30 2008: Restoring NT ACLs.
Ndmpcopy: perfdevsrv015: Log: DUMP: dumping (Pass V) [ACLs]
Ndmpcopy: perfdevsrv015: Log: DUMP: 238893 KB
Ndmpcopy: perfdevsrv015: Log: RESTORE: RESTORE IS DONE
Ndmpcopy: perfdevsrv015: Log: DUMP: DUMP IS DONE
Ndmpcopy: perfdevsrv015: Log: RESTORE: The destination path is /vol/vol0_trad/
Ndmpcopy: perfdevsrv015: Notify: restore successful
Ndmpcopy: perfdevsrv015: Log: DUMP: Deleting "/vol/vol0/../snapshot_for_backup.0" snapshot.
Ndmpcopy: perfdevsrv015: Notify: dump successful
Ndmpcopy: Transfer successful [ 1 minutes 44 seconds ]
Ndmpcopy: Done

Now since I want to boot from this volume I set the boot option
vol options vol0_trad root

ONTAP tells me that this volume will become the root volume on next boot;
Volume 'vol0_trad' will become root at the next boot.

I can now reboot. I only need to do this step because I am messing with the boot/root volume

filer>reboot

After reboot I can rename the volumes

filer>vol rename vol0 vol0_flex

And now I can safely remove the volume and the aggregate so that I can use the disks in my new traditional volume

filer> vol offline vol0_flex
Tue Jul 8 20:46:01 GMT [wafl.vvol.offline:info]: Volume 'vol0_flex' has been set temporarily offline
Volume 'vol0_flex' is now offline.

filer> vol destroy vol0_flex
Are you sure you want to destroy this volume? y
Volume 'vol0_flex' destroyed.

filer> aggr offline aggr0
Aggregate 'aggr0' is now offline.


filer> aggr destroy aggr0
Are you sure you want to destroy this aggregate? y
Tue Jul 8 20:46:36 GMT [raid.config.vol.destroyed:info]: Aggregate 'aggr0' destroyed.
Aggregate 'aggr0' destroyed.


Now that I have destroyed the volume and aggegate, I am free to reuse those disks. ONTAP gives a warning that I will have no spare disks, and that this is risky in case of a failure.

filer> vol add vol0 2

WARNING! Continuing with vol add will result in having
no spare disk available for one or more RAID groups.
Are you sure you want to continue with vol add? y
Addition of 2 disks to the volume has been initiated. The disks need
to be zeroed before addition to the volume. The process has been initiated
and you will be notified via the system log as disks are added.


Once the disks are zeroed all the disks now belong to the traditional volume.

Friday, 27 June 2008

Munge columnar into one datafile (for processing in a spreadsheet, gnuplot or whatever)

Often we'll use awk or cut to spit out a single column of data from a bunch of different files, or maybe from the same file... anyhow once we have these files with one column of data, sometimes we'll want to splice those files together so we can look at each line (typically a stat of some sort) next to each other. Also it's very convenient if we want to import the data into a spreadsheet.

Anyhow, let's say I have three files iscsi_080626.txt greads.out.txt idle.out.txt. I can put them together into one file using the 'pr' command like so.

iscsi file
bash-3.00$ head iscsi_080626.txt 
32782319.86
32793022.93
32734064.23
32719233.74
32652552.75
32815570.70


gread file
bash-3.00$ head greads.out.txt

0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00


idle file
bash-3.00$ head idle.out.txt 
248.722142
17.662915
17.195024
16.208969
15.856432
17.064519
16.874948
17.122956
17.191305
16.920703





bash-3.00$ pr -m -t iscsi_080626.txt greads.out.txt idle.out.txt > iscsi_greads_idle.txt


And the output file looke like this
bash-3.00$ head iscsi_greads_idle.txt 
32782319.86 0.00 248.722142
32793022.93 0.00 17.662915
32734064.23 0.00 17.195024
32719233.74 0.00 16.208969
32652552.75 0.00 15.856432
32815570.70 0.00 17.064519
32801494.63 0.00 16.874948
32696942.10 0.00 17.122956
32715608.64 0.00 17.191305
32835538.38 0.00 16.920703

Change disks used by an aggregate

Recently we needed to transfer an aggregate that was hosted on an external shelf to disks housed internally in our test FAS2020 and the same trick can be used to move an aggregate from one shelf to another.

The trick uses the disk-replace command. It works serially, and so it is a little time consuming, BUT it retains exactly the same layout on disk, since it's a bit-for-bit copy.

In short the command to use is 'disk replace start < new diskname> e.g.
 disk replace start 0b.19 0c.00.0

So here's what my disk layout looks like - I am using traditional volumes
Volume vol1 (online, raid_dp) (block checksums)
Plex /vol1/plex0 (online, normal, active)
RAID group /vol1/plex0/rg0 (normal)

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
dparity 0c.00.6 0c 0 6 SA:1 - SATA 7200 211377/432901760 211977/434130816
parity 0c.00.1 0c 0 1 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.19 0b 1 3 FC:B - ATA 7200 211377/432901760 211921/434014304
data 0c.00.3 0c 0 3 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.11 0c 0 11 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.10 0c 0 10 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.9 0c 0 9 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.8 0c 0 8 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.7 0c 0 7 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.4 0c 0 4 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.29 0b 1 13 FC:B - ATA 7200 211377/432901760 211921/434014304
data 0c.00.5 0c 0 5 SA:1 - SATA 7200 211377/432901760 211977/434130816


Spare disks

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
Spare disks for block or zoned checksum traditional volumes or aggregates
spare 0a.16 0a 1 0 FC:A - ATA 7200 211377/432901760 211921/434014304 (not zeroed)
spare 0a.20 0a 1 4 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.22 0a 1 6 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.24 0a 1 8 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.26 0a 1 10 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0b.17 0b 1 1 FC:B - ATA 7200 211377/432901760 211921/434014304 (not zeroed)
spare 0b.25 0b 1 9 FC:B - ATA 7200 211377/432901760 211921/434014304
spare 0b.27 0b 1 11 FC:B - ATA 7200 211377/432901760 211921/434014304
spare 0c.00.0 0c 0 0 SA:1 - SATA 7200 211377/432901760 211977/434130816 (not zeroed)

All the disks marked with a 'CHAN' type of FC:A or FC:B are actually SATA drives on the other side of a FC->SATA bridge, and are basically SATA disks in an external shelf. The disks marked SA:1 are SATA drive internal to the FAS2020. In the output above I am part-way through migrating the disks. Some of the disks in my volume/aggregate are internal and some are external. On of the disks that is still on the external shelf is disk 0b.19. Using the command below I will transfer the data on that individual disk to an internal SATA disk (0c.00.0). The command I use is.
 disk replace start 0b.19 0c.00.0

Then I receive a warning messge
*** You are about to copy and replace the following file system disk ***
Disk /vol1/plex0/rg0/0b.19

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
data 0b.19 0b 1 3 FC:B - ATA 7200 211377/432901760 211921/434014304
***
Really replace disk 0b.19 with 0c.00.0? y
disk replace: Disk 0b.19 was marked for replacing.

The output of sysconfig -r shows something like this
Volume vol1 (online, raid_dp) (block checksums)
Plex /vol1/plex0 (online, normal, active)
RAID group /vol1/plex0/rg0 (normal)

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
dparity 0c.00.6 0c 0 6 SA:1 - SATA 7200 211377/432901760 211977/434130816
parity 0c.00.1 0c 0 1 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.19 0b 1 3 FC:B - ATA 7200 211377/432901760 211921/434014304 (replacing)
data 0c.00.3 0c 0 3 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.11 0c 0 11 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.10 0c 0 10 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.9 0c 0 9 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.8 0c 0 8 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.7 0c 0 7 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.4 0c 0 4 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.29 0b 1 13 FC:B - ATA 7200 211377/432901760 211921/434014304
data 0c.00.5 0c 0 5 SA:1 - SATA 7200 211377/432901760 211977/434130816

And then once the replacement gets under way.. I see my copy under way.
Volume vol1 (online, raid_dp) (block checksums)
Plex /vol1/plex0 (online, normal, active)
RAID group /vol1/plex0/rg0 (normal)

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
dparity 0c.00.6 0c 0 6 SA:1 - SATA 7200 211377/432901760 211977/434130816
parity 0c.00.1 0c 0 1 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.19 0b 1 3 FC:B - ATA 7200 211377/432901760 211921/434014304 (replacing, copy in progress)
-> copy 0c.00.0 0c 0 0 SA:1 - SATA 7200 211377/432901760 211977/434130816 (copy 1% completed)
data 0c.00.3 0c 0 3 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.11 0c 0 11 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.10 0c 0 10 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.9 0c 0 9 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.8 0c 0 8 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.7 0c 0 7 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.4 0c 0 4 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0b.29 0b 1 13 FC:B - ATA 7200 211377/432901760 211921/434014304
data 0c.00.5 0c 0 5 SA:1 - SATA 7200 211377/432901760 211977/434130816

And finally when the copy is done, 0c.00.0 is part of the aggregate/volume and 0b.19 is spare.
Volume vol1 (online, raid_dp) (block checksums)
Plex /vol1/plex0 (online, normal, active)
RAID group /vol1/plex0/rg0 (normal)

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
dparity 0c.00.6 0c 0 6 SA:1 - SATA 7200 211377/432901760 211977/434130816
parity 0c.00.1 0c 0 1 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.0 0c 0 0 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.3 0c 0 3 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.11 0c 0 11 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.10 0c 0 10 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.9 0c 0 9 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.8 0c 0 8 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.7 0c 0 7 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.4 0c 0 4 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.2 0c 0 2 SA:1 - SATA 7200 211377/432901760 211977/434130816
data 0c.00.5 0c 0 5 SA:1 - SATA 7200 211377/432901760 211977/434130816


Spare disks

RAID Disk Device HA SHELF BAY CHAN Pool Type RPM Used (MB/blks) Phys (MB/blks)
--------- ------ ------------- ---- ---- ---- ----- -------------- --------------
Spare disks for block or zoned checksum traditional volumes or aggregates
spare 0a.16 0a 1 0 FC:A - ATA 7200 211377/432901760 211921/434014304 (not zeroed)
spare 0a.20 0a 1 4 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.22 0a 1 6 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.24 0a 1 8 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0a.26 0a 1 10 FC:A - ATA 7200 211377/432901760 211921/434014304
spare 0b.17 0b 1 1 FC:B - ATA 7200 211377/432901760 211921/434014304 (not zeroed)
spare 0b.19 0b 1 3 FC:B - ATA 7200 211377/432901760 211921/434014304 (not zeroed)
spare 0b.25 0b 1 9 FC:B - ATA 7200 211377/432901760 211921/434014304
spare 0b.27 0b 1 11 FC:B - ATA 7200 211377/432901760 211921/434014304
spare 0b.29 0b 1 13 FC:B - ATA 7200 211377/432901760 211921/434014304 (not zeroed)

Thursday, 22 May 2008

Testing variables in bash

So, one of our developers took it upon himself to re-write one of my crappy scripts, and used some odd looking shell 'test' invocations that I'd never seen before.
[ "$FILERTYPE" != "3040" -a "$FILERTYPE" != "3070" "$FILERTYPE" -a != "3070-br" ] && usage

So here we have a logical AND comparison, which calls the function 'usage' if the variable $FILERTYPE does not match any of the valid types. It is the -a which provides the 'AND' capability, alternatively -o gives 'OR' semantics.


I found a nice page from IBM which describes this format and more. IIRC these tests are available in bash but not ksh.

Tuesday, 20 May 2008

Filer iSCSI trace

Running a network trace from a filer


Data ONTAP has a built in packet trace capability, which can be run straight from the command line. The format of the capture is the standard BPF and so can be imported into pretty much any tool for viewing and analysis. By default the packet trace is stored in memory, but it can be easily switched to write out to a local volume on the filer in order to gather larger traces.

Start a trace on interface eOb and write the file out to '/' with a miximum trace size of 5 MB
rtpperfsrv053*> pktt start e0b -d / -s 5m


Measuring iSCSI traffic with tethereal


tethereal is a command line interface to Ethereal, I am not sure if it comes bundled with Wireshark, but it is available on some linux distros. I find the syntax and functionality nicer than tcpdump. There's lots of data on the net about using tethereal with NFS but not so much with iSCSI. Below are a few commands and filters I used to analyse some traces of iSCSI traffic.

overview

  • In the example below the captured packet data rolled up into the iscsi protocol, and so we see the SCSI writes from the clients (192.168.10.4 & 192.168.10.3) to the filer (192.168.10.5). The LBA: value is the offset into the LUN where the read/write will take place. I am using the '-r' switch to read a file creates by pktt. The filename is interfacename_datetimestamp.trc


$tethereal -r e0b_20080519_102523.trc iscsi


7   0.000450 192.168.10.5 -> 192.168.10.3 iSCSI SCSI: Response LUN: 0xffff (CDB:0xffff) (Good)
8 0.000545 192.168.10.5 -> 192.168.10.4 iSCSI SCSI: Response LUN: 0xffff (CDB:0xffff) (Good)
68 0.001521 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x07 (LBA: 0x00228718, Len: 112)SCSI: Data Out LUN: 0x07 (Write(10) Request Data)
69 0.002746 192.168.10.5 -> 192.168.10.3 iSCSI SCSI: Response LUN: 0x07 (Write(10)) (Good)
129 0.003225 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x1e (LBA: 0x00228b00, Len: 112)SCSI: Data Out LUN: 0x1e (Write(10) Request Data)
180 0.004140 192.168.10.4 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x1a (LBA: 0x03dd12e8, Len: 96)SCSI: Data Out LUN: 0x1a (Write(10) Request Data)
236 0.004871 192.168.10.4 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x03 (LBA: 0x03de1060, Len: 104)SCSI: Data Out LUN: 0x03 (Write(10) Request Data)
315 0.005210 192.168.10.4 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x1c (LBA: 0x03de1b00, Len: 104)SCSI: Data Out LUN: 0x1c (Write(10) Request Data)
331 0.005320 192.168.10.5 -> 192.168.10.3 iSCSI SCSI: Response LUN: 0x1e (Write(10)) (Good)


Gathering statistics


Although there are some really nice commands for viewing RPC (e.g. NFS) calls including the round trip time (RTT) of each NFS IO, I could not find anything similar for iSCSI.

  • tethereal does alow the display of per interval statistics, l, in the example below I tethereal displays stats every 1/2 second. It is possible specify any time value down to millisecond. In this example we are reading a pktt created file using '-r'. The output shows that the traffic is somewhat 'bursty' in nature.

  • I use the switch -tad to give me time as an absolute delta from the first packet. -r to read data from a file (rather than 'live' from a NIC). -q to print out just the summary result table. -z io,stat,0.5 tells tethereal to generate statistics on the I/O every 0.5 seconds.


$tethereal -tad -r e0b_20080519_153919.trc -qz io,stat,0.5


IO Statistics
Interval: 0.500 secs
Column #0:
| Column #0
Time |frames| bytes
000.000-000.500 15249 15114470
000.500-001.000 7828 7686548
001.000-001.500 9094 8857572
001.500-002.000 9774 9650058
002.000-002.500 6218 6062802
002.500-003.000 15552 15328528
003.000-003.500 4803 4643892
003.500-004.000 6354 6203928
004.000-004.500 10224 10086896
004.500-005.000 5312 5169636
005.000-005.500 13555 13354682
005.500-006.000 6451 6369138
006.000-006.500 7528 7393106


Using filters


The filter style used here is the 'display filter' syntax of ethereal explained here
Now I want to just see traffic from one of my iSCSI clients. I can filter iSCSI traffic from IP address 192.168.10.3. N.B. Use quotes to achieve boolean logic, not parentheses '( )'
tethereal -tad -r e0b_20080519_153919.trc -R 'ip.src==192.168.10.3 && iscsi'


Now I want to filer further because I have several iSCSI sessions on that client. I know that the session I am interested in is using port 4704 as its source port. Now I can filter iSCSI traffic to/from 192.168.10.3 AND the port is 4704 AND traffic is iSCSI - useful for watching one iSCSI session.

tethereal -tad -r e0b_20080519_153919.trc -R 'ip.addr==192.168.10.3 && iscsi &&; tcp.port==4704' 


Here is that filter in action. We see that we only see writes to a specific LUN which is what we expect in this example since I know that each session on the client only writes to one iSCSI LUN.

-bash-3.00$ sudo tethereal -tad -r e0b_20080519_153919.trc -R 'ip.addr==192.168.10.3 && iscsi && tcp.port==4704'
16620 2008-05-19 15:39:19.894110 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Read(10) LUN: 0x0a (LBA: 0x00000001, Len: 1)
17072 2008-05-19 15:39:19.935890 192.168.10.5 -> 192.168.10.3 iSCSI SCSI: Data In LUN: 0x0a (Read(10) Response Data) SCSI: Response LUN: 0x0a (Read(10)) (Good)
17172 2008-05-19 15:39:19.943567 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x0a (LBA: 0x0146c3a0, Len: 96)SCSI: Data Out LUN: 0x0a (Write(10) Request Data)
39667 2008-05-19 15:39:20.957360 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x0a (LBA: 0x0146c400, Len: 96)SCSI: Data Out LUN: 0x0a (Write(10) Request Data)
39909 2008-05-19 15:39:21.019261 192.168.10.5 -> 192.168.10.3 iSCSI SCSI: Response LUN: 0x0a (Write(10)) (Good)
40226 2008-05-19 15:39:21.036799 192.168.10.3 -> 192.168.10.5 iSCSI SCSI: Write(10) LUN: 0x0a (LBA: 0x0146c460, Len: 96)SCSI: Data Out LUN: 0x0a (Write(10) Request Data)

Tuesday, 1 April 2008

Commnd line options in perl

# Usage ./this_script-f /tmp/somefile.out -l 21,22,23,24

use Getopt::Std;

#Required if using strict.
our($opt_f,$opt_l);


getopt('fl');

my $inputfile=$opt_f;

my @list=split /,/,$opt_l;