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!!
Screencast
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
Mar 09, 2012 @ 06:14:21
I am happy I’ve found this blog! I was desperately looking for information on SmartOS before diving in it.
Keep going!
Mar 13, 2012 @ 05:13:22
Very nice! The screencast is very good!
May 05, 2015 @ 06:18:48
As I ported some KVM VMs from a linux host (using zfs on linux with zvols), thats the way I did it:
{
“brand”: “kvm”,
“alias”: “Alias”,
“resolvers”: [
“RESOLVERIP1”,
“RESOLVERIP2”
],
“ram”: “4096”,
“vcpus”: “3”,
“nics”: [
{
“nic_tag”: “admin”,
“ip”: “IP”,
“netmask”: “255.255.255.0”,
“gateway”: “GATEWAYIP”,
“model”: “virtio”,
“primary”: true
}
],
“disks”: [
{
“boot”: true,
“model”: “virtio”,
“block_size”: 8192,
“compression”: “lz4”,
“size”: 102400
}
[, ADDITIONAL DISKS POSSIBLE]
]
}
> vmadmin create -f VM.json
Successfully created VM UUID
> nc -w 120 -l -p 8023 | zfs receive -F zones/UUID-diskN
Old Host:
> zfs send OldVMZvol | nc -w 20 SMARTOSHOSTIP 8023