Resizing Maemo SDK VMware Appliance Virtual HD

I’ve received some suggestions to increase the Maemo SDK VMware Appliance virtual hd size in the next release, which is now about 6.5G, and also questions about how to extend its size right now, with the users own hands. In this post I explain the later in the form of a how to.

The tools needed are qemu-img and a livecd iso of RIP (Recover Is Possible) Linux distribution. It could be any small recorver distro you like, but this just do fine for me. You can do this operation from a Windows box if (for some reason) you want to, since the only tools needed in the host system are the said qemu-img, the RIP Linux iso and a VMWare Player.

Now to the How To.

1. Convert the virtual disk from VMDK to qemu raw format.

The virtual hd file if of the vmdk format and we need to convert it to the resizable qemu raw format.

$ qemu-img convert -f vmdk maemo-sdk.vmdk -O raw maemo-sdk.raw

2. Resize it.

I will use 10G, and from this point on the numbers used will reflect it. If you want a different size, check the values you supply for the tools used in this tutorial.

$ dd if=/dev/zero of=maemo-sdk.raw seek=10240 obs=1M count=0 conv=notrunc

The dd command will fill with zeros from the current end point of the virtual hd file to the size supplied in the seek parameter, in this case 10240 blocks of size indicated by obs=1M.
If the output appears as nothing have happened, do just like me and ignore it.

3. Convert it back to VMDK
Delete the original

qemu-img convert -f raw maemo-sdk.raw -O vmdk maemo-sdk.vmdk

4. Resize the partition inside the guest system.
With the virtual hardware changed, you go up to the filesystem level, but you have to do it from another system than the installed on the guest, thus we will work from the RIP live cd, running it on VMware.

4.1. Download the non-X version, for we will use only the shell for this job. Put it in the same directory of the vmware image.


4.2. Now, edit the vmx file, which is the one that describes the virtual machine to VMware Player. Search for this line

ide1:0.present = "FALSE"

Comment it and add the following

#ide1:0.present = "FALSE"
ide1:0.present = "TRUE"
ide1:0.autodetect = "FALSE"
ide1:0.startConnected = "TRUE"
ide1:0.fileName = "RIPLinux-4.3-non-X.iso"
ide1:0.deviceType = "cdrom-image"

4.3. Boot the RIP live cd image.
With this you can boot from the live cd image. You can, but the vmplayer will not do it, unless you restart the virtual machine and press ESC when it begins to initialize, then select the option to boot from the cd-rom.

4.4. Delete all partitions in the virtual hds.
No, i’m not crazy, and you will not lose anything. At least if follow these instructions. 🙂
Log in to the RIP system as root, and get the hammer, i mean, call fdisk in the command prompt.

# fdisk /dev/hda

Notice that even this being an step by step guide, some familiarity with fdisk is desirable to understand what is happening. And as said before the numbers used as parameters are valid for this specific case: resize the Maemo SDK Appliance, version 0.4, to 10G.

Now, you should see the fdisk’s prompt, issue a print command to see the current state.

(fdisk's prompt): p

And the following commands should remove the current partitions.

(fdisk's prompt): d

Answer 1 to remove the root partition, repeat the command and answer 2 to remove the swap.
Check again to see that they’re gone:

(fdisk's prompt): p

And write the changes and quit with

(fdisk's prompt): w

4.5. Recreate the partitions with the new sizes.
Call fdisk again, and issue a “new” command:

# fdisk /dev/hda
(fdisk's prompt): n

Answer the questions that will appear with these values:
p, to create a primary partition
1, for the number of the partition
1, for it to start in the first cylinder
21529, for the last cylinder of this partition (cylinders are so old school 🙂

Now for the swap partition.

(fdisk's prompt): n

Then answer:
e, for extended partition
2, for the number of the partition
And accept the default values for the two following questions, which are about the first and last cylinders. This will give the remaining disk space (about 300M) to the swap.

Inside the extended partition we create the logical partition, where the swap will live.

(prompt do fdisk): n

l, to create the logical partition
And accept the default values for this logical partition fill the extended one.

Finally, we change the type of the last partition from Linux (its default) to Linux SWAP.

(prompt do fdisk): t

Answer 5, and then 82. The number of the partition and the code for swap, respectively.

Write the changes and get out.

(prompt do fdisk): w

And for the very last step of this part, you setup the swap as true swap.

# mkswap -v1 /dev/hda5

4.6. Check the root partition…

# e2fsck -f /dev/hda1

4.7. … and resize it.

# resize2fs /dev/hda1 9934M

4.8. Now, reboot with

# shutdown -r now

5. Try it on vmware player.
After the shutdown command it will boot normally, ignoring the live cdrom (even it still being setup on the vmx file, from item 4.2 of this how to; you should restore the vmx file to its early state).
Now open a terminal on the guest system and issue the df command:

$ df -h

The new size should be 9.6 G as in this line

/dev/sda1 9.6G 4.7G 4.6G 51% /

Notice that for some mysterious (to me) reason the virtual harddisk now show up as /dev/sda instead of /dev/hda, but it works anyway.

This is it, any problems drop me a comment.

Um pensamento sobre “Resizing Maemo SDK VMware Appliance Virtual HD

  1. Olá Marcelo,

    estou tentando criar uma segunda partição em uma vm mas está dando erro na hora de formatar. O que eu fiz:
    1) aumentei o tamanho da máquina com vdisk-manager
    2) dei power on na máquina
    3) rodei o gparted (Ubuntu 7.10) – ele reconheceu o espaço.
    4) Na hora que ele tenta formatar, ele dá erro dizendo que não encontra o /dev/sda5!!!!

    Vc sabe se tem algum parametro no vmware para que ele reconheça a nova partição?

    Tanto o host quanto o guest são Ubuntu 7.1. Estou usando vmware server 1


Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do

Você está comentando utilizando sua conta Sair /  Alterar )

Foto do Google

Você está comentando utilizando sua conta Google. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s