SMB protocol version of an active cifs mount on Linux [Updated [again]]

In my current-as-of-last-Summer job I got tasked with doing some analysis related to SMB data traffic, and in this context the question arose:

“Which SMB protocol version is this mount using?”

The server in question is running gentoo linux, the client Ubuntu, both of them new-ish. Update: both server and client are using samba (4.1.17 / 4.1.6) to export and mount the share, resp.

To my consternation, the answer is simple but was rather hard to find (for me), so to help other poor souls in the same situation, but mainly to aid my memorising process, I’m writing this down (No altruism here, I’m afraid 😉 ).

so … drum roll … here goes:

$ cat /proc/mounts

on the client, that’s it.

here’s my example (with some obfuscation in place which is irrelevant for the example; bold by me):

$ cat /proc/mounts|grep <sharename>
//<IP>/<sharename>/ <mntpoint> cifs rw,relatime,vers=1.0,cache=strict,username=guest,domain=VMCTRL-1ABCF5AB,uid=0,noforceuid,gid=0,noforcegid,addr=<IP>,file_mode=0755,dir_mode=0755,nounix,serverino,noperm,rsize=61440,wsize=65536,actimeo=1 0 0
$

to prove that’s what I was looking for, I unmounted the share and re-mounted using ‘-o vers=3.0’, after which the output of the above changed accordingly. QED.

PS: if you know of a way to get this same information from the server side, I’d appreciate a comment. TIA 🙂

2nd Update: In response to my PS: in current-ish versions (I’m looking at 4.4.2, don’t know precisely when this came in), ‘smbstatus’ prints this information with the “PID” group unter “Protocol version” (I shortened the output lines a bit for readability):

smbstatus -p

Samba version 4.4.2
PID     Username     Group        Machine                 Protocol Version...      
-------------------------------------------------------------------------...
22857   nobody       nobody       <IP> (ipv4:<IP>:34567)  SMB2_10...                    
$

 

Posted in Uncategorized | Leave a comment

recently, on my way to work

I took this in April on my way to work.

dawn

Posted in Uncategorized | Tagged | Leave a comment

working around “sqlite3.OperationalError: database or disk is full”

For my job at Intel, I recently started working with some python code that – among other stuff – accesses an sqlite database. The DB in question is currently around 3GB in size. One of the things this code does is generate a report for a given month, say “2013-10”, and it submits an sql statement to sqlite that goes something like

               SELECT * FROM <table> WHERE date => 2013-10-01 AND date <= 2013-10-31.

Since I’m expecting to have to run this for every month of 2013, and experience tells me that when my internal clients will want it, they’ll want it right now, I wrote a wrapper script around this code that calls this python script N times in parallel, each for a different month. This worked fine as long as N was 2 or less. When I started increasing N to 3 or more, sooner or later the sqlite ‘execute’ statement would throw an exception:

               sqlite3.OperationalError: database or disk is full

but the disk the DB file is on is nowhere near full (unless you consider close to 700GB free space as “full” in this context ;-). After doing some research, I found out that this happens because sqlite uses /var/tmp to store temporary data, and /var/tmp (this is a linux box) is running out of disk space. This makes sense as /var/tmp had about 7.5G free space before I started my script, and this free space would drop to below 1GB during my tests.

Further research showed that using the sqlite pragma temp_store command I can tune where temporary data is stored, according to the documentation setting this value to 2 causes temporary data to be stored in memory. I first tried this using the commandline utility:

               sqlite> pragma temp_store = 2;

but my tool still threw an exception.  When I exited and then re-started sqlite, the value was back to 0 – this seems to be a per-connection setting. I put this piece of code into the session establishment function:

               self.__cursor.execute("PRAGMA temp_store = 2")

This has caused the exception to disappear.

Posted in Uncategorized | 2 Comments

“A Wake for Sun” and other stuff

I recently came across http://consultingadultblog.blogspot.co.uk/2010/01/life-in-boys-dorm-my-career-at-sun.html and enjoyed it very much – if you ever spent as much as a few months at Sun, I’m sure you will too! Thx a lot to Nancy for writing this up (down?).

On a more personal note: it’s been a while since I wrote anything here … I concluded my spree as a contractor end of last September, mainly for personal reasons (I still think of myself as a friend of my former colleagues at Green Digit, I hope they think the same way about me), and decided to become a “regular” employee again. In October 2012, I joined Intel’s Mobile Communication Group in Neubiberg (south of Munich) where I’m now working on something completely different (I don’t write this just to be able to quote Monty Python 😉 … which I can’t talk about in too much detail, I’m afraid, only so much: no C, lots of python. Python is fun, and it’s quite interesting when over 95% of one’s coding work so far has been done in C. Maybe more on that another time.

My commute dropped from 100km one way to ~50km one way. Quite an improvement!

Posted in Uncategorized | Leave a comment

new photos

just in case someone’s interested 🙂

I recently added two new galleries here – enjoy.

Posted in Uncategorized | Leave a comment

And now …

… you’re probably expecting the famous quote from Monty Python – you can find that here; where you can read a bit more about my last day at Oracle. I do sympathise with Jim Gosling who called his post-Sun blog On a new Road … and here I am, a few months later, definitely on a new road!

I’ve been busy. Here’s why:

Although I certainly had my own thoughts about what the acquisition of Sun by Oracle (Feb 15 2010) was doing to the Sun engineering force, its customers, its engineering culture and to my own career, I was more than a little miffed when said career, which had started over 12 years previously and had taken me from Services in Germany to Solaris network engineering in California and finally to MySQL engineering back in Germany, came to a rather unceremonious end in mid-November of last year.

Even given the fact that my contract with Oracle USA (I was at the time an US employee, even while I was living in Germany – I believe that was in part responsible for what happened) was – like most employment contracts in California – “at will” employment, I was a little disappointed at the apparent disinterest in my continued service being displayed (if my contradictory use of words may be excused here) by the “official” company; my management in the MySQL organisation told me, and I have every reason to believe them, that they were as frustrated with the situation as I was.

Luckily, I was able to return, in a sense, to a job as a Software Engineer at an “old haunt” – specifically, to Utimaco in Munich, after a comparatively short time. As I worked for Utimaco in Linz before moving to Germany in 1998, it was a sort-of homecoming, though I’m sorry to say I wasn’t as happy there as I’d hoped I’d be; apparently both I and the company have changed quite a bit since I left in 1998, and I began to look around again in early 2011.

One thing that’s been obvious to me for quite some time is the immense amount of research and development going on in Austria and (Southern) Germany in manufacturing-related industries such as aerospace and automotive. So even though I had no experience at the time in any of those areas, I started to look into that market seriously, as far as it applied to SW Engineering and myself, and got lucky in late February, when I came across a job posting by my current employer, Green Digit GmbH, a consultancy firm. I had seen one of their ads once before, and it stuck in my memory, so when I came across it a second time, I called them on an impulse. As I learned quite quickly, this is a very small outfit, and the CEO is also the guy who answers the phone in most cases, makes the coffee and conducts job interviews (not necessarily in that order ;-). After we’d chatted on the phone for a while, he asked (I still think he decided to do so about two seconds before) me whether I’d want to come over for an in-person interview the next day (that was before he’d even seen my resume), and I said yes, and I did. My first impression from the phone conversation – that we’d get on well – was confirmed, and after we’d talked for two hours and given ourselves a few days to think about the respective other’s propositions, we signed my contract which began on Apr. 1st.

As I indicated above, Green Digit is a consultancy, so we immediately started to look for a customer for my services, and we were lucky again, because Green Digit had a signed contract from this customer for a 18-month-plus period about an hour after I left their premises for my in-person interview on March 1st.
After a self-imposed “sabbatical” of one month in March, I started working there in April (While I’m not at liberty to name any names, I think it’s OK to say that I’m now working in the automotive industry for a subsidiary and supplier of one of the bigger German car makers, and I’m working on a part of the next-generation infotainment solution), and even though there’s a lot of stuff to learn and expectations (on my part) to overcome, and even though my commute grew from about 1 minute and about 20 meters (when I was working from home for Oracle) to >1hr and >100km, one way, I’m greatly enjoying what I’m doing, and am looking forward to the time ahead of me … or, in the immortal words of Frank Herbert, “surprise me, holy void!”

Posted in Uncategorized | 1 Comment

nod, nod

I came across this post a moment ago, and found myself agreeing with most points all the way (vi!) – and I’m not even an admin, but my service work must have rubbed off …

Luckily, there’s vim for Windows (yes, that’s what I hack on these days, more’s the pity).

Posted in Uncategorized | Leave a comment