Opensolaris 2009.06 live-CD

opensolarisI’ve received today the original Opensolaris Live-CD I ordered for free some days ago… thanks Sun!

You can order a free live CD from Sun: https://oscd.sun.com/ after registrering a free My Sun account, or download it from here.

My Greasemonkey script for TVsubtitles

I’m often going to TVsubtitles to download subtitles for TV shows episodes. But the original page doesn’t provide an optimized flow: for example, on the home page there are two sections called “Latest subtitles” and “Most downloaded subtitles”, but they don’t link to the subtitle files. Instead they link to intermediate nagging pages where you then can download the subtitles.

For example, today it appears like this:

tvsub00

Without Greasemonkey script

the Weeds 5×01 doesn’t link to the subtitle file, but links actually to an intermediate page:

tvsub01

Intermediate (and useless) download page

To remediate this and get direct download links, I’ve made the following Greasemonkey script:

// ==UserScript==
// @name           tvsubtitles.net
// @namespace      tvsubtitles.net
// @description    tvsubtitles.net
// @include        http://www.tvsubtitles.net/*
// ==/UserScript==

// http://www.tvsubtitles.net/subtitle-63109.html (/subtitle-) -->
// http://www.tvsubtitles.net/download-63109.html (/download-)

var allLinks, thisLink;

xpath = '//a[contains(@href, "subtitle-")]';

allLinks = document.evaluate(xpath,document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);

for (var i = 0; i < allLinks.snapshotLength; i++) {
	thisLink = allLinks.snapshotItem(i);
	thisLink.href = thisLink.href.replace(/subtitle-/,  "download-");

	if( thisLink.title != "" ) {
	   thisLink.firstChild.textContent = thisLink.firstChild.textContent + " (" + thisLink.title + ")";
	}
}

With that script, the link to the intermediate page is replaced by a link to the subtitle file, and some information about the release corresponding to that sub file is also added:

tvsub02

Using my Greasemonkey script

UPDATE: I’ve just seen that there are 2 similar existing scripts on userscripts.org. At least mine is the only one that add the Release info to the links ;-).

Upgrading to Opensolaris 2009.06

Released few days ago, Opensolaris 2009.06 comes with a lot of new features (see Release notes and “What’s new“), like for example support for Sparc hardware (sun4u, sun4v), network virtualization with Crosbow, improvements in CIFS and ZFS time-slider snapshots (read this!),…

So last night I decided to upgrade my Opensolaris 2008.11 server to 2009.06. I have more than 7 years working in Unix administration, but I have to recognize that a full OS upgrade is always something a bit scary and risky. But honestly, upgrading Opensolaris is scarily easy — much like Debian or Ubuntu — and also safe!

  • Easy upgrade:

The upgrade process can be run with two command:

$ pfexec pkg install SUNWipkg
$ pfexec pkg image-update -v

Or more easily by running the IPS Package Manager graphical interface.

  • Safe upgrade

Yes, upgrading the full Opensolaris OS is safe, thanks to ZFS and Boot Environments. Whenever you upgrade a critical package or the full system: Opensolaris creates a new BE, that is a bootable ZFS clone (writable snapshot) of the actual running OS filesystem. The corresponding entry in GRUB is automatically added, of course!

The upgraded packages are actually installed on the recently created BE. Once finished the package installation, just reboot into the new BE and you get your new OS release runnung. Should something go wrong, just reboot into the previous BE.

BEs consum space based on the upgraded files only, so if you upgrade just a few packages, it won’t eat a lot of disk. Of course, upgrading the full OS is more space consuming:

NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool/ROOT                 7.24G  78.4G    18K  legacy
rpool/ROOT/opensolaris     8.31M  78.4G  2.60G  /
rpool/ROOT/opensolaris-1   7.60M  78.4G  3.19G  /
rpool/ROOT/opensolaris-2   35.3M  78.4G  4.21G  /
rpool/ROOT/opensolaris-3   7.19G  78.4G  4.59G  /

You can manage (mount, umount, activate, and destroy…) BEs with beadm(1M):

  • Unfortunately upgrading Opensolaris is a bit slow! Yes IPS is great, but at the moment it is really slow — compared to Debian’s APT for example. In my case I left the upgrade process all night and when waking up it was upgraded ;-):

Et voila:

$ cat /etc/release
                         OpenSolaris 2009.06 snv_111b X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                              Assembled 07 May 2009

showRSS — all your tv shows, one feed, their torrent

tvrss.net is down… maybe it’s just temporary… I hope so.

In the meantime, to feed your uTorrent with the latest episodes of your favorite TV Shows, you can switch to showRSS (free registration required):

showRSS — all your tv shows, one feed, their torrent.

ZFS Auto snapshots and Samba

You may have constated that snapshots generated by timf’s ZFS Auto Snapshots for Opensolaris are not Samba friendly.

If you look at the snapshots name, you’ll see they include a colon:

root# zfs list -t snapshot | grep mybook/share
NAME                                                                USED  AVAIL  REFER  MOUNTPOINT
mybook/share@zfs-auto-snap:daily-2009-05-12-00:00                    35K      -   322M  -
mybook/share@zfs-auto-snap:daily-2009-05-13-00:00                      0      -  6.29G  -
mybook/share@zfs-auto-snap:daily-2009-05-14-00:00                      0      -  6.29G  -
mybook/share@zfs-auto-snap:weekly-2009-05-15-00:00                     0      -  6.29G  -
mybook/share@zfs-auto-snap:daily-2009-05-15-00:00                      0      -  6.29G  -
mybook/share@zfs-auto-snap:daily-2009-05-16-00:00                    79K      -  6.29G  -
mybook/share@zfs-auto-snap:daily-2009-05-17-00:00                  7.18M      -  16.7G  -
mybook/share@zfs-auto-snap:daily-2009-05-18-00:00                      0      -  16.7G  -
mybook/share@zfs-auto-snap:daily-2009-05-19-00:00                      0      -  16.7G  -
mybook/share@zfs-auto-snap:daily-2009-05-20-00:00                      0      -  16.7G  -
...

When exported with Samba, Windows clients will see the snapshots like this:

zfs-snapshots-samba

It’s not even possible to open the snapshot directories from Windows.

How does timf’s ZFS Auto Snapshots work? They are launched by zfssnap user’s crontab:

root# crontab -l  zfssnap
0 0 1 1,2,3,4,5,6,7,8,9,10,11,12 * /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:monthly
0 0 1,8,15,22,29 * * /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:weekly
0 0 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 * * /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:daily
0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:hourly
0,15,30,45 * * * * /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:frequent

The script launched is actually the same as the service method: /lib/svc/method/zfs-auto-snapshot

If we look at it, we can see, among other options, that there is a SEP variable to change the “:” separator character (around line 65):

61
62 # A separator character for date strings, and to delimit
63 # snapshot label names. Needed because apparantly Samba
64 # clients can get confused by colons. Who knew?
65 SEP=":"
66

Change SEP to be for example “_”, and you’ll be able to see and open your snapshots from a Windows client!

Now what happends to all the snapshots created before we change the this? If we leave them with the colon, they won’t be destroyed when their time arrives…

So we need to rename them accordingly to the new separator. This can be done with the following scriptlet:

zfs list -t snapshot -H -o name |
   grep "zfs-auto-snap" | grep ":" |
while read NAME
do
   NEW="$( echo "${NAME}" | tr ":" "_" )"
   echo Renaming ${NAME} ${NEW}
   zfs rename ${NAME} ${NEW}
done

Now this is how the snapshots will appear from a Windows client: their names are now displayed correctly, and you can enter any of them to browse the files and directories at the date of the snapshot. Great!

zfs-snapshots-samba2




Close
Powered by ShareThis