Archive for November, 2008

Winter and bachelor thesis

The winter has arrived. It’s been rather cold, with a few degrees below zero the last week or so. And today it finally snowed, even if it only was small flakes.

I have until the end of this week to compose my letter for the WorldWide student-exchange application. The competition is really tough but you gotta aim high…

It’s also time to choose a Bachelor’s thesis. It is a relatively large project that runs during the spring term and when it’s done, we recieve our Bachelors degree. In one of my electable courses, Incompressible flow, we were given a chance to do something extraordinary:

kandidatstromning.gif In order to reduce air drag on trucks, some kind of Active Flow Control could be used. Behind a truck, the air exhibits rather large turbulence. If this could be minimized, the drag would be lowered. We will calculate if this turbulence can be lowered by for example, actively shooting jets of air from the back of the truck. The exciting fact is that no one have ever investigated this before, at least not this kind of active flow control.

We will calculate these things with a cluster consisting of 1100 cpu’s :)

Mount image-files in Ubuntu

Ubuntu is really great, it has alot of smart things that makes me more productive.
mountdone.png

But a not so simple thing is mounting an image-file. There are a few ways to do it, but I was surprised that this solution worked as good as it did.

To mount an iso- or img-file I just right-click the file and click Scripts->Mount. And voila!

By using fuseiso and creating scripts which are saved in Nautilus’s script-folder this is easy to achieve. I got the idea of using fuseiso through this guide at Ubuntu Unleashed, but I took the concept further and made it clickable. Nothing advanced but I know how hard it is to find this information when you need it.

Step 1

Fuseiso is the utility that actually will mount your file. It’s in Ubuntu’s official repositories, install fuseiso either by clicking the link or typing

sudo apt-get install fuseiso

Step 2

Create a folder where you want the contents of your iso-file to be found. It is important to remember that you should not use this folder for anything, don’t put files or so here. It is merely for displaying the contents of image-files which are somewhere else.

I chose /media/Isofolder but anything should work. Since /media is owned by the root I must create the folder by preceding mkdir /media/Isofolder with sudo, like this:

sudo mkdir /media/Isofolder

If you create the folder in your home-folder, sudo won’t be necessary. When creating the folder with “sudo”, root will be the owner of the folder. I’ll change owner to myself. It’s more easy that way, but not entirely necessary. I think read-rights is enough…

Anyway, to make myself owner, I’ll use

sudo chown username /media/Isofolder

Once again, this should not be necessary if Isofolder is placed in your own home-folder. But then no other user would be able to see the contents of the image-file.

Step 3

Now it is time to create the scripts that will call mountiso and umount.

First, open Gedit or any other text editor and paste this text:

#!/bin/bash
# Script to mount image-files like img or iso.
# Uses fuseiso
# Before use, create the isofolder:
# “sudo mkdir/media/Isofolder” and “sudo chown username /media/Isofolder”

# first clear the Isofolder
gksu umount /media/Isofolder

# Load the iso!
fuseiso “$*” /media/Isofolder

Everything after # is a comment. Take care when copying the code, the citation signs might not copy properly.

A short explanation of the commands:

  • umount: unmounts the Isofolder (if there already was something mounted). It must be performed as root, so I preceed it with gksu which creates a popup where I can enter my password.
  • After that, fuseiso tries to mount what I clicked on to /media/Isofolder.

Save this file in ~/.gnome2/nautilus-scripts/ and name it Mount. (~ means your homefolder). Scripts in this folder will pop-up in Nautilus when right-clicking.

#!/bin/bash
# See mount for details

gksu umount /media/Isofolder

Save this file in the same folder as Unmount.

mount1.png

Step 4

Make the scripts executable, either by right clicking them and modifying their properties, or by typing

cd ~/.gnome2/nautilus-scripts/
chmod +x Mount
chmod +x Unmount

Chmod +x adds executable (x) rights to the files.

Done

It should now be done, just right click any image-file and choose Scripts->Mount to mount it to /media/Isofolder.

Edit: I added a part about not using the Isofolder and changed a few formulations.
Edit: Confirmed to work in Ubuntu 9.10 Karmic Koala.