Thursday Apr 03, 2008

Work IT catching up with home IT

At long last my home directory in the Office has caught up with my home directory at home and the one on my laptop and now lives on ZFS. Even better the admins have delegated snapshot privileges for my home directory to me. So now I have a scrip that snapshots my home directory every time I insert my smart card:

#!/bin/ksh -p

now=$(date +%F-%T)

exec mkdir $HOME/.zfs/snapshot/user_snap_$now

This is then called using utaction:

utaction -c ~/bin/sh/snap 

Which is in turn started automatically via the session magic that gnome does (Preferences->Sessions->Start Up Programs).


You will notice that I use mkdir to create the snapshot this is great as it allows me to run the script on an NFS client but does prevent me from doing a recursive snapshot which if I had other file systems I would like.

Update. I just realised that my nautilus script is now useful at work. Cool.

Thursday Sep 06, 2007

nautilus meets zfs snapshots

After ZFS saved the day earlier in the week I wanted to get to the stage where the email to me was not required, at least if the user is on the a Solaris system.

So I've updated my zfs_versions script which you will recall prints out all the versions of a file that exist on a zfs file system. The new script has an additional flag so that it can better support a nautilus script that allows you to highlight a file, then it will list all the versions of that file, not all the snapshots, but all the distinct versions of the file.




Choose the show_versions script. In a fit of recursion you can see the example is for the show_versions script




Finally select the version you want:




It will then open a nautilus window in the directory that contains the version of the file. What is more it even works over NFS.

You need 2 scripts:

  1. zfs_versions, this must be in your path without the .tcl postfix.

  2. show_versions. This has to be stored in the .gnome2/nautilus-scripts directory in your home directory.

Make both scripts mode 755 and then run “nautilus -q”.

Things to note.

It considers the file to be the path to the file. So if you rename a file you will not see revisions with the old name. It would be really cool if there was a way to get all the versions of a file without resorting to doing an exhaustive search of the file system, but there is not.

I don't know how to make the available to all users without messing in each ~/.gnome2 directory. If you do then add a comment.

Hat tip to Sandip for alerting me to nautilus scripts.

Monday Sep 03, 2007

ZFS saves the day

I just got this email1 from a user of my home server:
I have need of your rinky dinky back up system.
There is a file in My_Documents\\Correspondence called "XXXXXX" which I have overwritten somehow in error. Can you get the orginal back? I created it last week (Monday I think) and have not updated it since, except to overwrite it today!!

Well it turns out I can:


# /home/cjg/bin/sh/zfs_versions 'XXXXXX.odt' 
/home/user/.zfs/snapshot/day_2007-08-27-01:01/My_Documents/Correspondence/XXXXXX.odt
/home/user/.zfs/snapshot/hour_2007-09-03-12:00/My_Documents/Correspondence/XXXXXX.odt
/home/user/.zfs/snapshot/minute_2007-09-03-12:30/My_Documents/Correspondence/XXXXXX.odt
/home/user/.zfs/snapshot/minute_2007-09-03-12:50/My_Documents/Correspondence/XXXXXX.odt
/home/user/.zfs/snapshot/hour_2007-09-03-13:00/My_Documents/Correspondence/XXXXXX.odt
# 

Choose your version.


1I've anonymized the email.

About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« July 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today