Lighthouse      Zap's Digital Lighthouse
   


About
Zap's Digital Lighthouse is
a Blosxom weblog for our digital outpost on the Internet

For info
info@rax.org


Useful links:
Google
Cyberpresse
The Reg
Slashdot
FreeBSD
LinkedIn
Twitter
Boursorama
RAX
zap
Soekris
xkcd
AirFrance
Wiki soekris
Wikipedia
Wiktionary
ACME
blosxom

Categories:
/FreeBSD (12)
/blosxom (6)
/hardware (2)
/inet (2)
/misc (4)
/notwork (1)
/software (2)

Archives:
 2012 (30)   
 | February (11)
 | January (19)
 2011 (3)   
 | December (1)
 | November (2)
 2008 (1)   
 | October (1)


Blosxom

       

Mon, 20 Feb 2012

Going for simple FreeBSD instead of FreeNAS

So, I have been playing with my small soekris net6501-70-based NAS device for home.

Lots of things have happened since I last blogged about this:

  1. I decided not to use FreeNAS 8 on my net6501, but rather to just use FreeBSD 9 with ZFS, NFS, Samba, and rsync.
  2. I have copied my olde NSLU2 shared space onto my net6501 under ZFS... it took over 24 hours to copy over the network, the NSLU2 being fairly slow.
  3. I have set up a script to take snapshots of my ZFS storage on a regular basis using a script I found on the internet: zfs-snapshot.sh... this is almost as nice as have the Mac OS X time machine on my little NAS server (ok, not as nice, but still pretty good)
  4. I have had some difficulty with an old Maxstor 1TB USB drive, which seems to appear/disappear... it has caused corruption in my main ZFS pool, which I needed to fix manually, and then scrub the ZFS pool (which took almost 7 hours).
  5. Given all of this, I have ordered a small HP microserver. External USB drives are handled strangely by server O/Ses as they appear/disappear, change device names, etc. Let see how well the microserver will do.
  6. By the way, when dealing with External USB disks, never use device names (such as /dev/da0 or /dev/da1s1a...); these names can change dynamically as drives are plugged in, or powered off, etc. Always label your filesystems (e.g. for UFS: tunefs -L disk1 /dev/da0s1a, which then appears as /dev/ufs/tunefs; or for GPT disks: /dev/gptid/760ae9e2-5988-12f1-a136-000054cf2648) and use these names in ZFS or fstab... this will avoid a LOT of grief when reboting, or disconnecting or reconnecting a device, or indeed when a device fails.

So, lots is happening with my small NAS server.

More on this next weekend.

/FreeBSD | Posted at 01:01 | permanent link

Upgrading FreeBSD from 8.2 to 9.0

I have just finished upgraing one of my FreeBSD machines from 8.2 to 9.0, rebuilding from source as explained in the FreeBSD handbook here.

One of the painful steps in upgrading a FreeBSD machine, is the mergemaster step, as it forces you to go through a whole bunch of files, just to accept CVS tag changes... or so I thought !!! Turns out that there are optional flags to mergemaster, and running "mergemaster -FiU" does pretty much what I've been hoping mergemaster to do. Yay!

/FreeBSD | Posted at 00:41 | permanent link

Sun, 12 Feb 2012

FreeNAS, ZFS, and external USB disks

I have set up my Soekris net6501 with the latest beta of FreeNAS 8, FreeNAS-8.2.1-ALPHA-r10110M-x64. I installed 4 external 1 TB external USB disks on the machine, and set them up as a RAID-Z ZFS volume in FreeNAS and set about exporting CIFS and NFS partitions to the rest of my household. FreeNAS 8 is going to be an excellent product when it releases v.8.2.1... I look forward to seeing it in use in the coming months.

However, I have received the following FreeNAS alert twice now: The ZFS volume status is UNKNOWN: One or more devices has experienced an unrecoverable error. An attempt was made to correct the error. Applications are unaffected.Determine if the device needs to be replaced, and clear the errors using 'zpool clear' or replace the device with 'zpool replace'.

Interestingly enough, both times the error was corrected without any problem and the ZFS pool was back in HEALTHY state when I looked into it, but still that message sounds fairly omnious. Could it simply come from the fact that the drives go to sleep and are sometimes not ready when ZFS tries to access them (hence they somehow timeout)??? Or is it something more serious and one of my (new) drives is about to go south?

I wonder whether there are any recommendations against setting up a RAID-Z zpool across external USB drives that can go to sleep (and hence take 30-60 seconds to wake up). Hmmmm, I should investigate ZFS best practices and see if USB drives are usable this way. Else, I'll just stick with UFS with rsync for replication/backup.

More next weekend :-)

/FreeBSD | Posted at 23:34 | permanent link

4 wins in a row for the Montreal Canadiens

I listened to the hockey game between the Montreal Canadiens and the Toronto Maple Leafs last night on ''internet radio''.

Montreal won 5-0 which gives them a 4-games winning streak (haven't seen too many of these this season!). NHL hockey is fun, but it's always particularly fun when Montreal beats Toronto or Boston :-) (Now, of course, these guys probably feel particularly smug when they beat the Canadiens, but I'm not going to worry about that :-)

/misc | Posted at 03:14 | permanent link

Fri, 10 Feb 2012

Using virtual machines at home

I have been architecting, recommending, and specifying the use of irtual machines at work for years, but I had never really used them seriously at home yet until recently. I had looked into using either Parallels or Fusion on my Macs to run Windows seamlessly, but in the end had always reverted to just using Apple's bootcamp, which always did the job for what I needed (except for the @!$&#^!%# graphics drivers in bootcamp which never seemed to be up to snuff).

However, given my recent purchase of a decent PC, I looked into the possibility of running FreeBSD in a virtual machine to take advantage of the CPU speed and sizable RAM to compile kernels for some of my smaller machines faster (running a whole buildkernel buildworld installkernel installworld cycle on a Soekris net4801 takes over 24 hrs which isn't fun).

I investigated various options, but it turns out that the best/most convenient is to run the vmware player under Windows 7 on my PC... using that, I can install FreeBSD 9 in either 32-bit or 64-bit mode, and just "play" whichever version of FreeBSD I need to run tests (or compilations) in a window. There is something inherently fun in having FreeBSD boot and discover the hardware of the virtual machine. Quite useful, quite powerful... just fascinating.

Of course, we are living in a world where one can run a full PC emulator written in javascript in a browser, and boot linux onto it, as I have blogged about recently here. The IT world is fascinating: every 5 years we reinvent the impossible.

/software | Posted at 01:03 | permanent link

Mon, 06 Feb 2012

Watching the superbowl on TV

It's nice to be able to watch Superbowl XLVI on TV, right here in Paris. The TNT channel W9 is showing the game direct from Indianapolis. It's a bit late (actually, it was already tomorrow here in Paris, as the game started :-) but it's quite nice to watch!

2nd quarter's almost over, and the NY Giants have been dominating the game from the start... but the score is only 9-3: the Patriots still have a chance if they get their act together.

...it is cold in Paris (-5 Celcius), so it's nice to watch the game under a warm blanket... I may drift to sleep during the halftime show though: my alarm clock is set for 04:40 in the morning.

Update 1: 10-9 for the Patriots at the end of the 2nd quarter. Hey, game's not over! Not the time to fall alseep yet!
Update 2: good, enjoyable, halftime show by Madonna! An impressive performer who knows how to put on a show.
Update 3: 17-15 Patriots at the end of the 3rd quarter. The Giants have been leaving too many points on the field: it's going to be tough for them. Good game so far... let's see if the 4th quarter keeps me awake :-)
Final update: Giants win 21-17. What a game. Off to sleep now.

/misc | Posted at 01:37 | permanent link

Identity services

A quick follow-up to my recent blog entry about identity servers on small home networks:

  • I have been playing with FreeRadius (available on FreeBSD as part of the ported packages -- /usr/ports/net/freeradius2, I believe) to see if I could use that as an identity server for my home network... to be investigated further in the coming weeks.
  • On a loosely related topic, I find the myOpenID services interesting, especially the "myOpenID for domains" stuff. It seems like I could use this to enable OpenIDs like http://openid.rax.org/my-name to work? It looks like it might be free if I have 10 IDs or less on my domain. Interesting. However, I need to see what level of independence I would need to lose on my domain (including the ability to change providers in the future) if I did that.
  • More interesting stuff to investigate on future weekends :-)

/FreeBSD | Posted at 00:13 | permanent link

Sun, 05 Feb 2012

What this blog is not about

By the way, just in case anybody wanders here and is curious as to whether anything I write here is related to personal hobbies or work, let me state explicitly that I do not intend to blog about work-related topics or express any work-related opinions here.

Work-related social networking belongs on work-sanctioned forums or communities... so this blog is purely about personal stuff and interests, and any opinions expressed here are my own.

/notwork | Posted at 23:47 | permanent link

Moving forward with FreeNAS

FreeNAS 8 is a nanobsd configuration, based on FreeBSD 8.2. In order to boot FreeNAS 8 on my Soekris net6501 under the amd64 image of FreeNAS, one needs to rebuild the FreeBSD kernel that is at the heart of FreeNAS with the line "device mptable" added to the kernel configuration file, as described on the unofficial Soekris wiki here.

Therefore, I used the instructions from the FreeNAS Forums here to set up a VMware virtual machine running FreeBSD to setup the FreeNAS sources, adjusted the kernel configuration file in "/usr/local/freenas/trunk/nanobsd/FREENAS.amd64" to add the device mptable line as described above, and then built a FreeNAS-8.2.1-ALPHA-r10006M-x64 image that I put onto a USB key and booted my Soekris net6501 with it.

FreeNAS 8 seems to look good on the net6501 and I am able to set it up with 2 external 2 TB USB disks partitioned with ZFS. For some strange reason, the FreeNAS 8 website seems to call for at least 6 GB of RAM to run it with ZFS, but my 2 GB net6501 seems to do just fine so far.

So, I just need to complete the set up of my FreeNAS box, export one of the disks through CIFS, NFS, and rsync, and set up a regular backup from disk1 to disk2. Once that runs fine, I can probably connect a 3rd 2 TB drive to that net6501, and set up some form of RAID-5 between the 3 drives (with snapshots, perhaps I don't need the weekly backup from disk1 to disk2, as I normally do on my NSLU2).

FreeNAS seems like a winner so far. More info later.

Miscellaneous comments & ramblings:

  • I still need Soekris to fix the USB boot code on the net6501 before I consider this completely operational: the net6501 will freeze on boot when my two 2 TB external USB drives are connected at boot time. Works fine when I connect them after the machine has booted... if at least Soekris could add an option in the BIOS to not scan certain USB ports for bootable devices, I could move forward.
  • FreeNAS 8 is based on FreeBSD 8.2, which is unfortunate as it only has ZFS v15, as opposed to FreeBSD 9.0 which comes with ZFS v28 (and perhaps the upcoming FreeBSD 8.3 also?)
  • There appears to be a certain amount of tension between the "new" FreeNAS 8 team, and the "legacy" FreeNAS 7 team. The latter has based FreeNAS 7.5 on FreeBSD 9.0 to get the newest FreeBSD stuff (including ZFS v28 as stated above) and is starting to talk about calling its branch FreeNAS 9, which is not going over too well with the FreeNAS 8 people (who actually own the FreeNAS trademark). Seems like FreeNAS 7 will either die or else it will need to fork off with another name (see here).
  • I don't have a strong opinion on this at this point, except for the fact that I am disappointed that FreeNAS 8 specifies minimum RAM requirements which seem to me to be unreasonably high (4 GB minimum, and 6 GB minimum if one wants ZFS) for some of the small machines that one could want to run FreeNAS upon. I like the FreeNAS 7 community effort, but I fear that it will end up as a dead-end effort once FreeNAS 8 is solid & feature-complete.
  • Anyway, I decided to set up my NAS server as a FreeNAS 8 server, to see if it ran OK in 2 GB of RAM (which, frankly, I don't see why it couldn't).
  • Seems like the net6501 will work as a home NAS device anyway, so finally I don't need the HP Proliant Microserver I was referring to the other day.

Anyway, enough for tonight... good night to all.

/FreeBSD | Posted at 23:28 | permanent link

Thu, 02 Feb 2012

Compilers in the Open Source world

When Gnu started, way back, one of the first bricks to be laid out in the open source building, was the gcc compiler. Okay, first there was emacs, but that was always a bit of a peculiar animal (to this day, I will sometimes use alternatives such as Gnu Zile instead of plain old emacs).

So, gcc was one of the first bricks that led the open source edifice to be built: compilers were always expensive and complicated software packages before that, but then suddenly, one could compile C code freely, and the compiler wasn't too shabby either: being developed by a large group of individuals from industry and academia, it produced very decent code and its optimizer generated pretty fast code too! (I remember using gcc on a project in 1990 because the code it generated on our project under ultrix ran quite a bit faster than the code generated by the native ultrix compiler).

So it's a bit strange these days to see that there are a number of alternative compilers being used by my favorite open source projects (notably FreeBSD): the old pcc is back, and FreeBSD seems to favour the clang compiler (see also this comparison).

Of course, there's also the question of which language to code in: C, C++ (there's a new 2011 flavour of that), Objective C (hey, isn't everyone doing an iPhone app these days? :-), Java, Scheme, python, Ruby, or any number of weird and wonderful languages. Even 'lowly' Javascript is geting quite powerful... Fabrice Bellard has written a PC emulator in it that's powerful enough to run linux in your browser!

Anyway, lots of possibilities. Just have fun coding!

Update: take a look at the TIOBE Programming Community Index of language popularity.

/software | Posted at 01:06 | permanent link

Wed, 01 Feb 2012

Listening to music

I still purchase music CDs and DVDs -- I guess that makes me somewhat of a dinosaur. I do listen to music online (through Spotify) which allows me to listen to a whole bunch of tunes that I do not have at home but fondly remember from the '80s, the '70s, or even earlier. I also rent movies in iTunes to watch on my iMac or my PC... however, on iTunes, I only use prepaid cards: I don't like leaving my credit card number for recurring purchases... especially since I find that Visa and MasterCard will agree to a recurring credit card charge even if the credit card expiry date has passed. It used to be that you would need to submit your credit card info again, once it has expired, but no longer: they'll just charge you anyway. The first time this hit me was with Apple's MobileMe service: I had let my credit card lag beyond expiration, since I did not intend to renew for one more year, but they still charged my card. Annoying to say the least: clearly not a implementation of the Principle of least astonishment. :-(

Anyway, this being said, when watching movie content, I should ideally set up a Mac Mini or some sort of Apple TV in the living room so that I can watch rented movies (i.e. downloaded content) in the comfort of the living room. Haven't done that yet.
Something on the To Do list, I guess, but kind of low priority.

/misc | Posted at 23:33 | permanent link

Sun, 29 Jan 2012

A microserver for FreeNAS

Food for thought: I've been thinking of rolling my own FreeBSD-based replacement for my old Linksys NSLU2 NAS devices on my home network, based on my recently purchased Soekris net6501 server. However, I have just found a very nice little device on the internet, the HP ProLiant MicroServer which seems quite nice: 4 SATA drives, a dial-core 1.5GHz AMD processor, up to 8 GB of memory in 2 simple DDR3 DIMM slots, 1 Gigabit Ethernet port, and a rather small footprint.

The datasheet is available here.

It is 275-300 EUR (before VAT) on the French HP site. That's less than a net6501. Hmmm.
There are a few models available, and I guess the idea would be to buy one with as little disk space as possible, because disks prices usually fall so quickly that by the time vendors ship NAS boxes to end customers, the prices are already out of whack with the market (Le Zap's rule of procurement: insofar as possible, bandwidth and disk space should be bought at the last minute on the spot market). With at least 4GB RAM, it would be about 400 EUR after VAT... should I just buy one for experimentation? it would be perfect for FreeNAS.

/hardware | Posted at 15:21 | permanent link

Fri, 27 Jan 2012

What are people using for small identity servers at home?

So, on my home network I have:

  • a DHCP server
  • a web server
  • a CIF file server
  • an NFS file server
  • an rsync backup server
  • a network printer
  • a mail server

and various other odds and ends.

However, it strikes me that I do not have a small and simple identity server, where I could define user accounts for all of my various devices and OSes (Windows, Mac OS X, FreeBSD, and probably some Linux also).

What do people use? NIS yellow pages? that seems too unixoid and will probably not help with the Windows machines. Some sort of Microsoft Active Directory? Through Samba? that feels too microsofty perhaps. Is there something that bridges the gap? Going beyond my little home network, is there something that would let me be accepted as an OpenId authenticator? Also, something I could use to allow logins into my machines hosted outside of the home network.

Hmmm. Over the years, we have gotten pretty good at doing IP networks, file sharing, printer sharing, web serving, and even web services and the like... but we are still struggling with having some form of simple authentication mechanism standardized. Probably because it is hard to have trust in authentication mechanisms, and especially the quality of the data they contain(*).

Anyway, that's another interesting weekend project.


(*) Perhaps we are setting the bar too high? I do not need strong authentication with non-repudiation and all that jazz... I would like a simple userid/password mechanism that would return something like the old unix uid/gid, but in 64-bit range, and I would like it to be easily integrated with Windows, Unix, and Mac OS X. Hmmm... fuzzy requirements... it's always more complicated than it looks like. What are people using out there? Any solid and usable public domain reference implementations I could look at and implement? Would Radius fit the bill?

/FreeBSD | Posted at 02:28 | permanent link

Setting up a new NAS device at home

For the last few years, I have been using a couple of Linksys NSLU2 NAS devices coupled with external USB disks for shared storage across my home network. I find that this works quite well to store files from my Mac, Windows, and even FreeBSD machines. One of the NSLU2 is unslung and runs an rsync daemon that I use to save files from my various FreeBSD machines.

The NSLU2 is a nice device, but it had become fairly old (no gigabit ethernet, limited expandability of the software, etc). So I have been meaning to set up a replacement. I have decided to use a Soekris net6501 to build my own little NAS box, using a couple of external 2 TB external drives.

Now, the question is: what software will I run on the net6501? I have been quite tempted by FreeNAS, but FreeNAS 8 has a stated minimum RAM size requirement of 4 GB (with 6 GB listed as the minimum for ZFS usage), and the net6501 is limited to 2 GB RAM (actually, I think that's even a limit of the Intel Atom CPU that it is built upon). FreeNAS 0.7 has a significantly lower RAM requirement, but I am afraid that it will be orphaned, as the main development path for FreeNAS is now version 8.

Of course, I could just set up FreeBSD on the net6501 and be done with it.

Anyway, I still have a few weeks to decide, as I am waiting for a new BIOS release for the net6501, as I am having some issues with the new USB boot code of the Soekris device: if I plug in 2 large (2 TB) external USB disks, in addition to the small internal 8 GB USB key that holds the FreeBSD image, then the device hangs on boot while probing the USB devices. If I just connect the external USB drives after the machine is booted, it works perfectly. I am hoping that the USB probe code will be fixed in the next BIOS release.

Fun for the weekend :-)

/FreeBSD | Posted at 02:06 | permanent link

Mon, 23 Jan 2012

Finding old blosxom plugins

I have set up this little blog using blosxom (from http://blosxom.sourceforge.net). It is an oldish blogging package (in the Internet world, I guess 2003-2005 is getting ancient :-) but I like the fact that it's small, works with simple ASCII text files, and has no dependencies beyond having perl on the system.

The blosxom website also has links to lots of plugins that do useful things, but unfortunately quite a few of the links are now dead.

This is where the Internet Wayback Machine is quite useful. For instance, I was looking for the categorylist plugin, and it had disappeared from the web... well, a quick check in the wayback machine and voilą! the plugin is resurrected from history.

The Internet Wayback Machine isn't perfect, but it does a lot to save the information from the internet and ensure it doesn't just go away.

(Note: some other day, I'll chat about project Guttenberg, another great Internet outpost)

/blosxom | Posted at 02:24 | permanent link

Sat, 21 Jan 2012

Setting up FreeBSD 9.0 with a ZFS root filesystem: Success!

So, I investigated last week's problem with ZFS and FreeBSD 9.0 and I discovered that the problem was very simple to fix. I needed to add:


    # echo 'zfs_enable="YES"'>>  /mnt/etc/rc.conf

to the procedure described last week (on January 15th) so that the zfs mountpoint options would be executed. So now, things are working fine... I am going to play with this configuration a bit to see if the fact that I haven't configured a swap space causes problem with a 2GB memory configuration when I try to compile world.

More later.

Late addition to this post: turns out that the author of the initial page at http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE had also found the error and fixed it on the wiki, but I had not gone back to check. In the end, it's OK, this has allowed me to explore ZFS enough so that I now understand it better.

/FreeBSD | Posted at 19:49 | permanent link

Thu, 19 Jan 2012

Listening to Montreal Canadiens' hockey abroad

All native Montrealers have hockey in their blood. When living away from home, you can listen to the games on internet radio, either in French on fm98.5 at http://www.985fm.ca/webradio/ or in English on Team990 at http://www.tsn.ca/Montreal/listen/.

This is a real lifeline when one feels too far from home... of course, having maple syrup in the house also helps ;-)

/misc | Posted at 02:25 | permanent link

Wed, 18 Jan 2012

IPv6 day for 2012 will be June 6

Seen on http://slashdot.org today: On June 6th, many companies will be enabling IPv6 by publishing AAAA record in DNS, and this time, they are not turning it back off!

This is good news.

I have been running IPv6 in my little part of the Universe for about a year (yes, I know, I should have done it earlier... I've been meaning to do it for 10 years). I even have a subnet at home that is running 100% IPv6. Interestingly enough, while IPv6 is fine, it is not easy to run a plain PC or Mac in an IPv6 only world, as a number of things still expect IPv4 to be visible (or at least, I haven't found the ways to get around it). For instance, while Windows has had support for IPv6 for a long time, my Windows machines on that IPv6 segment cannot seem to find Windows update, and hence no patches get downloaded, which isn't nice.

Browsing the web is also frustrating, because even though Google is visible on the IPv6 internet, the search results returned don't all point to IPv6 addresses (unless I haven't found who to enable that).

Are many people living in IPv6-only worlds? How do you do it?

/inet | Posted at 22:33 | permanent link

Sun, 15 Jan 2012

Setting up FreeBSD 9.0 with a ZFS root filesystem

With the new version of FreeBSD being just out, I decided to try out the ZFS filesystem. Notably, I would like to find out whether it works correctly with 2GB of memory, or whether more is really needed (I read that it doesn't really work with less than 1GB of RAM, but then again, there are conflicting reports that it needs lots more, though sometimes that's qualified with 'if you want prefetch' or 'if you are trying to do dedup'). Actually, I am building a small NAS server I am building around a Soekris net6501-70 which comes with 2GB RAM, and I would like to find out if I can use ZFS with it.

So, I looked up http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE and tried to set up a vmware virtual machine with ZFS only.

I did not bother setting up swap space, nor a mirrored disk configuration, so the commands I used were:

  • boot a vmware virtual machine from the amd64 FreeBSD9.0-RELEASE DVD
  • choose the Shell option at the partitioning dialog in bsdinstall
  • run the following commands:

    # gpart create -s gpt da0
    # gpart add -s 64K -t freebsd-boot -l boot0 da0
    # gpart add -t freebsd-zfs -l disk0 da0
    # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
    # zpool create -o altroot=/mnt zroot /dev/gpt/disk0
    # zfs create zroot/tmp
    # chmod 1777 /mnt/tmp
    # zfs create zroot/usr
    # zfs create zroot/var
    # zfs create zroot/home
    # exit
  • And then, after installation:
    (update: one must add # echo 'zfs_enable="YES"'>> /mnt/etc/rc.conf here as per the post on 21 January)

    # echo 'zfs_load="YES"'>>  /mnt/boot/loader.conf
    # echo 'vfs.root.mountfrom="zfs:zroot"'>>  /mnt/boot/loader.conf
    # zfs unmount -a
    # zpool export zroot
    # zpool import -o cachefile=/tmp/zpool.cache -o altroot=/mnt zroot
    # zfs set mountpoint=/ zroot
    # cp /tmp/zpool.cache /mnt/boot/zfs/
    # zfs unmount -a
    # zpool set bootfs=zroot zroot
    # zpool set cachefile='' zroot
    # zfs set mountpoint=legacy zroot
    # zfs set mountpoint=/tmp zroot/tmp
    # zfs set mountpoint=/usr zroot/usr
    # zfs set mountpoint=/var zroot/var
    # zfs set mountpoint=/home zroot/home

The last 4 commands (i.e. after 'zfs set mountpoint=legacy zroot') give error messages, but I think that's OK. However, once I rebooted the virtual machine, the filesystems (except for /) were not mounted and therefore FreeBSD did not come up properly.

So, this was a first try... More on this next weekend :-)

/FreeBSD | Posted at 22:57 | permanent link

Fri, 13 Jan 2012

FreeBSD 9.0 is out

FreeBSD

Yay! FreeBSD 9.0 is out!

The announcement says:

The FreeBSD Release Engineering Team is pleased to announce the availability
of FreeBSD 9.0-RELEASE.  Some of the highlights:
    - ZFS updated to version 28
    - NFS subsystem updated, new implementation supports NFSv4 in addition to NFSv3 and NFSv2

Please see http://www.FreeBSD.org for more info.

Note also that FreeBSD 9.0-RELEASE is dedicated to the memory of Dennis M. Ritchie, one of the fathers of UNIX.

/FreeBSD | Posted at 21:19 | permanent link

Thu, 12 Jan 2012

FreeBSD 9.0-RELEASE ISO are out

Found the ISO images for FreeBSD 9.0-RELEASE on ftp.freebsd.org and ftp4.fr.freebsd.org.

I've already got the amd64 version installed on a vmware player virtual image successfully from the ISO -- which works beautifully with FreeBSD under Windows 7; check it out!

I'm off to Zurich for a couple of days... more FreeBSD over the weekend.

/FreeBSD | Posted at 03:05 | permanent link

Tue, 10 Jan 2012

Waiting for the next FreeBSD release

I have been setting up a small computer -- a Soekris net6501-70 -- to use as a NAS (Network Attached Storage) device on my home network. The idea is to replace the small, reliable, Linksys NSLU2 (slugs) that I have been using for shared network usage in my home, with a new device with more disk space and Gigabit Ethernet ports since my home network (at least the wired part) is Gigabit Ethernet.

Ideally, I would have liked to run FreeNAS on the device and to run ZFS as a filesystem, but it didn't turn out that way, as the net6501 has 2 GB RAM, and FreeNAS requires a lot more than that.

Therefore I have installed FreeBSD 9.0-RC3 on my net6501-70 and I even had the pleasure to discover that I could run FreeBSD in amd64 mode (i.e. 64-bits mode).

Now, I cannot wait for FreeBSD 9.0 to be finally and officially released, and for the next iteration of the ne6501 combios to be effectively release.

Can't wait!

/FreeBSD | Posted at 00:29 | permanent link

Social networking

Oh well, after literally years of resisting, I have finally opened a LinkedIn account recently, prompted by an old colleague/good friend at ZFS.

Since then, I've been having fun surfing the social networks and adding lots of people I've known in the past, even going back to friends in Canada from university or even high school.

Of course, I worry about publishing all of this information to an external company: this is why I have had neither a LinkedIn account, nor a Facebook account in the past. But, I have to say that it is quite nice to be able to reconnect with people from way back.

| Posted at 00:15 | permanent link

Wed, 04 Jan 2012

Upgrading an OCZ Onyx SSD drive

A while ago, maybe 2 years, maybe 18 months, I bought an OCZ Onyx 32GB SSD drive to put in my Soekris net5501 server under FreeBSD. The idea was that since that machine doesn't get lots of writes, it would benefit heat-wise and speed-wise from having a SSD drive rather than a regular 2.5" laptop drive (which always seem to fail after about 2-4 years of continuous operation).

Well, I have been quite disappointed, because after only a few months of operations, the Onyx started developing a number of read errors and bad sectors. I restored from backups a few times, but eventually it got so bad that I went back to a simple laptop drive for greater reliability.

When I bought a new PC recently, I remembered my Onyx and tried to use it to accelerated my disk accesses through intel's Rapid Storage caching Technology. Well, that didn't work at all because it developed read errors within 24 hours, and so I gave up on that idea and ordered a small Intel drive to use as a cache in my system (which seems to work fine).

Now, being somewhat stubborn, I surfed the web and found that OCZ had a firmware update for my 32GB Onyx drive (upgrade to 1.7)... so I upgraded the firmware to 1.7, and now the drive is in a very strange state: not only does it report that it has a capacity of 128GB (which is quite strange), but also I cannot seem to pqrtition/format it properly in Windows 7 or with the UBCD.

So, I guess I have reached the end of how much time I am willing to devote to this piece of junk, and send it into the recycle bin... truly one of the least positive hardware purchases I have ever made.

/hardware | Posted at 23:33 | permanent link

Tue, 03 Jan 2012

So, I flew on an A380 from Paris to Montreal

So, we landed in Paris this morning on an A380 from Air France. A very nice flight... fast too (5h 30'), but we took off about an hour late. Overall, a positive experience.

| Posted at 11:26 | permanent link

Flying on an Airbus A380

The Airbus A380 is a very nice plane. Quite large. Two floors all the way (as opposed to the Boeing 747 which has 2 floors only in the front part of the plane)... this allows airlines to pack a large number of people in each plane, optimizing revenue on long haul routes that are well travelled. For instance, Air France used to have 4 flights a day between Paris and Montreal; now that one of these flights in an A380, they run only 3 flights.

However, it is also a fairly recent plane.

Now, I have no particular worries about the stability or reliability of that plane; Airbus and Boeing are both extremely proficient at designing, engineering, and building these huge metal birds... and major airlines like Air France, British Airways, Air Canada, Singapore Airlines, etc. are all quite proficient at operating and maintaining them.

However, these big recent planes have anciliary problems: you don't have many backup pilots for them; you don't have many gangways for them. So when you have a problem with crews or logistics, you run a greater risk of running into problems.

So far, I've flown twice on an A380. The first time, the pilot was ill and had to be replaced... however, another A380 pilot had fallen ill on that day, and the backup pilot was already on his way to New York! Had this been an A330 or 767, they probably would have had tons of backup pilots... but in this case, they had to send everyone home and delayed the flight to the next day.

The second time I flew an A380, we arrived 30' early. Unfortunately, our gangway was occupied by another A380 that was delayed and hadn't left the gangway yet. So we had to wait for a whole fleet of busses to come and take us to the terminal (there are many people in n A380, so we needed many busses).

So anyway, my impression at this point is that the A380 is a very nice plane, but because of logistic details, it is probably best avoided for now.

I am going to fly on an A380 for the third time tonight. I'll let you know how that goes.

| Posted at 01:23 | permanent link

Mon, 02 Jan 2012

A New Year

Just a quick entry onto this blog whilst it is still January 1st over here in Canada (regardless of what my European blog engine says :-) to wish all of my family, friends, and readers a very happy 2012: happiness, health, and success to all of you throughout the year!

| Posted at 05:24 | permanent link

Using MetaWeblog with blosxom

Blosxom is nice because it produces a reasonable-looking weblog based on very simple ASCII text files. Therefore, I can just use vi, zile, or emacs to edit blog entries, and they just get posted on the weblog painlessly.

The only problem is that I cannot always access rax.org via ssh. For instance, from work, I can do http, but not ssh. Therefore, it would be nice to be able to do weblog entries using the Scribefire add-on to Firefox once in a while. Scribefire can connect to weblog engines using the MetaWeblog RPC protocol, which blosxom seems to support via a plugin, but somehow, I haven't been able to figure it out yet, and I haven't found too many references to metaweblog4blosxom on the Internet.

Oh well, perhaps I should stick to emacs :-)

/blosxom | Posted at 05:20 | permanent link

Using blosxom for blogging

Hmmm. I've just taken a bit of time over the holidays to properly configure blosxom as my blogging engine.

Took a bit longer than I expected to get plugins and flavours going, but now it's fine. I had writebacks going too, but then I disabled them because I feared to be flooded with spam.

I will wait and see how much use I make of this small blog & then I will decide if I use it enough to spend any time policing spam on the blog.

Overall, I find blosxom an interesting little blog engine, but it seems to have fallen in disuse since 2003, 2004, or so. Any comments from any blosxom users out there?

/blosxom | Posted at 05:19 | permanent link

Sun, 01 Jan 2012

January 1st in Montreal

Looking for a place to have lunch in downtown Montreal on Sunday January 1st is not easy. We walked around rue Ste-Catherine for a while, not finding much that was open (apart from McDonalds and Burger King, which we did not feel like having) except for a dinner that had the excellent idea of being open for business: unfortunately, that meant that 100+ people converged there, and there was a line-up at the door. Then, Sylvie had the idea to walk over to the Chinatown... wow, almost everything was opened and there were tons of people around :-)

We ended up having a Pho and Bo'Bun (sorry for the missing accents) and leaving smiling and happy.

The morale of this story: on January 1st in Montreal, head for Chinatown for restaurants.

| Posted at 10:10 | permanent link

Sat, 31 Dec 2011

Blogging at the end of 2011

I was able to spend some time in these last few days of 2011 setting up blosxom remotely on my little Soekris server. I should be able to blog in 2012, hopefully on a regular basis... nothing too serious, just some random thoughts about what I'm doing as a hobby.

Hope you have fun reading it :-)

/blosxom | Posted at 23:15 | permanent link

Sat, 12 Nov 2011

Moving to IPv6

Actually, this machine is the first one within the rax.org domain that has moved to IPv6.

I have used the facilities provided by SIXXS.net to create a tunnel to an IPv6 network, and have established an IPv6-only subnet on my home network.

I have installed a client MS Vista machine onto this subnet, and I am trying to see what works and what doesn't on this subnet.

I intend to blog about what works and what doesn't in these pages.

/inet | Posted at 22:43 | permanent link

A new Blog

Well, I wanted to install a minimalistic blogging engine on rax.org, so after searching a bit, I settled on blosxom (which is pronounced blossom, actually).

Of course, most blogs don't really survive past the first couple of weeks, so before publicizing this, I'll see it I do generate some content into it :-)

Best regards to all readers!

/blosxom | Posted at 18:50 | permanent link

Thu, 23 Oct 2008

Quick syntax summary for the Markdown blosxom plugin

I have adopted the Markdown plugin to allow some simple wiki-style formatting on my weblog. There is a good summary of the syntax at http://daringfireball.net/projects/markdown/syntax.html, which I have reproduced below:

Markdown: Syntax

*Note:* This document is itself written using Markdown; you can see the source for it by adding '.text' to the URL.


Overview

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions. While Markdown's syntax has been influenced by several existing text-to-HTML filters -- including Setext, atx, Textile, reStructuredText, Grutatext, and EtText -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.

To this end, Markdown's syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you've ever used email.

Inline HTML

Markdown's syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown's formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown's syntax, you simply use HTML itself. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags.

The only restrictions are that block-level HTML elements -- e.g. <div>, <table>, <pre>, <p>, etc. -- must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted) <p> tags around HTML block-level tags.

For example, to add an HTML table to a Markdown article:

This is a regular paragraph.

<table>
    <tr>
        <td>Foo</td>
    </tr>
</table>

This is another regular paragraph.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can't use Markdown-style *emphasis* inside an HTML block.

Span-level HTML tags -- e.g. <span>, <cite>, or <del> -- can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you'd prefer to use HTML <a> or <img> tags instead of Markdown's link or image syntax, go right ahead.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

In HTML, there are two characters that demand special treatment: < and &amp;. Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. &lt;, and &amp;.

Ampersands in particular are bedeviling for web writers. If you want to write about 'AT&T', you need to write 'AT&amp;T'. You even need to escape ampersands within URLs. Thus, if you want to link to:

http://images.google.com/images?num=30&amp;q=larry+bird

you need to encode the URL as:

http://images.google.com/images?num=30&amp;q=larry+bird

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

Markdown allows you to use these characters naturally, taking care of all the necessary escaping for you. If you use an ampersand as part of an HTML entity, it remains unchanged; otherwise it will be translated into &amp;.

So, if you want to include a copyright symbol in your article, you can write:

&copy;

and Markdown will leave it alone. But if you write:

AT&amp;T

Markdown will translate it to:

AT&amp;T

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

4 < 5

Markdown will translate it to:

4 &lt; 5

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single < and &amp; in your example code needs to be escaped.)


Block Elements

Paragraphs and Line Breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line -- a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type's "Convert Line Breaks" option) which translate every line break character in a paragraph into a <br /> tag.

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a <br />, but a simplistic "every line break is a <br />" rule wouldn't work for Markdown. Markdown's email-style blockquoting and multi-paragraph list items work best -- and look better -- when you format them with hard breaks.

Markdown supports two styles of headers, Setext and atx.

Setext-style headers are "underlined" using equal signs (for first-level headers) and dashes (for second-level headers). For example:

This is an H1
=============

This is an H2
-------------

Any number of underlining ='s or -'s will work.

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

# This is an H1

## This is an H2

###### This is an H6

Optionally, you may "close" atx-style headers. This is purely cosmetic -- you can use this if you think it looks better. The closing hashes don't even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :

# This is an H1 #

## This is an H2 ##

### This is an H3 ######

Blockquotes

Markdown uses email-style > characters for blockquoting. If you're familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
> 
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of >:

> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

> ## This is a header.
> 
> 1.   This is the first list item.
> 2.   This is the second list item.
> 
> Here's some example code:
> 
>     return shell_exec("echo $input | $markdown_script");

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.

Unordered lists use asterisks, pluses, and hyphens -- interchangably -- as list markers:

*   Red
*   Green
*   Blue

is equivalent to:

+   Red
+   Green
+   Blue

and:

-   Red
-   Green
-   Blue

Ordered lists use numbers followed by periods:

1.  Bird
2.  McHale
3.  Parish

It's important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

<ol>
<li>Bird</li>
<li>McHale</li>
<li>Parish</li>
</ol>

If you instead wrote the list in Markdown like this:

1.  Bird
1.  McHale
1.  Parish

or even:

3. Bird
1. McHale
8. Parish

you'd get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don't have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    Suspendisse id sem consectetuer libero luctus adipiscing.

But if you want to be lazy, you don't have to:

*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.

If list items are separated by blank lines, Markdown will wrap the items in <p> tags in the HTML output. For example, this input:

*   Bird
*   Magic

will turn into:

<ul>
<li>Bird</li>
<li>Magic</li>
</ul>

But this:

*   Bird

*   Magic

will turn into:

<ul>
<li><p>Bird</p></li>
<li><p>Magic</p></li>
</ul>

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

1.  This is a list item with two paragraphs. Lorem ipsum dolor
    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    sit amet velit.

2.  Suspendisse id sem consectetuer libero luctus adipiscing.

It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:

*   This is a list item with two paragraphs.

    This is the second paragraph in the list item. You're
only required to indent the first line. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit.

*   Another item in the same list.

To put a blockquote within a list item, the blockquote's > delimiters need to be indented:

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.

To put a code block within a list item, the code block needs to be indented twice -- 8 spaces or two tabs:

*   A list item with a code block:

        <code goes here>

It's worth noting that it's possible to trigger an ordered list by accident, by writing something like this:

1986. What a great season.

In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:

1986\. What a great season.

Code Blocks

Pre-formatted code blocks are used for writing about programming or markup source code. Rather than forming normal paragraphs, the lines of a code block are interpreted literally. Markdown wraps a code block in both <pre> and <code> tags.

To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input:

This is a normal paragraph:

    This is a code block.

Markdown will generate:

<p>This is a normal paragraph:</p>

<pre><code>This is a code block.
</code></pre>

One level of indentation -- 4 spaces or 1 tab -- is removed from each line of the code block. For example, this:

Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell

will turn into:

<p>Here is an example of AppleScript:</p>

<pre><code>tell application "Foo"
    beep
end tell
</code></pre>

A code block continues until it reaches a line that is not indented (or the end of the article).

Within a code block, ampersands (&amp;) and angle brackets (< and >) are automatically converted into HTML entities. This makes it very easy to include example HTML source code using Markdown -- just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this:

    <div class="footer">
        &copy; 2004 Foo Corporation
    </div>

will turn into:

<pre><code>&lt;div class="footer"&gt;
    &amp;copy; 2004 Foo Corporation
&lt;/div&gt;
</code></pre>

Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it's also easy to use Markdown to write about Markdown's own syntax.

Horizontal Rules

You can produce a horizontal rule tag (<hr />) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

* * *

***

*****

- - -

---------------------------------------

Span Elements

Markdown supports two style of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text's closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:

This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.

Will produce:

<p>This is <a href="http://example.com/" title="Title">
an example</a> inline link.</p>

<p><a href="http://example.net/">This link</a> has no
title attribute.</p>

If you're referring to a local resource on the same server, you can use relative paths:

See my [About](/about/) page for details.

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

This is [an example][id] reference-style link.

You can optionally use a space to separate the sets of brackets:

This is [an example] [id] reference-style link.

Then, anywhere in the document, you define your link label like this, on a line by itself:

[id]: http://example.com/  "Optional Title Here"

That is:

  • Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces);
  • followed by a colon;
  • followed by one or more spaces (or tabs);
  • followed by the URL for the link;
  • optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.

The following three link definitions are equivalent:

[foo]: http://example.com/  "Optional Title Here"
[foo]: http://example.com/  'Optional Title Here'
[foo]: http://example.com/  (Optional Title Here)

*Note:* There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.

The link URL may, optionally, be surrounded by angle brackets:

[id]: <http://example.com/>  "Optional Title Here"

You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:

[id]: http://example.com/longish/path/to/resource/here
    "Optional Title Here"

Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.

Link definition names may consist of letters, numbers, spaces, and punctuation -- but they are not case sensitive. E.g. these two links:

[link text][a]
[link text][A]

are equivalent.

The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets -- e.g., to link the word "Google" to the google.com web site, you could simply write:

[Google][]

And then define the link:

[Google]: http://google.com/

Because link names may contain spaces, this shortcut even works for multiple words in the link text:

Visit [Daring Fireball][] for more information.

And then define the link:

[Daring Fireball]: http://daringfireball.net/

Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they're used, but if you want, you can put them all at the end of your document, sort of like footnotes.

Here's an example of reference links in action:

I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].

  [1]: http://google.com/        "Google"
  [2]: http://search.yahoo.com/  "Yahoo Search"
  [3]: http://search.msn.com/    "MSN Search"

Using the implicit link name shortcut, you could instead write:

I get 10 times more traffic from [Google][] than from
[Yahoo][] or [MSN][].

  [google]: http://google.com/        "Google"
  [yahoo]:  http://search.yahoo.com/  "Yahoo Search"
  [msn]:    http://search.msn.com/    "MSN Search"

Both of the above examples will produce the following HTML output:

<p>I get 10 times more traffic from <a href="http://google.com/"
title="Google">Google</a> than from
<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>

For comparison, here is the same paragraph written using Markdown's inline link style:

I get 10 times more traffic from [Google](http://google.com/ "Google")
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
[MSN](http://search.msn.com/ "MSN Search").

The point of reference-style links is not that they're easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it's 176 characters; and as raw HTML, it's 234 characters. In the raw HTML, there's more markup than there is text.

With Markdown's reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Emphasis

Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML <em> tag; double *'s or _'s will be wrapped with an HTML <strong> tag. E.g., this input:

*single asterisks*

_single underscores_

**double asterisks**

__double underscores__

will produce:

<em>single asterisks</em>

<em>single underscores</em>

<strong>double asterisks</strong>

<strong>double underscores</strong>

You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

Emphasis can be used in the middle of a word:

un*frigging*believable

But if you surround an * or _ with spaces, it'll be treated as a literal asterisk or underscore.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

\*this text is surrounded by literal asterisks\*

Code

To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

Use the `printf()` function.

will produce:

<p>Use the <code>printf()</code> function.</p>

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

``There is a literal backtick (`) here.``

which will produce this:

<p><code>There is a literal backtick (`) here.</code></p>

The backtick delimiters surrounding a code span may include spaces -- one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:

A single backtick in a code span: `` ` ``

A backtick-delimited string in a code span: `` `foo` ``

will produce:

<p>A single backtick in a code span: <code>`</code></p>

<p>A backtick-delimited string in a code span: <code>`foo`</code></p>

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:

Please don't use any `<blink>` tags.

into:

<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>

You can write this:

`&#8212;` is the decimal-encoded equivalent of `&mdash;`.

to produce:

<p><code>&amp;#8212;</code> is the decimal-encoded
equivalent of <code>&amp;mdash;</code>.</p>

Images

Admittedly, it's fairly difficult to devise a "natural" syntax for placing images into a plain text document format.

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.

Inline image syntax looks like this:

![Alt text](/path/to/img.jpg)

![Alt text](/path/to/img.jpg "Optional title")

That is:

  • An exclamation mark: !;
  • followed by a set of square brackets, containing the alt attribute text for the image;
  • followed by a set of parentheses, containing the URL or path to the image, and an optional title attribute enclosed in double or single quotes.

Reference-style image syntax looks like this:

![Alt text][id]

Where "id" is the name of a defined image reference. Image references are defined using syntax identical to link references:

[id]: url/to/image  "Optional title attribute"

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML <img> tags.


Miscellaneous

Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

<http://example.com/>

Markdown will turn this into:

<a href="http://example.com/">http://example.com/</a>

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

<address@example.com>

into something like this:

<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>

which will render in a browser as a clickable link to "address@example.com".

(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won't fool all of them. It's better than nothing, but an address published in this way will probably eventually start receiving spam.)

Backslash Escapes

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown's formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML <em> tag), you can use backslashes before the asterisks, like this:

\*literal asterisks\*

Markdown provides backslash escapes for the following characters:

\   backslash
`   backtick
*   asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+   plus sign
-   minus sign (hyphen)
.   dot
!   exclamation mark

/blosxom | Posted at 10:10 | permanent link