Extend partition in disk in xen linux guest

April 12th, 2015

After searching the web for a method to resize a partition in a disk in a logical volume as opposed to just a partition in a logical volume (notice the difference ‘partition in’ or ‘disk in’). I could not find a method however if you have enough space you could use the following method.

Note that I used this to resize the partition of a virtual machine running in a logical volume (it should work with physical stuff too but then you might have to put a disk in another physical host or mount it using a live cd).

Util is a machine with the same version of the OS. tbe is the one we want to extend.

From a high level the procedure is as follows:

  • Mount the disk with partitions you want to extend on another virtual machine (VM)
  • Use cp to backup the disks
  • Use fdisk to extend the partitions
  • Use cp to restore the backup to the resized partitions
  • On the VM with, now, resized disks, run resize2fs
  • Bonus; resize and or add the swap partition

Everything is done as root. Prefix with sudo if you want or need to.

xl shutdown util 
xl shutdown tbe 

Extend the disk on the host.

lvextend -L8G /dev/<vg>/<lvm>

Unfortunately although the logical volume is extended the disk inside isn’t using the extra size. Since we do not simply mount the disk but have a complete disk within the lv we cannot simply use resize something. Instead we have to mount it on, preferably the same version of the OS and then make a backup of the partition(s). Drop everyting and create new partitions then copy it back:

edit util .cfg

disk = [ '/dev/<VG>/<lv util>,raw,xvda,rw', '/dev/<VG>/<lv tbe>,raw,xvdb,rw' ]

Bring our util system backup

xl create util.cfg

Login to util then:

ls -tarl /dev/xvdb*

Make a backup of all the regular partitions (no need to backup swap of course).

mkdir /backup
# Repeat for all other partitions (you could skip swap if you want but I would be on the safe side and backup all just in case you got the partition wrong)
cp /dev/xvdb1 /backup/xvdb1backup1
cp /dev/xvdb2 /backup/xvdb1backup2
# etc.. 
fdisk /dev/xvdb

Command (m for help): p
Disk /dev/xvdb: 14 GiB, 15032385536 bytes, 29360128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x20230da1

Device Boot Start End Sectors Size Id Type
/dev/xvdb1 2048 8388607 8386560 4G 83 Linux
/dev/xvdb2 8388608 16777215 8388608 4G 82 Linux swap / Solaris

Now remove all the partitions listed (you didn’t skip the backup step, right…).

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.


Then create new partitions make sure specify the size you want. The calculation is as follows:

Let’s say we want two partitions.

  1. Primary partition 13GB
  2. Swap partition remainder of the disk.

For the start value we use the start value that fdisk will print when pressing n, p. The number we have to add to this to get a 13GB partition is as follows. The first partition must be a primary partition. The following can be extended (if you need more than 3 other partitions) or more primary ones. The sector size is printed by fdisk (see above):

Diff = PartitionSizeInGB * 1024 * 1024 *1024 / SectorSizeInBytes

For instance

Diff = 13 * 1024 * 1024 * 1024 / 512 = 27262976

Therefore the last sector is:

LastSector = 27262976 + 2048 = 27265024


Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-29360127, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-29360127, default 29360127): 27265024

Created a new partition 1 of type 'Linux' and of size 13 GiB.

And lastly create a swap partition using the rest of the disk i.e. just go with the default values.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (27265025-29360127, default 27267072):
Last sector, +sectors or +size{K,M,G,T,P} (27267072-29360127, default 29360127):

Created a new partition 2 of type 'Linux' and of size 1022 MiB.

We now have to change the type to linux swap which has code 82.

Command (m for help): t
Partition number (1,2, default 2):
Hex code (type L to list all codes): 82

Changed type of partition 'Linux' to 'Linux swap / Solaris'.

Command (m for help):

Write the results to disk:


Copy the backup back to the disk

cp /backup/xvdb1backup1 /xvdb1
#etc for all partitions

Shutdown util

shutdown -h now

In the host remove the disk again from util.cfg Now start the tbe

xl create tbe.cfg

Logon to tbe

df -k 

Still no luck huh? 😉

su - root
resize2fs /dev/<the device you extended>
df -k

Should now list the new size.

If you configured a swap parition check it is working:

swapon -s

If not you have to add the swap partition. Let’s say it was on xvdb2 when you configured it in util then it probably is in xvda2 (make sure you get it right i.e. check if it exists in /dev isn’t mounted df -k). In the following I assume it is on /dev/xvda2

Now for ubuntu execute the following:

blkid /dev/xvda2

Copy the UUID and open /etc/fstab. Copy the swap line and change it as follows (use the printed UUID instead of the one below).

UUID=7340ea5f-3325-466a-8e2f-52c1cf15ae94 / ext4 errors=remount-ro 0 1
# swap was on /dev/xvda5 during installation
#UUID=75ecaea3-ff0d-4f90-b5e2-ea757bde5399 none swap sw 0 0
UUID=582dae7a-5d2a-4b4c-9685-993fc8454200 /dev/xvda2 swap sw 0 0

shutdown -r now

Log back in:

swapon -s
Filename                                Type            Size    Used    Priority
/dev/xvda2                              partition       1046524 0       -1

If satisfied don’t forget to start Util and cleanup the backups created.

Converting Eclipse Android Project with Libraries and VCS to AndroidStudio

February 20th, 2015

This thing puzzled me for a while. I have several separate libraries in eclipse and their associated SVN directories. I

  1. Did not want to duplicate sources in the repo
  2. Wanted everything under source control
  3. Wanted to use Gradle (because that seems to be Google’s preferred source build system for android)
  4. Did not mind having everything in one project instead of separate modules in Android Studio ((un)like I had in eclipse)

So what I did was the following:

  1. Import project from Eclipse by choosing ‘Import from eclipse’ from the main AndroidStudio window.
  2. Go into the project and for all sub-projects in AndroidStudio open the Java folder and delete the Java source tree (i.e. the Java directory should be empty)
  3. Warning for the next step; in your repository, make sure to create a directory for your project. Do not import into the root or it will be a mess!
  4. Check in your (now empty) android studio project by going to (Toolbar) VCS->Subversion->Share Project. So your, Android project, will be under source control in its own folder.
  5. Now for every subproject click on (Toolbar) VCS->Checkout->Browse to the root of your source (i.e. the last part of your domain name, for me it is ‘eu’)
  6. Browse to your project, subproject and then the java folder.
  7. Press Checkout
  8. Choose the option with the last directory being Java followed by the first part of your domain name (i.e. in my case again ‘eu’). So for me …Java/eu
  9. Then select ‘NO’, do not create an android studio project from it.

You should be all set. When you now commit the project itself it will go into its VCS location while the subprojects will update the existing VCS project locations.

Bonus points for anyone who figures out to do this, but then with a separate android studio project for every library. 🙂



The Imaginarium of Doctor Parnassus

November 25th, 2011

Technical details:

* Genre: Fantasy (the back of the casing says adventure)

* Play time: 118 minutes

* Sound English DTS 5.1, English Dolby 5.1

* Subtitles: Dutch

This wonderful tale brings you to worlds imagined by Doctor Parnassus. Due to a pact with the devil, he is immortal. Obviously there is a price to pay for that, but I won’t go into details because I think this is not what you buy this movie for. For me the value is in the lovely scenery, the beautifully imagined worlds and the original story. A very unique movie with an exceptional tale. If you value fantasy a little bit more than a good story then you enjoy 118 minutes of excitement. Anyone who is interested in something different than the usual movie willl find value in this picture.


I can recommend this movie to any fan of the fantasy genre.


November 25th, 2011

This is a 3D animated movie. The story is about a robot moving to the big city and particularly ‘Big Wigs’  uh, I mean ‘Big Welders’ factory. However when arriving there, things aren’t as he expected them to be. This movie has an original story and some very nice graphics. I especially liked how they textured the ‘suit’ robots (stainless steel) and the ordinary robots which looked much like the tin equipment you had back in the 60’s and 70’s with frayed paint and round chrome edges.

A fun 3D animated movie with a lot of humor and an original story, that I can recommend to any fan of 3D animated movies.

The Legend of Zorro

September 20th, 2011

Technical details:

  • Voices: English
  • Subtitles: English, Dutch, Hindi
  • Dolby 5.1
  • Extras: Deleted scenes, Commentaries, Making of etc.
Legend of Zorro

Legend of Zorro

Back in the 70-ties, when I watched zorro on my parent’s black and white TV set, about 7 years old, and discovering the world around me, two questions taunted me.

  • What color was Zorro’s cape,
  • and why for heaven’s sake was his image on a bottle of sherry?

It took quite some years to find out that his cape was just black (what a disappointment). Why his image was associated with sherry, was something this movie might reveal.

You know being a superhero is just not as easy as you would think. Obviously there are problems with the kids, being away all the time due to your superhero duties, and the pressure that goes with it. Of course this imposes a lot of stress and one good way to fight stress is with alcohol. Now about 40 years later I finally understand why Zorro is on that bottle of sherry! Yup, he is a good candidate for AA.

Problems with the wife and kid, appearing drunk at a party. That pretty sums up this movie. Of course the bright candle lights, the barrels of wine, and warm nights makes for some good looking camera shots, however, it can’t save the movie. There is some superhero action at the beginning and end of the movie but nothing in between. I think they could have made a nice movie with the same effort. Not sure to whom this movie is supposed to appeal. People interested in social interaction aren’t likely to buy a movie with Zorro in the title, likewise someone who want to see a superhero solving the worlds problems isn’t going to be satisfied seeing his/(her) superhero succumb to alcohol.

If you are interested in a superhero’s social problems, then this, is the movie to watch, if not then just skip this one.

This DVD I got from the bargain bin, and that is where it should have stayed.

Final verdict, don’t buy.


The League of Extraordinary Gentlemen

September 20th, 2011

Technical details:

  • Voices: English, Turkish
  • Subtitles: English, Dutch, Danish, Fin, Icelandic, Nordic, Swedish, Turkish
  • PAL
  • 5.1 DTS
  • Playtime: 106 minutes
  • Extras: Comentaries, Removed scenes, Making of etc.
  • Type: Fantasy
  • Two disc edition
  • Price tag: between 7 and 10 €
League of Extraordinary Gentlemen

League of Extraordinary Gentlemen

I didn’t think too much of the  movie while reading the back of the box. “A captain, a hunter, a strong man, a vampire, an invisible man and someone who can’t die have to save the world”. Well it can’t get anymore ‘cliche’ than that. However this movie, based on a book, has all the right ingredients, humor, adventure and romance (ok your mileage may vary on that last one 🙂 ).

It is fun to see who the main characters really are, so I won’t spoil the fun here. This movie has a lot of FX and is really fun to watch. Although completely different, I can imagine, this would appeal to people who like a movie like ‘Indiana Jones’.

One of the main characters, played by Sean Connery, dies at the end. However it leaves the possibility of a sequel open, and I can only hope one will be created.

King Kong

September 19th, 2011

Technical details:

Voices: English

Subtitles: English, Dutch, Finish, Hebrew, Nordic, hungarian, Swedish

Playtime: 180 Minutes (Yup, that is not a typo 🙂 )

Price tag: 7 €

King Kong

When I see the title ‘King Kong’ I can’t happen to view a very clumsy ape attached to the Empire State Building. A scene typical of the ancient ‘King Kong’ movie. However this ‘King Kong’ movie is different. Set in the twentieths of the previous century, a group of people, brought together through circumstances, are heading to ‘Skull Island’. They’ll bring back King Kong to New York where he is on display. Of course in the end he will escape his prisson and the classical scene on the empire state building will play out.

This movie was directed by Peter Jackson, who also directed ‘Lord of The Rings’ and it shows. King Kong is really worth every penny you paid.

I really enjoyed this movie.

Star Trek 2009

September 19th, 2011

Star Trek 2009 has the following technical features:

  • Voices: English
  • Subtitles: Dutch, English, French
  • Playtime: 122 Minutes
  • Type: Scifi
  • Price tag: I believe 8 Euros or so.

Being a fan of the original star trek series, the ones with William Shatner as captain Kirk, I was a bit hesitant to buy a movie with a completely new cast. But reading some reviews I thought I would give it a chance. The story is in any case a typical ‘star trek’ story. Including Romulans, time travel and firing phasers. It has the fantasy of the original series but, and this contrary to the previous ‘Star Trek’ movies, the pace of a modern movie. To top if off the original Spock also plays a role as the ‘old’ spock. The film directed by JJ Abrams has a very distinguished look. Everything looks very dynamic, which is especially surprising when you see how they pulled it off. For the latter see the extras on the DVD.

I can recommend this movie to anyone who liked the original series.


Tin man review

August 29th, 2009

Tin man is a new take on the Wizard of Oz. The technical details are:

  • Voices: English
  • Subtitles: Dutch
  • Dolby: 5.1
  • Playtime: 180 minutes
  • Type: Fantasy
  • Price tag: 12 Euro


Tin Man DVD

Tin Man DVD

The story is about DG who has some strange dreams for some time. At a certain moment she goes to the ‘other side’. Once on the there she meets some odd people. Someone whose brain was removed a kind of lion and someone who got punished by being locked up in a tin frame. Together they travel to fight the evil Azkedellia.  On the ‘other side’ you will see shape shifting people, robots, magic etc. Together it will keep it interesting for the full 180 minutes.

Although it refers to the Wizard of Oz it actually is a complete different movie than any Wizard of Oz I have seen. And that is actually for the better. I thought the acting was quite good and the animations and special effects very good. You can of course watch the movie in one go. I watched it in two parts though. It had a good pace and never got boring or anything.  If you like special effects and a fantasy setting then this is certainly movie to buy, just forget that it has anything to do with the Wizard of Oz.

Monster House review

August 29th, 2009
Monsterhouse DVD

Monsterhouse DVD

I bought monster house a while ago. I was an impulse buy in the supermarket and when I started watching it I thought for the first few moments that it was really aimed at kids and I wasted my money. However luckily I was completely wrong 🙂

Monster house is a DVD by Robert Zemeckis and Steven Spielberg according to the box.  The version I watched has the following details:

  • Voices: English/Dutch/Hebrew
  • Subtitles: English/Dutch/Hebrew
  • PAL
  • Dolby 5.1
  • Playtime 86 minutes
  • Extras: Documentaries/Trailers/Photo gallery
  • Type: Animation
  • Rated 6/horror
  • Price tag: I believe 8 or 12 Euros

The story is about a grumpy old man living in a haunted house. A boy at the other side of the street observed the house for a while and tries to convince other people that the house does actually live. Obviously nobody believes him, odd isn’t it? Anyway with the help of a friend and a girl, they just met, they are going to investigate the house and unravel its mystery, which I won’t reveal here.

The film is a 3D animation created using mocap which has resulted in amazingly realistic animations. The way the characters move is very lifelike even though the characters themselves are caricatures. The animation is quite polished. There is a lot of humor in the movie.  The horror aspect should of course be taken with a grain of salt, at least for adults.

if you like 3D animated movies then this is certainly one I can recommend.