2009-11-26

nested nfs mounts on Linux

I upgraded my Ubuntu from Jaunty Jackelope to Karmic Koala. Since then, my NFS mounted home directory is not mounted after boot. The Ubuntu splash screen even says so and offers me to press ESC and help myself in a shell.

I can manually mount my file systems and continue. However, at the next boot it's the same again.

This is how my /etc/fstab looked:
...
server.mycompany.ch:/home          /home          nfs  defaults,udp 0 0
server.mycompany.ch:/home/users    /home/users    nfs  defaults,udp 0 0
server.mycompany.ch:/usr/export    /usr/export    nfs  defaults,udp 0 0
...

My home directory is in /home/users. Maybe it does not like the nested NFS mounts any more (is used to work for many years, though).

Removing the line with "/home" fixed the problem indeed!
...
server.mycompany.ch:/home/users    /home/users    nfs  defaults,udp 0 0
server.mycompany.ch:/usr/export    /usr/export    nfs  defaults,udp 0 0
...

I did not investigate what change in Ubuntu/Linux causes this change of behavior. However, the solution is simple enough so that I thought I want to share it with my blog readers. Enjoy.

2009-11-11

Unix time conversion

Good evening,

This is my first post in my first blog. After a 29 years in the computer business, I finally decided that blogs may be a good thing, after all. Not for reading, no, but I finally found it may be a good thing to write. So here comes my first snippet, a discovery that eluded me since the first of January, 1970. Or nearly so: the Unix time format and its conversion to and from the human calendar.

Question:
How do I convert a Unix timestamp into a human-readable date-time string?

Answer:

date -d @<timestamp>

Example:
$ date -d @1257958548
Wed Nov 11 17:55:48 CET 2009

Explanation:
The GNU version of the date command takes the -d option. An @-sign in front of a plain number specifies a Unix timestamp (i.e. the number of seconds since 1970-01-01). This works only on GNU/Linux date, all other Unix variants are helpless.


Question:
How do I convert human-readable date-time string into a Unix timestamp?

Answer:

date -d "Month Day hh:mm:ss TZ Year" +%s

Example:
$ date -d "Nov 11 17:55:48 CET 2009" +%s
1257958548

Again, you must use date from GNU/Linux or you are out of luck.

Enjoy!