Discussion on:

13
Comments

Join the conversation!

Follow via:
RSS
Email Alert
0 Votes
+ -
Nice
lehnerus2000 15th May 2012
Thanks for this tutorial, Jack. happy
1 Vote
+ -
Not recommended
pfrields 16th May 2012
In most cases /dev/sda is the drive the system booted from and runs on. Therefore you have no guarantee the system won't use the drive from time to time during the imaging process, which has the potential to make your target image file inconsistent or (at worst) unusable. You should boot from a live disc or alternate boot device to make the image.

Also, I'm not sure this was clear in the article, but removing files from the hard disk you're imaging with dd has no effect on the time it takes to copy. The dd command is not reading only active files, but rather doing a complete copy of the drive.

Finally, the block size you gave will be less than optimal performance for most modern drives, where the optimal block size would be somewhere between 8192 (8 KB) and 32768 (32 KB). However, larger block sizes tend to have negligible impact, so a block size of 1 MB is usually fine (bs=1M).
0 Votes
+ -
Yep, you're setting yourself up for a lot of wasted time, when the system randomly accesses the system drive, altering the input file.

I always boot to a Linux live CD, Slax, Knoppix and lately fedora. You don't mount the drives, either, that only puts them in the local file system. They are still present as devices, dd works on the device level, not file system.

Gave ya a +1 for beating me to the post. happy
Ripping a drive image then converting it to the VM's native format is an interesting approach. I've done similar when moving VMs between VMware and Virtualbox.

For metal to vm conversion I've generally used these two methods:

System Image backup and restore
- confirm the drivers for the VM environment are on the *nix server
- rip a bootable system backup image with whatever (Clonezilla, Mondo Rescue, Norton Ghost)
- create the vm guest machine with applicable ram/storage/nic
- restore bootable backup image into the VM (mount ISO as VM's cd drive)

System rebuild
- my systems are based on a scripted build; bare metal to fully configured in a mostly automated hour
- create the vm guest machine with applicable ram/storage/nic
- minimal *nix distribution install
- run normal build scripts for repository setup, package installs, configuration
- push data/content back to production machine from developer production branches

The first may be desirable if you have to move the system as is. If you have a setup where content/data resides (subversion, git or similar version/content manager) or your doing a clean restart then the second is desirable to have a fresh build on the new "hardware" environment.
0 Votes
+ -
Nice rundown NS.
jfuller05 16th May 2012
no text.
0 Votes
+ -
Ghost
pgit 17th May 2012
Combine a few steps by booting the G4U (ghost for Unix) live CD. It combines dd and the image creation options.

I've never had any luck with clonezilla, but mondo rescue has been great. (smoothly restore over the network on occasion)

Been years since I've had a copy of Norton Ghost, but IIRC it is the preferable tool. It Just Plain Works (tm)
I stumbled on this article and it could help me out with a current problem I'm having, so a big thanks!

I had the same concern as pfrields above about running dd on a live system, but as pointed out, that is easy to avoid by booting from some other media.
0 Votes
+ -
block size
12p542 16th May 2012
Would changing the block size speed up the process without affecting the end result?
Creating a bit by bit copy of the hard disk is awkward and very slow!!!

Is it not possible to create a partition image at filesystem level (i.e. not bit by bit, like Norton Ghost does) and converting that image into a virtual hard disk supported by VMWare?

I believe that VMWare Converter allows to convert some types of partition images to a virtual hard disk. Please, check out this link:
http://www.vmware.com/products/converter/faqs.html
This looks very interesting but is there a method to convert one of the OSs on a disc on which multiple OSs are installed, to convert only 1 OS.
For example disk SDA contains SDA1=windows,
SDA2=/ of an ubuntu OS, SDA3= /home of the ubuntu OS
SDA4= / of a Fedora OS, SDA5= /home of the fedora OS
SDA6 is an NTFS data partition common for all OSs.
and I want to make a VM image for the Fedora OS.

Is it possible to create an image of the window OS ?
0 Votes
+ -
Moderator
You should be able to
NickNielsen Updated - 21st May
If the drive is mounted.

Run the MOUNT command by itself. Find the line with the ntfs file system. Then enter the mount point into the dd command as follows:

dd if=/dev/sdX of=/media/EXTERNAL_DRIVE/sda.img bs=1024

where sdX is the mount point (sda, sdc, etc.) for the Windows partition.
Thx, this answers the q for the windows partition, I was not sure that a windows could be converted to a VM using this method.

Is there also a solution to create an image of one of the linux OSs without having to copy the entire disk ?
They consist of 2 or 3 partitions per OS (/,swap and /home)
I looked in the dd man page but did not immediately see an option to include multiple partitions, but as I am not a dd expert, there may well be a way to do this.
But Idon't think the capability is there. Not being a Linux expert and not as familiar with VMs as I should be, I can't say for sure.

My take would be to merge the partitions, then save them to the image file. It may also be possible to copy / to the image file, start your virtual machine, mount the appropriate /swap and /home partitions, then save the VM with /swap and /home incorporated.
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.