Accessing Linux ext2/ext3 partitions from MS Windows
July 2nd 2009

Accessing both Windows FAT and NTFS file systems from Linux is quite easy, with tools like NTFS-3G. However (following with the MS tradition of making itself incompatible with everything else, to thwart competition), doing the opposite (accessing Linux file systems from Windows) is more complicated. One would have to guess why (and how!) closed and proprietary and technically inferior file systems can be read by free software tools, whereas proprietary software with such a big corporation behind is incapable (or unwilling) to interact with superior and free software file systems. Why should Windows users be deprived of the choice over JFS, XFS or ReiserFS, when they are free? MS techs are too dumb to implement them? Or too evil to give their users the choice? Or, maybe, too scared that if choice is possible, their users will dump NTFS? Neither explanation makes one feel much love for MS, does it?

This stupid inability of Windows to read any of the many formats Linux can use gives rise to problems for not only Windows users, but also Linux users. For example, when I format my external hard disks or pendrives, I end up wondering if I should reserve some space for a FAT partition, so I could put there data to share with hypothetical Windows users I could lend the disk to. And, seriously, I abhor wasting my hardware with such lousy file systems, when I could use Linux ones.

Anyway, there are some third-party tools to help us which such a task. I found at least two:

I have used the first one, but as some blogs point out (e.g. BloggUccio), ext2fsd is required if the inode size is bigger than 128 B (256 B in some modern Linux distros).

Getting Ext2IFS

It is a simple exe file you can download from fs-driver.org. Installing it consists on the typical windows next-next-finish click-dance. In principle the defaults are OK. It will ask you about activating “read-only” (which I declined. It’s less safe, but I would like to be able to write too), and something about large file support (which I accepted, because it’s only an issue with Linux kernels older than 2.2… Middle Age stuff).

Formatting the hard drive

In principle, Ext2IFS can read ext2/ext3 partitions with no problem. In practice, if the partition was created with an inode size of more than 128 bytes, Ext2IFS won’t read it. To create a “compatible” partition, you can mkfs it with the -I flag, as follows:

# mkfs.ext3 -I 128 /dev/whatever

I found out about the 128 B inode thing from this forum thread [es].

Practical use

What I have done, and tested, is what follows: I format my external drives with almost all of it as ext3, as described, leaving a couple of gigabytes (you could cut down to a couple of megabytes if you really want to) for a FAT partition. Then copy the Ext2IFS_1_11a.exe executable to that partition.

Whenever you want to use that drive, Linux will see two partitions (the ext3 and the FAT one), the second one of which you can ignore. From Windows, you will see only a 2GB FAT partition. However, you will be able to open it, find the exe, double-click, and install Ext2IFS. After that, you can unplug the drive and plug it again…et voilà, you will see the ext3 partition just fine.

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , , , , , , , , ,

2 Comments »

Ubuntu error: the installer needs to remove operating system files
June 18th 2009

I started installing Ubuntu Netbook Remix 9.04 in my ASUS Eee PC, and after the partitioning step, I stumbled upon the following error:

The installer needs to remove operating system files from the install target, but was unable to do so. The install cannot continue

I was installing Ubuntu on top of a previous eeebuntu install, smashing the / partition, while reusing the /home. After minimal googling, I found this bug report at Launchpad, with the same problem (and one year old).

As it turns out, the problem was not with the root partition, as I assumed from the error message, but with the home one. Apparently, Ubuntu didn’t like the idea that my home partition was JFS (maybe it couldn’t mount it, because jfs_utils are not loaded by default). The solution: install the OS ignoring (not using) the home partition, and mount it afterwards.

Shame on you, Ubuntu, this solution is lame!

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , , , , , ,

No Comments yet »

Microsoft produces crap, AMD eats it
June 16th 2009

It’s old news, but I just read about in in the Wikipedia article for the Phenom II processor.

Apparently Phenom processors had the ability to scale the CPU frequency independently for each core in multicore systems. Now, Phenom II processors lack this feature: the CPU frequency can be scaled, but all cores must share the same frequency.

Did this happen because of technical reasons? AMD thought it was better to do it? No. As Wikipedia says:

Another change from the original Phenom is that Cool ‘n Quiet is now applied to the processor as a whole, rather than on a per-core basis. This was done in order to address the mishandling of threads by Windows Vista, which can cause single-threaded applications to run on a core that is idling at half-speed.

The situation is explained in an article in anandtech.com, where the author mistakes an error on Vista’s account with an error in the Phenom processor (bolding of text is mine):

In theory, the AMD design made sense. If you were running a single threaded application, the core that your thread was active on would run at full speed, while the remaining three cores would run at a much lower speed. AMD included this functionality under the Cool ‘n’ Quiet umbrella. In practice however, Phenom’s Cool ‘n’ Quiet was quite flawed. Vista has a nasty habit of bouncing threads around from one core to the next, which could result in the following phenomenon (no pun intended): when running a single-threaded application, the thread would run on a single core which would tell Vista that it needed to run at full speed. Vista would then move the thread to the next core, which was running at half-speed; now the thread is running on a core that’s half the speed as the original core it started out on.

Phenom II fixes this by not allowing individual cores to run at clock speeds independently of one another; if one core must run at 3.0GHz, then all four cores will run at 3.0GHz. In practice this is a much better option as you don’t run into the situations where Phenom performance is about half what it should be thanks to your applications running on cores that are operating at half speed. In the past you couldn’t leave CnQ enabled on a Phenom system and watch an HD movie, but this is no longer true with Phenom II.

Recall how the brilliant author ascribes the “flaw” to CnQ, instead of to Vista, and how it was AMD who “fixed” the problem!

The plain truth is that AMD developed a technology (independent core scaling) that would save energy (which means money and ecology) with zero-effects on performance (since the cores actually running jobs run at full speed), and MS Vista being a pile of crap forced them to revert it.

Now, if you have a computer with 4 or 8 cores, and watch a HD movie (which needs a full-speed core to decode it, but only one core), the full 8 cores will be running at full speed, wasting power, producing CO2, and making you get charged money at a rate 8 times that actually required!

The obvious right solution would be to fix Vista so that threads don’t dance from core to core unnecessarily, so that AMD’s CnQ technology could be used to full extent. AMD’s movement with Phenom II just fixed the performance problem, by basically destroying the whole point of CnQ.

Now take a second to reflex how the monstrous domination of MS over the OS market leads to problems like this one. In a really competitive market, if a stupid OS provider gets it wrong and their OS does not support something like CnQ properly, the customers will migrate to other OSs, and the rogue provider will be forced to fix their OS. The dominance of MS (plus their stupidity), just held back precious technological advances!

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , , , , , , , , ,

No Comments yet »

Up yours, Sarkozy!
June 10th 2009

That’s where you can lodge your HADOPI law, you totalitarian dwarf.

Apparently there is some common sense in the French tribunals, and that stupid law was revoked. Well, not really revoked, just cut down in its most dangerous bit (the ability of the ISPs to shut down the connection of a user based on perceived “pirate” activity). I just read about at Enrique Dans’s blog [es].

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , ,

No Comments yet »

Changing font style in PyGTK ComboBox
June 10th 2009

I am using the Glade Interface Designer to produce (very) small (and simple) graphical apps for my Neo FreeRunner. I produce the graphical layout in the form of an XML file (using Glade), then load this XML from a PyGTK program.

The thing is some defaults are not really usable for a device such as the NFR. For example, default fonts are in general too small for the tiny screen of the Neo, which favors apps with only a few, big and shinny buttons. In the case of Label widgets, you can use Pango markup format with the set_markup method, as follows:

mylabel  = self.glade.get_widget('label1')
txt  = '<span font_size="80000" color="red">%s</span>' % (text_string)
mylabel.set_markup(txt)

However, for other widgets it is not so evident. For example, in ComboBoxes (buttons with a drop-down list), you can’t put in the item list anything other than strings, which are displayed literally (markup is not interpreted). Moreover, CBs do not have a “set_font_style” method, or anything similar.

Searching the web did not provide immediate results, but I managed to find this FAQ item at eccentric.cx. I quote:

4.1.581 How do I change font properties on gtk.Labels and other widgets?
Easy:

 label = gtk.Label("MyLabel")
 label.modify_font(pango.FontDescription("sans 48"))

This method applies to all widgets that use text, so you can change the text of gtk.Entry and other widgets in the same manner.

Note that, some widgets are only containers for others, like gtk.Button. For those you’d have to get the child widget. For a gtk.Button do this:

  if button.get_use_stock():
     label = button.child.get_children()[1]
  elif isinstance(button.child, gtk.Label):
     label = button.child
  else:
     raise ValueError("button does not have a label")

Last changed on Thu Sep 1 14:46:30 2005 by Johan Dahlin (johan-at-gnome-org)

In the case of a CB, we have to pick its child (which is the list itself), and modify it thusly:

cbox = self.glade.get_widget("CBlist")
cblist  = cbox.child
cblist.modify_font(pango.FontDescription("sans 32"))

In my examples above, a class has been created in the script beforehand, and it binds to the Glade XML:

class whatever:

  def __init__(self):

    #Set the Glade file
    self.glade    = gtk.glade.XML(gladefile)
    self.glade.signal_autoconnect(self)

Of course, the CBlist and MyLabel mentioned in my code are the appropriate widget names defined in that XML.

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , , , , , , , ,

No Comments yet »

Oil policy back in WWII
June 4th 2009

As you can see in this war-time poster by the USA government, the official policy on oil (ab)use has not always been “waste as much as you can”:

I found the picture in the carpool Wikipedia article.

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , ,

No Comments yet »

LWD – June 2009
June 2nd 2009

This is a continuation post for my Linux World Domination project, started in this May 2008 post. You can read the previous post in the series here.

In the following data T2D means “time to domination” (the expected time for Windows/Linux shares to cross, counting from the present date). DT2D means difference (increase/decrease) in T2D, with respect to last report. CLP means “current Linux Percent”, as given by last logged data, and DD means domination day (in YYYY-MM-DD format).

For the first time, data for PrimeGrid is included.

Project T2D DT2D DD CLP Confidence %
Einstein 4.5 months +3.5 months 2009-10-14 44.51 (+2.42) 6.4
MalariaControl >10 years - - 12.64 (+0.09) -
POEM >10 years - - 10.66 (+0.19) -
PrimeGrid 75 months - 2015-07-22 9.61 1.3
Rosetta >10 years - - 8.37 (+0.28) -
QMC >10 years - - 7.92 (+0.05) -
SETI >10 years - - 8.00 (+0.06) -
Spinhenge >10 years - - 3.87 (+0.28) -

Mmm, the numbers seem quite discouraging, but the data is what it is. On the bright side, all CLPs have gone up, some almost a 0.3% in 3 months. The Linux tide seems unstoppable, however its forward speed is not necessarily high.

As promised, today I’m showing the plots for PrimeGrid, in next issue QMC@home.

Number of hosts percent evolution for PrimeGrid (click to enlarge)

Accumulated credit percent evolution for PrimeGrid (click to enlarge)

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , , , , , ,

No Comments yet »

Jamendo voted best music-related web in CNET contest
May 27th 2009

Remember the site I get all my free music from? Yes, Jamendo, a site for artists to share their music with their fans under Creative Commons licenses.

Well, apparently (and, of course, with my vote), they won CNET's Webware 2009 competition, in the “Music” category. They also made it to the “Top 100″ web sites (which is quite a feat). You can read about it at the Jamendo blog and CNet site.

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , ,

No Comments yet »

Membership test: array versus dictionary
May 22nd 2009

I guess this post is not going to reveal anything new: testing for an item’s membership in an array is slow, and dictionaries are much more CPU-efficient for that (albeit more RAM-hungry). I’m just restating the obvious here, plus showing some benchmarks.

Intro

Let’s define our problem first. We simply want to check whether some item (a string, number or whatever) is contained within some collection of items. For that, the simplest construct in Python would be:

if item in collection:
  do something

The above construct works regardless of “collection” being an array or a dictionary. However, the search for “item” in “collection” is different internally. In the case of a dictionary, Python checks all its elements one by one, comparing them to “item”. If a match is found, True is returned, and the search aborted. For items not in the array, or appearing very late inside it, this search will take long.

However, in the case of dictionaries, the search is almost a one-step procedure: if collection[item] returns something other than an error, then item is in collection.

The tests

I’ve run two different test scripts, one for the array case, another for the dictionary case. In both cases I’ve searched for an item that was not in the collection, to maximize the searching efforts. The array script was as follows:

#!/usr/bin/python

import sys

nitems = int(sys.argv[1])

foo = []
bar = []

for i in range(nitems):
 foo.append(1)
 bar.append(2)

for i in foo:
  if i in bar:
    pass

Similarly, for dictionaries:

#!/usr/bin/python

import sys

nitems = int(sys.argv[1])

foo = {}
bar = {}

for i in range(nitems):
  j = i + nitems
  foo[i] = True
  bar[j] = True

for i in foo:
  if i in bar:
    pass

Both scripts accept (require) an integer number as argument, then build item collections of this size (initialization), then run the check loops. The loops are designed to look for every item of collection 1 in collection 2 (and all checks will fail, because no single item belongs to both sets).

Timing

The scripts were timed simply by measuring the execution walltime with the GNU time command, as follows:

% /usr/bin/time -f %e script nitems

Bear in mind that the computer was not otherwise idle during the tests. I was surfing the web with Firefox and listening to music with Amarok. Both programs are CPU- and (specially) memory-hungry, so take my results with a grain of salt. In any case, it was not my intention to get solid numbers, but just solid trends.

Memory profiling

I must confess my lack of knowledge around memory management of software, and how to profile it. I just used the Valgrind utility, with the massif tool, as follows:

% valgrind --tool=massif script nitems

Massif creates a log file (massif.out.pid) that contains “snapshots” of the process at different moments, and gives each of them a timestamp (the default timestamp being the number of instructions executed so far). The logged info that interests us is the heap size of the process. As far as I know (in my limited knowledge), this value corresponds to the RAM memory allotted to the process. This value can be digested out of the log file into a format suitable for printing heap size vs. execution time (instructions, really), by a Python script:

#!/usr/bin/python

import sys

try:
  fn = sys.argv[1]
except:
  sys.exit('Insert file name')

b2m = 1024*1024
e2m = 1000000

f = open(fn,'r')

for line in f:
  if 'time=' in line:
    aline = line.split('=')
    t     = aline[1].replace('\n','')
    t     = float(t)/e2m

  elif 'mem_heap_B' in line:
    aline = line.split('=')
    m     = aline[1].replace('\n','')
    m     = float(m)/b2m

    print t,m

f.close()

The above outputs heap MB vs million executions.

A much conciser form with awk:

% awk -F= '/time=/{t=$2/1000000};/mem_heap_B/{print t, $2/1048576}' massif.out.pid

Results

The execution times were so different, and the collection size (nitems) range so wide, I have used a logarithmic scale for both axes in the time vs collection size below:

times

At 64k items, the dictionary search is already 3 orders of magnitude faster, and the difference grows fast as the collection size increases.

With respect to memory use, we can see that in both cases increasing nitems increases the heap size, but in the case of the arrays, the increase is not so pronounced. Looking at the X axes in both following plots, you can see that the number of instructions executed during the run grows linearly with the number of items in the collection (recall that the array plot has a logarithmic X axis).

mem_array
mem_dict

Finally, I compare memory usage of the array and dictionary case in the same plot, as you can see below, for the case of 64k items in the collection:

mem_both

It wasn’t really an easy task, because I had to combine the biggest array case I could handle with the smallest dictionary the timing of which would be meaningful (smaller dictionaries would be equally “immediate”, according to time). Also notice how the X axis has a log scale. Otherwise the number of instructions in the array case would cross the right border of your monitor.

Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , ,

No Comments yet »

My music collection surpasses 10000 songs
May 20th 2009

Following the “report” series started with my first summary of info about the music collection I listen to, I will update that info in this post.

The data (in parentheses the difference with respect to last report, 8 months ago).


Files

Total files        10039 (+527)
  - Commercial     6533 (+372)
  - Jamendo        3381 (+155)
  - Other CC       71 (+0)
  - Other          54 (+0)
Total playtime     634h (+34h)
Disk usage         48GB (+3GB)
MP3 count          0 (+0)
OGG count          100039 (+527)

Last.fm

Playcount           56191 (+14657)

Most played artists Joaquín Sabina - 3233 (+522)
                    Ismael Serrano - 1820 (+1342)
                    The Beatles - 1632 (+286)
                    Extremoduro - 1611 (+917)
                    Silvio Rodríguez - 930 (+148)
                    David TMX - 891 (+38)
                    Siniestro Total - 847 (+197)
                    Bad Religion - 774 (+142)
                    Fito & Fitipaldis - 749 (+74)
                    La Polla Records - 710 (+145)
                    El Reno Renardo - 660
                    Joan Manuel Serrat - 635
                    La Fuga - 570
                    Platero y Tú - 554
                    Ska-P - 554 (+114)

Most played songs   Km. 0 (I. Serrano) - 82
                    Cuando aparezca el petróleo (E. Sánchez) - 74 (+8)
                    Salir (Extremoduro) - 68
                    Golfa (Extremoduro) - 66
                    Caperucita (I. Serrano) - 65
                    La extraña pareja (I. Serrano) - 61
                    Vértigo (I. Serrano) - 61
                    La del pirata cojo (J. Sabina) - 60 (+5)
                    Tirado en la calle (E. Sánchez) - 59 (+6)
                    Un muerto encierras (I. Serrano) - 58
                    Conductores suicidas (J. Sabina) - 57 (+6)
                    Medias Negras (J. Sabina) - 56
                    Y sin embargo (J. Sabina) - 55 (+6)
                    Tierna y dulce historia de amor (I. Serrano) - 53
                    You shook me all night long (AC/DC) - 52
                    So payaso (Extremoduro) - 52
                    Laztana (Latzen) - 50
                    Esperar (E. Sánchez) - 50
                    Pacto entre caballeros (J. Sabina) - 50 (+3)
Share:
  • Digg
  • Meneame
  • Reddit
  • del.icio.us
  • Technorati
  • Slashdot
  • BarraPunto
Tags: , , , , ,

No Comments yet »

Next »