Add new comment

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by Sergiu Pol (not registered) on Mon, 2009-06-29 14:55.

For general usage this tutorial is very good. Actually is a general tutorial for cloning a HDD with Linux installed.

 But if you care about the following things, the above steps are not enough:

1) The physical HDD can be large (250, 500, 750 or 1000 GB) and the Linux partition can be only 20-30 GB. Or some percentage of HDD space can be unpartitioned for later usage. Applying the tutorial ALL the source HDD will be coppied to the destination HDD (the virtual one).

2) The file systems in partitions from the physical HDD can be only 50% or less utilized so is very inefficient to clone the whole FS in the virtual HDD.

Among the above written steps I used some solutions to use in the VM as little space as possible:
A. Reduce the source FS and the device it sits on (partition or logical volume)
B. Copy the HDD without the unpartitioned space

Along with A. and B., we can use some tricks that can make this faster:
- http://tipstricksandmore.blogspot.com/2009/01/after-converting-physical-rhel4-system.html
- http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1002402&sliceId=2&docTypeID=DT_KB_1_1&dialogID=14730726&stateId=0%200%204678181
- http://bisqwit.iki.fi/source/lvm2defrag.html
- usage of dd over the network with compression (good especially for empty spaces) and 4k IO size (faster than default IO size): dd bs=4096 if=/dev/sda | gzip | ssh root@destination_hostname "gzip -dc | dd bs=4096 of=/dev/sda"
- clone the MBR (1st soltion): dd if=/dev/sda of=/dev/hda bs=512 count=1
- clone the MBR (1st soltion): sfdisk -d /dev/sda | sfdisk -f /dev/sdb (over the network you can use sfdisk -d /dev/sda |  ssh root@destination_hostname "sfdisk -f /dev/sdb")
- modify destination hostname and network settings (RHEL and Fedora):
1. check name: (C) uname -n; (C) hostname -a
2. edit /etc/hosts
3. edit /etc/sysconfig/network
4. edit /etc/sysctl.conf
5. reboot (or echo hostname.mydomain.com > /proc/sys/kernel/hostname)
6. edit /etc/sysconfig/network-scripts/ifcfg-eth0 eth1 ...
7. restart network service or computer

Have fun :)


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.