Você está na página 1de 3

Convertendo drive virtual VMDK ou VDI em imagem ISO / Convertin...

http://www.previsioni.com.br/jailsonjan/?p=389

By 17/08/2012 , , , , , , VirtualBox ,

(Portuguese and English) Resolvi postar esta soluo aqui no meu blog, pois sei que ela ser ltil para muitas pesssoas e servir de lembrete para mim mesmo. Ontem tive uma necessidade e logo depois surgiu um grande problema. A necessidade: Precisava fazer uns testes com uma mquina virtual que estava dentro da VirtualBox, configurada e rodando corretamente. O problema: Transformar o drive da mquina virtual no formato em uma funcional, para ser

replicada em outros servidores, ou seja, gerar uma iso bootvel e instalvel. Lembre-se que arquivo VMDK o drive da mquina virtual, voc o encontra no diretrio oculto da VirtualBox e tem o nome de HardDisks. Usei todas as formas que conhecia de converso, afinal uso Linux desde as primeiras verses e j vi de tudo, mas para a minha surpresa, nada estava funcionava do jeito correto na converso da mquina virtual, pesquisei bastante na internet e nada, as solues eram imensas, incompletas e sem um fim prtico. Tudo era extremamente macarrnico e pedia a instalao de software de terceiros sem muitas informaes. Outros diziam que isto era impossvel, pela estrutura do arquivo original. E como diz o ditado Sou brasileiro e nunca desisto!. Fiz uma pausa para tomar um caf e a surgiu uma idia, como diz um grande amigo: -As melhores idias sempre surgem no banheiro, na hora do caf ou em um momento que voc no pode anot-las e tem que ficar decorando para no esquec-las. Lembrei-me que a VirtualBox possui um conjunto de commandos via console, j havia usados alguns, dentro de outras necessidades, palestras que dei e de outros testes rpidos, at a, nada, o Linux tem centenas de comandos, mas eu precisava de uma soluo rpida, prtica e funcional. Lembrei-me ento que o VBoxManage possuia inmeras opes. Pensei ento: Ser que ele no tem uma converso para um outro tipo de padro do qual eu teria mais facilidade de converter. Comecei a testar, resultados incompletos. Continuei testando, resultados parciais com erros no final. Continuei nos testes, testando, testando, at que cheguei ao seguinte comando: #

O comando de gerenciamento da VirtualBox. Tem que ser este comando, caso contrrio no funciona, ele vai usar recursos internos da VirtualBox. Este comando no muito documentado (agradecimentos a quack quixote (moderador do superuser.com) por ter me lembrado do uso deste comando).

1 of 3

08/03/2013 21:47

Convertendo drive virtual VMDK ou VDI em imagem ISO / Convertin...


O comando de gerenciamento da VirtualBox. Tem que ser este comando, caso contrrio no funciona, ele vai usar recursos internos da VirtualBox. Este comando no muito documentado (agradecimentos a quack quixote (moderador do superuser.com) por ter me lembrado do uso deste comando). Converte o arquivo VMDK para o padro RAW (mas a extenso do arquivo que eu coloco IMG, d quase na mesma). O arquivo foi convertido para IMG corretamente, testei o arquivo e ele estava perfeito. Mesmo com o arquivo IMG correto, faltava convert-lo para ISO, para que fosse colocado em um pendrive ou para que fosse feito um DVD. Foi a que a experincia com o Linux durante todos estes anos, me mostrou um caminho curto, usar o comando MV para fazer isto. Sim converter usando o move. Pode parecer estranho, mas funciona, o comando est abaixo: # Pronto, agora possua uma imagem ISO que no passado tinha sido um drive VMDK de uma mquina virtual, restava agora test-lo. Troquei os atributos do arquivo ISO para 777, pois a VirtualBox, na criao da mquina virtual, algumas vezes, apresenta uns erros de carregamento da imagem se ela estiver com outro atributo. Para facilitar tudo coloquei em 777. Peguei a imagem *.ISO criei uma nova mquina virtual e coloquei a iso para dar boot pelo drive de cdrom da mquina virtual. Tudo funcionando corretamente. Instalei a imagem em uma pendrive, lembram-se do poderoso comando dd do Linux, basta us-lo e a tudo funcionou corretamente. Queimei um dvd, tambm funcionou. Instalei na primeira mquina, funcionou. Testei tambm com arquivos e este mtodo funciona perfeitamente.

http://www.previsioni.com.br/jailsonjan/?p=389

Resumo de tudo: com duas linhas no Linux, se faz muitas coisas. O importante fazer testes e estudar um pouco mais. Se voc vai referenciar este artigo no seu blog ou site, criar outro artigo baseado neste, informe a fonte. No faa plgio. Criado por: I decided to post this solution here in my blog, because I know it will be most useful for many peoples and serve as a reminder to myself. Yesterday I had a need and soon after came a big problem. The need: I needed to do some tests with a virtual machine that was inside of VirtualBox, configured and running correctly. The problem: Transforming the drive of the virtual machine in the format in an functional, to be replicated to other servers, ie, generate an iso bootable and installable. Remember that file is the drive of the virtual machine, you find it in the hidden from the VirtualBox and has the name harddisks. I used to know all forms of conversion, after using Linux since the early versions and have seen it all, but to my surprise, nothing was worked the right way to convert the virtual machine, the internet and googled quite nothing, the solutions were enormous, and incomplete without a practical end. Everything was extremely poorly and called for the installation of third party software without much information. Others said that this was impossible, the structure of the original file. And as the saying goes Im Brazilian and never give up. I paused for a coffee and there arose an idea, as a good friend says: The best ideas always-emerge in the bathroom, over coffee or at a time that you can not write them down and have to stay for decorating do not forget them. I remembered that VirtualBox has a set of commands via console, some had already used within other needs, I gave lectures and other rapid tests, so far, nothing, Linux has hundreds of commands, but I needed a speedy, practical and functional. Then I remembered that the VBoxManage possessed numerous options. Then I thought, Does not he have a conversion to another type of pattern which I would find it easier to convert. I started testing, incomplete results. I continued testing, partial results with errors at the end. I kept on testing, testing, testing, until I reached the following command: #

VBoxManage The command management of VirtualBox. internalcommands this command has to be, otherwise it does not work, he will use internal resources of VirtualBox. This command is not much documented (thanks to Quack Quixote (moderator superuser.com) for having remembered me from the use of this command). converttoraw Convert the file VMDK to the standard RAW (but the file extension is what I put IMG, gives almost the same).

2 of 3

The file has been converted to IMG correctly, I tested the file and it was perfect.

08/03/2013 21:47

Convertendo drive virtual VMDK ou VDI em imagem ISO / Convertin...


converttoraw Convert the file VMDK to the standard RAW (but the file extension is what I put IMG, gives almost the same). The file has been converted to IMG correctly, I tested the file and it was perfect. Even with the file IMG correct, lacked convert it to ISO, to be placed on a flash drive or to a DVD that was made. It was there that the Linux experience for all these years, showed me a short path, use the MV to do this. Yes convert using the move. It may seem strange, but it works, the command is below: # Okay, now had an image ISO which in the past had been a drive VMDK of a virtual machine, test it now remained. I changed the file attributes ISO to 777 for the VirtualBox, the virtual machine creation sometimes presents some errors loading the image if it is with another attribute. To facilitate all put in 777. I grabbed the image *. ISO created a new virtual machine and put the iso to give boot the cdrom drive of the virtual machine. Everything working properly. I installed the image on a USB stick, remember the powerful command dd of Linux, just use it and then everything worked correctly. I burned a DVD, also worked. I installed the first machine, it worked. I tested also with files and this method works perfectly.

http://www.previsioni.com.br/jailsonjan/?p=389

Summary of all, with two lines in Linux, you do many things. The important thing is to test and study a little more. If you will refer to this article on your blog or site, create another article based on this, the source informs. Do not plagiarism. Created by:

*** Jailson Jan de Oliveira um linuxer, formado em Gesto de Projetos de TI, ps-graduado em Projetos de Sistemas, atua na rea de TI e Segurana de Redes a mais de 20 anos, tendo trabalhado em multinacionais e estatais no Brasil. *** Jailson Jan de Oliveira is a linuxer, graduated in Management of Projects of IT and graduated school in Projects of Systems , acts in TI and Network Security more than 20 years, having worked in multinationals and companies of the government in Brasil.

1. Posted agosto 23, 2012 at 6:49 PM Ol amigo, estou precisando fazer exatamente o que voc fez, mas quando executo o comando acima: VBoxManage internalcommands converttoraw Droid com Gapps-disk1.vmdk imagemiso.img no Windows ele d o erro: Only converting harddisk images is supported, mesmo sendo o arquivo vmdk. Alias so dois discos, disk1 e disk2, eu poderia criar dois ISOs e abri-los seguidamente? E o nome dos discos possuem espaos como voc pode ver devo usar aspas assim mesmo? Muito obrigado pelo post e se possvel me der uma mo. 2. admin Posted agosto 24, 2012 at 3:13 PM Fala Joo, Toda vez que utilizo este comando, fao no Linux, mas nunca tive problema algum. Sim voc pode gerar duas imagens ISOS separadas e recuper-las para dois HDs diferentes ou em outras mquinas virtuais, funcionam tambm. Veja qual a sua verso do VirtualBox,se muito antiga ou no. Valeu, Jailson Jan

3 of 3

08/03/2013 21:47

Você também pode gostar