How to Know if a File on Linux is Sparse?

english, geek, general, howto, pat No Comments »

A sparse file is a file which does not take more space on disk than needed. Such a file is usually used to store a partition image on disk, for instance with a virtualization solution like Xen.

It’s super easy, to know if a file is sparse or not. Just use the ’s’ option of ls.

ls -alsh

will yield:

4.0K drwxr-xr-x 9 root root 4.0K 2010-03-23 18:22 .
4.0K drwxr-xr-x 23 root root 4.0K 2009-01-09 19:47 ..
12G -rw-r----- 1 root root 24G 2007-01-10 19:55 dompat.data
3.7G -rw-r--r-- 1 root root 7.1G 2009-01-06 21:09 dompat-hardy.sys
501M -rw-r----- 1 root root 501M 2007-01-07 16:40 dompat.swap

Where the first size column is the effective space taken on disk while the second size column is the max space of that file. We see that dompat.data is sparse, since its max size is 24 GB while it takes only 12 GB on disk.

References

  • More information on command which can handle sparse files in this article

New Mix: Electro-rock to Minimal

SoUnd, general, pat 3 Comments »

Check out my new mix in the sound section! I did something a bit different than the previous time, as I wanted to explore the electro-rock style, which is really a great and energetic combination.

  • Extrabright Mix 02: From electro-rock to minimal, with an electronica introduction and a new age epilogue. Calvin Harris remixed by Mr. Oizo, Ellen Alien, Justice, Miss Kittin, Love Motel and a couple of other great tracks.

    Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Database Issue

english, general, pat No Comments »

I had some database issues 2 weeks ago, therefore I lost a couple of comments. Sorry guys. I hope it will stay stable now.

Cheers!

Posting from the iphone

english, general, pat No Comments »

Testing the wordpress application on the iPhone. It seems quite easy to post something. Apparently it works also on a self-hosted wordpress instance.

Philippe Starck – Why Design

english, general, pat No Comments »

I have watched this talk a couple of days ago. It is really interesting so I am posting it hereafter.

TED Talks

english, general, pat No Comments »

I like particularly the TED talks. They are creative, expose innovative ideas in the fields of science, art, education, technology, design and even spirituality. It is a great source of inspiration. Now with leopard I can also watch my TED podcasts on TV using the new frontrow application. This is awesome.

In The following talk, Ken Robinson talks about creativity and education in “Do schools today kill creativity?”.

“Blocher, une victoire à la Poutine”

français, general, pat No Comments »

Un style, plus qu’un parti, a triomphé le 21 octobre: l’autoritarisme émotionnel, dont un bon exemple nous vient de la Russie.”

Article intéressant sur largeur.com au sujet des élections du week-end passé. Je vous en conseille la lecture.

Swiss Elections

english, general, pat 2 Comments »

Let me just comment what happened this week-end in Switzerland through a couple of quotes from international newspapers.

Le Monde, Paris “La droite ultranationaliste renforce sa position dominante aux élections législatives en Suisse” (“The ultra-nationalist right-wing party reinforces its position at the legislative elections in Switzerland”).

El Pais, Madrid “La derecha xenófoba suiza gana las elecciones con el 29% de los votos” (“The xenophobic right wing movement wins the elections with 29% of the votes”).

Frankfurter Allgemeine Zeitung, Frankfurt “Leichter Ruck nach rechts” (“Slight hitch to the right”).

The Times, London: “Billionaire inspired by ancient martyr, Christoph Blocher of the Swiss People’s Party led his party to victory after a campaign with a trident anti-immigrant tone“.

Virtual Barbershop

english, general, pat 1 Comment »

A friend sent me the other day the link of the virtual barbershop. Amazing. Remember to use headphones, though.

Busy Time

english, general, pat No Comments »

In the last past weeks I had a busy time finishing an Eclipse/SWT project, therefore having less time to post news on this blog. It should be better for the coming weeks.

Back in Madrid

english, general, pat No Comments »

We arrived yesterday in Madrid, back from a short week in Extremadura. It was a nice journey. We visited some other nice pueblos. Caceres about 80 km North of Don Benito, where we saw nice roman and arab ruins, in particular a few towers around the antique city along with walls protecting against invaders. Caceres shows a nice mix between the original roman style and arab constructions. We went also to Guadalupe, a village in the mountain at 1.5 hour driving North East from Don Benito. There we visited an old monastery, where lots of antique christian objects in the purest Spanish and baroque tradition have been conserved. We did finally a short stop on Thursday in Medellin, that I mentioned already in my last post. There we saw of course a statue of Hernan Cortes. I am wondering if this guy is worth admiring, considering what has been done by the spanish conquistadors in South America, where the native peoples were persecuted, their culture and language largely cannibilized by the spanish invaders.

¡Visitando España!

english, general, pat No Comments »

Spending some holidays in Spain at the moment. We arrived on Saturday in Madrid and then went to Don Benito on Sunday. It is a small town at 3.5 hours driving from Madrid, in Extremadura, a state in the center of Spain bording Portugal. Very nice. The area has lots of antique roman buildings to visit. We were yesterday in Merida, about 60 km away from Don Benito, where we visited lots roman ruins like a stadium, a theatre, various houses and roman roads, as well as an incredible roman bridge that is still in use today and is a couple of hundreds meter long! Definitely worth visiting.

It’s funny, because around here there are lots of villages or small town with well known names. A village beside Don Benito is named Medellin. There are just a couple of thousands people living there. But it is also the home village of the spanish conquistador Hernan Cortes, so no wonder that there is a city in South America, in Colombia, with that name. Merida, is also a name found in Equator and some other place around the world. Although I am not sure why.

What is it?

english, general, pat 2 Comments »

Ok, I have another brain-teaser for you guys. Please don’t post the answer in the comments, so the one arriving afterwards can guess as well. You can drop me a line to check if your answer is right (pajai at extrabright dot com).

- It is more powerful than god

- More evil than the devil

- The riches don’t have it

- The poors do have it

- If we eat it, we die.

Which Way?

english, general, pat 5 Comments »

A prisoner is escaping from jail. At some point on his path, he is arriving at a crossing. He can take either the road to the left or the one to the right. One will lead him to freedom while the other back to jail. He does not know which one. On each side of the road, there is a guy waiting. The prisoner knows that one of them is honest while the other is not. The prisoner is allowed to ask just one question to one of them, in order to find his way. What is the right question to ask?

Better Keyboard Shortcuts for Mac X11 Apps

english, general, pat 21 Comments »

I have always found the integration of X11 apps in Mac OS X quite alright, apart from the fact that for a native Mac application you use the apple key for keyboard shortcut and for an X11 app you use the control key. So, for instance, if you want to copy and cut a text between, let’s say, Firefox (native) and OpenOffice (X11), you need to remember to use apple+c in Firefox and ctrl+v in OpenOffice. Needless to say it is a hassle and it makes the interoperability between native and X11 applications quite useless (did I mention I bought M$ Office on Mac for this very reason?).

A first solution to solve that problem would be to switch the mapping between the ctrl and apple key inside X11, for instance using the tool xmodmap. But then we would have the disadvantage that we would need to use the apple key instead of ctrl in every situation, e.g. including within command line tools in xterm (the X11 terminal). Then, when using the command line text editor nano within xterm, we would need to press apple+o to save a text and apple+x to exit, while for nano within the non-X11 terminal, we would need to use the control key instead. So this solution appears to me as unideal.

In fact, as I am not using the meta key in X11, which is originally at the place of the apple key, I can just assign the control key to the apple key and get rid of the meta. This would ensure that I can go on using the apple key for keyboard shortcuts inside X11 — e.g. apple + c in OpenOffice — while keeping the mapping of the control key for use with command line tools.

This modification is pretty straightforward. Just create a .Xmodmap file inside your home folder with the following lines (or extend it accordingly if it already exists):


! ~/.Xmodmap
clear Mod2
clear control
keycode 63 = Control_L
keycode 67 = Control_L
add control = Control_L

In fact, what we do here is first to clear the two logical keys corresponding to meta and control, assign Control_L to the two key we want, and recreate uniquely the control logical key. When restarting X11, your new mapping will be automatically activated. You can test it using xev or xmodmap -p.

Any comment welcome.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in