Lets get going with part 2 of the SmartOS Screencast series.
In this Screencast Tutorial we will cover:
- Migrating of any Bare metal or virtual machine to SmartOS using “netcat” and “dd”
- Demo of an Ubuntu VM migration from Virtualbox.
- Using a live Linux system rescue CD in order to boot and use the netcat and dd tools.
- Enabling ZFS compression on our SmartOS KVM Virtual Machine to optimise space.
- We will cover the syntax used for the netcat and dd commands, both on the source and the target VM’s
- Booting the newly migrated VM to verify successful migration.
The tools used in this screencast are very powerful. They will make a exact block for block identical copy of one hard drive to another over the network. The Target SmartOS disk capacity must be the same size or larger than the Source Operating System disk you are cloning. There is not much point in making the SmartOS disk larger as the additional free space will not be usable.
This method will work for any environment, regardless of wether you are migrating a physical server or a virtual server such as Virtualbox, Vmware ESX, Microsoft HyperV etc..
This makes a 100% exact duplicate bit for bit copy. The only issues you may have is probably with Microsoft Operating system clones, that tend to get all freaked out when it finds itself on different hardware or requiring different drivers. If you get the much loved “Blue Screen of Death” after a Microsoft operating system Migration, a driver issue is probably the culprit. Thus far all the migrations I have tried this way have worked flawlessly, except for Microsoft. I have not looked into the Microsoft Migrations in much depth yet, but I suspect what is needed is prior to migration, removing virtualization tools such as Vmware tools and virtualbox guest extensions and then making sure that the OS has any required KVM drivers installed. I would like to get some feedback from anyone who has a successful formula or better method for doing this.
WARNING: These are very dangerous commands and if used incorrectly WILL wipe all the data off your hard drive. Make sure you do not get your source and target “dd” commands mixed up, or you will land up one very unhappy camper with NO data left. Use carefully. You have been warned!!
Commands used in the Screencast
On the SmartOS Node
vmadm create < ubuntu.json zfs set compression=on zones/UUID-disk0 vmadm boot UUID order=cd,once=d cdrom=/systemrescuecd-x86-2.5.0.iso,ide
On the Source Server
dd if=/dev/sda | nc 10.1.1.215 9000
On the Target Server
nc -l -p 9000 | dd of=/dev/sda bs=16M