Ask Your Question

P2v physical machine to virtual

asked 2014-03-08 20:22:24 -0500

lobocode gravatar image

updated 2014-03-08 22:45:27 -0500

mether gravatar image

At work I have a server (physical machine) running Fedora 20 on a 300GB hd with database with postgresql. I need to clone and virtualize this physical machine for virtual. However, I want to clone only what is occupying within the 300GB and not all the 300GB hd. Therefore, the dd command has not been a good option. I don't want to do this with vmware (being owner).

The clonezilla clones only the used space and transforms into image? There are other ways to do this? some link that explains? tutorial?

edit retag flag offensive close merge delete



Please stop using hash in front of tags. I have removed them

mether gravatar imagemether ( 2014-03-08 22:45:11 -0500 )edit

Ok. Sorry.

lobocode gravatar imagelobocode ( 2014-03-08 22:53:08 -0500 )edit

vmware converter is free - you don't say what virtual image format you need, but further conversion from vmware format should not be a problem, i'm not sure however the vmare converter supports Fedora. By the way - in my opinion Fedora 20 on a server it's a very bad idea - it's unstable and in several months you will have to migrate again - what about migrating postgresql to a clean virtual CentOS6?

marcindulak gravatar imagemarcindulak ( 2014-03-10 05:39:30 -0500 )edit

@mether - it's not a proper welcome message to write about the tags - users are hoping to get their questions answered. This is especially confusing for new users - so fixing the system should become a priority.

marcindulak gravatar imagemarcindulak ( 2014-03-10 06:22:25 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2014-03-10 17:21:27 -0500

Rabin gravatar image

updated 2014-03-12 07:37:11 -0500

my quick answer will be to use dd to create a raw image of the drive, and then use "qemu-img conver" to convert it to cow2 format.



sda   = *All* disk 1
sda1 = disk1 -> partition 1
sda2 = disk1 -> partition 2

so let say you need to convert sda1 + sda2 and you need to store the files on sda3, first you need to mount sda3

mount /dev/sda3 /mnt/mydisk3

and then use the dd commands to clone the partitions to a image files

dd if=/dev/sda1 of=/mnt/mydisk3/sda1.raw
dd if=/dev/sda2 of=/mnt/mydisk3/sda2.raw

After the you can use qemu-img to convert the files to other formats

qemu-img convert -f raw -O qcow2 sda1.raw sda1.qcow2
edit flag offensive delete link more


But dd clone only the physical hd (I need clone the logical partition for example).

lobocode gravatar imagelobocode ( 2014-03-11 13:08:37 -0500 )edit

you can clone what ever you want disk/partition/lvm

this will clone all the disk

dd if=/dev/sda of=/tmp/disk1.raw

while this will clone the 3rd partition on disk1

dd if=/dev/sda3 of=/tmp/disk1-partition3.raw

or you can clone the lvm

dd if=/dev/VolumeGroup01/LVM-root of=/tmp/lvm-root.raw

Rabin gravatar imageRabin ( 2014-03-11 17:07:47 -0500 )edit

/dev/sda Write entire partition sda, right? and If I want to record sda1 and sda2 in sda3?how do?

lobocode gravatar imagelobocode ( 2014-03-11 17:25:43 -0500 )edit

i edit my answer to this question

Rabin gravatar imageRabin ( 2014-03-12 07:56:32 -0500 )edit

I'll explain better. Notice how my partition is:

Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors Unidades: setor de 1 * 512 = 512 bytes Tamanho de setor (lógico/físico): 512 bytes / 4096 bytes Tamanho E/S (mínimo/ótimo): 4096 bytes / 4096 bytes Tipo de rótulo do disco: dos Identificador do disco: 0x00036db9

Dispositivo Inicializar Início Fim Blocos Id Sistema /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 1953523711 976248832 8e Linux LVM

Say I decrease the partition sd2 and create a sda3. How to generate an image of sda1 and sda2 (lvm) on sda3? or on an external disk?

lobocode gravatar imagelobocode ( 2014-03-12 15:12:58 -0500 )edit

answered 2014-03-12 05:21:11 -0500

joshuar gravatar image

You might want to try using the virt-p2v utility found in the virt-v2v package. Take a look at the official documentation here.

Note however that Fedora 20 doesn't appear to be a officially supported target so your mileage may vary.

edit flag offensive delete link more

Comments seen as obsolete in fedora 20...but I'll try, try to solve with virt-v2v. thank you

lobocode gravatar imagelobocode ( 2014-03-12 06:09:40 -0500 )edit

Question Tools

1 follower


Asked: 2014-03-08 20:22:24 -0500

Seen: 4,383 times

Last updated: Mar 12 '14