How to Clone/Backup a VirtualBox DomU

Posted by JD 09/02/2008 at 14:12

Steps to clone/backup a VirtualBox domain

that can be restored to the same or a different machine. Start by shutting down the VM to be backed up/cloned. Then …

$ VBoxManage clonevdi Master.vdi Clone.vdi

and the (undocumented) function

$ cp Master.vdi Clone.vdi
$ VBoxManage internalcommands setvdiuuid Clone.vdi

The 2nd command stuffs the clone with a new SID.

Warning – this doesn’t backup any SNAPSHOTs

you may have made below the {root} VDI file. Here’s a directory view

 C:.
├───Machines
│ ├───Ubuntu Upgrades
│ │ └───Logs
│ └───WinXPPro
│ ├───Logs
│ └───Snapshots
└───VDI

VDI/ contains the base installations. Machines/ contains each XML DomU description file and snapshots where they exist. You need these for your backup too. Copying the .vdi files is not enough to back them up. While it will probably work on the same PC with VirtualBox, taking those files to another machine with a slightly different configuration may not work. Use the VBoxManage command.

_* I’m not responsible if this doesn’t work for you. Always work with test data when you are doing any of this until you prove it works on your machine.

VirtualBox and Vista-64 2

Posted by JD 09/02/2008 at 09:12

Vista is slow even when you get a new machine. I bought a new Dell Studio 1535 laptop last week with this config:

  • Core 2 Duo T8100
  • 4GB DDR2 RAM
  • Intel x3100 Graphics 1280×800-eh
  • 320GB disk
  • Vista Home Premium 64-but

Out of the box, this config should be FAST, VERY FAST. It isn’t. It’s slow, really slow. I will admit, it is pretty, but I didn’t buy this $1k machine to be pretty. Vista is slow on my 4 day old laptop with 4GB of RAM and no extras installed. Unacceptable – Dell and MS, are you listening?

Run WinXP in a VirtualBox VM

Preliminaries

  1. Do you know what a virtual machine is? "Check out this Wikipedia article ":http://en.wikipedia.org/wiki/Virtual_machine to start.
  2. You’ll need to be committed to this process. This is not a quick fix. You’ll be living with this configuration going forward. Every 3-7 days, you’ll want to reboot Vista for sanity.
  3. I got a BSOD on Vista last night after I’d shutdown the VMs and VBox; no other data loss that I can tell
  4. You’ll need a legal WinXP license that can be activated with MS.
  5. Read all the directions through before you start. I’m not responsible if you fail and destroy your only working PC.
  6. Get any WinXP network drivers before you start. Actually, download every thing you will need before you start since your networking may not work for a few hours. A better idea is to have another PC with network connectivity ready to get the stuff you forget to get.
  7. If you change between WiFi and wire LAN connectivity, be prepared to use `arp` and `ipconfig /renew` alot. Vista seems to disconnect from networks whenever it feels like it.
  8. Expect this to take a good 1-2 hours to setup the first VM not including the 2+ hours to install WinXP. Later, setting up VMs takes about 5 minutes when you know what you are doing.

Suggestions for your new Vista box

If you can’t or are unwilling to wipe vista off and start over with a fresh XP or Linux install, like I was, perhaps …

  1. Buy more RAM, 3+GB – 4GB if you have 64-bit Vista. I don’t think that will help with the speed, but it will help with what we have planned. Vista “likes” at least 2 GB of RAM to itself, so if you only have 2GB of RAM, move along, there’s nothing to see here.
  2. Configure Vista to be a minimal OS, UNinstall every app that you aren’t using. The goal is to have the minimum disk, memory and CPU footprint, while leaving enough to
    • control your networking
    • not get hacked
    • Uninstall Norton, MacAffee, and all the other crap “included”, especially the media center garbage. Leave an antivirus scanner – I"m using AVG Free version with URL checking disabled (for privacy)
    • Set the machine for “best performance” to turn off all the fancy shading and other effects and set the GUI for “Classic mode”.
    • Defrag the disk if that’s an issue – probably not.
    • Reboot – go into the BIOS and enable the Hardware Virtualization Instruction support. AMD and Intel call these different things. This is needed to improve performance.
  3. Grab the non-OSS VirtualBox – the license will work for non-Corporate IT supported installs and personal use. This version supports USB devices, the OSS version doesn’t. You can use it on company equipment provided IT doesn’t install it.
  4. load VirtualBox on your Vista machine – vbox going forward
  5. In vbox, use Host Networking (that means you’ll need to be comfortable setting up “Bridged Networls” – without this, you’ll end up with a PC that isn’t connected. You can use NAT connections, but that wasn’t useful to me, so you’re on your own.
  6. In vbox, use the Intel PRO 1000 Network setting. Linux has drivers for this built in, but you’ll need to download the drivers from Intel for WinXP. This is important as the other network options gave me problems with disconnects, etc.
  7. In vbox, 20GB Disk – use which ever disk type you like, but know that the choice will impact performance and backups.
  8. In vbox, Change the video memory from 8M to 128M. I think this could be important for running at higher resolutions with true color graphics. Most of you won’t recall the days of 16 or 256 colors. All PC graphics cards support 16M+ colors at 1024×768 resolutions now.
  9. Put your WinXP install CD into the PC and configure this new VM to boot from it. There’s 2 places to be certain it boots the CDROM.
  10. Boot the VM
  11. load WinXP into a VM under it. Use an old XP license from an old machine that you don’t run anymore. My old Dell 600M laptop XP disk installed flawlessly and the MS registration went through easily, no phone call needed. I had another WinXP Home license ready.
  12. Don’t do anything with the screen resolution yet. Get get the networking in the VM working. I wouldn’t load any software at this point either – now WinXP Patches or SPs.
  13. Load the vbox client addons to get higher resolution graphics and other nice additions.
    1. The client addons disk was included in your Vbox install,
      1. just mount the CDROM image on the VM setup menu (shutdown the WinXP VM, modify the CDROM ISO and reboot the VM). Don’t boot from it.
      2. Boot using the HD, not the CDROM
      3. Find the loaded CD and run the install program.
    2. Now configure the local drive access, screen resolution and I changed the default get out of VM key from to F11.
  14. Install all the WinXP patches (SP3 etc.) then shutdown the VM and back up VM files off to another disk or server. Don’t just copy the files.
    1. Create a “checkpoint”, if you like.
  15. Next I installed many, many of my apps, from MS-Office 2003, Firefox, Thunderbird, Divx, VideoRedo Plus, VLC, Opera, TrueCrypt, etc… and made another backup.
    1. Create a “checkpoint”, if you like.

Results

  1. I’m getting nearly native performance on my XP VM. Oddly, Vista is still slow on the host system.
  2. When I’m running full screen, I forget I’m in a VM even when doing video editing or encoding. Same for Linux VMs.
  3. Unless you are running fairly new games, this setup works with the extra niceness of trivial system backups, checkpoints, etc. If you use new games, forget VMs, this solution is just for productivity workers, lite gamers. I don’t know what level of DirextX is supported inside a VM, if any.
  4. Keep your “data” outside the VM on the host drive. The VM just holds programs and settings – setup around 20GB for XP, mine is using around 10GB now with MS-Office and about 20 other programs installed.
  5. Backups – perfect, recoverable systems to any VirtualBox running host. Back to exactly where you were in 2 hours or less on a completely different machine. This is the programs, not the data.
    1. Backing up VMs is not a trivial `copy`.
    2. Data backup – use MS-SyncTool or some other way to back it up daily over your network.

Update 9/2/08: If you get stuck, use google and read the virtualbox wiki carefully. I am not available as your personal guru without an hourly contract + expenses.

Update 9/3/08: Today is the first time I’ve connected to my KVM and used my desk with this new laptop. Everything works good, but it doesn’t exceed my expectations. The screen resolution changed to the native 1920×1400 of my 24" monitor. There is lite video flickering, that may drive me nuts; the laptop X3100 graphics chip isn’t the best, but the additional screen real estate is much needed. I suspect a better host graphics card would be significantly better.

More on Virtual Machines like VMware, VitrualPC and VirtualBox.

10-19.2008 update

So the lockup issue for vbox under Vista-64 was due to a huge memory leak in some Microsoft code. MS has a hotfix, but not a patch for this. That means you have to register, agree not to share the fix and use a password to access the fix. It is fairly easy to know which hotfix – the vbox guys have it documented clearly.

Basically, the VirtualBox guys started using a screen refresh routine that nobody else had used in Vista. A few dot releases later and vbox will stop using that call. It isn’t available in a formal released version yet.

Since applying the MS hotfix, my vbox system has been fairly stable. Zero BSOD.

The network disconnects still happen, but have been reduced significantly. Rather than every 15 minutes, they are every few hours. I changed my wireless router out (d-link —> linksys). That is the only noticeable change besides the memory fix. The disconnect happens under vista without any virtualization running at all. Bad Microsoft, bad Dell. Bad. My old laptop (WinXP and Dell) had no issues with either wifi router and disconnects.

Virtual Machine Trials - p3

Posted by JD 09/01/2008 at 11:30

Back to Part 2

So why would you want to run your desktop in a VM?

There are many reasons. Most of them have to do with the way that Virtual Machines aren’t connected directly with the hardware they run on.

  1. Virtual Hardware: By virtualizing the actual hardware away, gone are the days of searching for funny drivers. You can make every VM use the same virtual hardware.
  2. Easy, complete, full, backup. Since the VM is just 1 or 2 files on the disk of the host, backup is as simple as shutting down the DomU and copying the file(s) off to another media. You can burn a 20GB image to DVDs, CDROMS, or just copy it over a network to another box. There are 3 ways the disks can be setup
    1. Raw disk access – you create a partition outside the normal Dom0 disks and place the DomU filesystem their. This will provide the best disk performance since you are using just a very thin layer between the DomU and Dom0 disk system.
    2. Pre-Allocated Disk – this is a file that is pre-allocated to the maximum size requested. If you ask for 20GB, then the file size is 20GB to start. The performance is good since Dom0 won’t be modifying that file as it grows. The bad is that when it comes time to backup the file, it will be 20GB even if you are currently using just 1GB of space. Compression should reduce this greatly for backups, but that is just an extra step you’ll want to take.
    3. Automatic growth Disk – this is the most efficient from a disk use perspective, but the worst performing for the disk subsystem. Backups will be just a tiny bit larger than the actually used space. For trying out VMs, this is usually the first way to go since it doesn’t require a big investment in disk or backup effort.
  3. Easy full, complete, restore; Since you backed up the COMPLETE VM, restoring that file under another VM host will put you back to exactly where you were with all settings intact. Your laptop gets dropped in the airport before the largest meeting of your life? No problem, buy another at Best Buy and load your VM overnight from your backup. When you startup the DomU, everything is just as you left it. Emails, contacts, programs, and data. Everything.
  4. Snapshots – these are internal backups managed by the virtualization host. I create a snapshot before installing a new program or going on a trip or trying a new driver. If anything goes bad, I drop back to the old point. Imagine you’re going on a trip where internet connectivity may be forced through undesirable hotel connections. Virus risk is high. Do a full backup before you leave home and a snapshot before you hop on that network. Any issues? drop back.
    1. Think about that just a little. You can go back to where you were … afraid of viruses? Create a snapshot – do the dangerous thing, then drop back. No worries.

What’s the downside?

  1. Complexity – obviously, setting up Dom0 and DomU isn’t as easy as setting up a normal PC. However, once it is setup, you don’t need to know very much about it. Don’t forget to backup your DomU.
  2. Possibly performance, but probably not. This is less of an impact now that new CPUs have virtualization hooks in them. You probably just need to enable them in the BIOS of your system before booting.
  3. High End Gaming – Yep, if you run games that need direct access to the video card, then VM isn’t for you. However, if you run Real-Time Strategy Games or games from 5 years ago, then at lease VirtualBox has you covered.
  4. Higher Hardware Requirements. This is true. You’ll need more disk, more CPU and definitely more RAM to use VMs instead of not. Let’s look at each of these.
    1. More Disk – a VM needs another copy of your OS. Everything else related to disk is the same as what you’d need to run the programs and have the data without a VM.
    2. More CPU – Just a tiny bit more, say 5% so I wouldn’t worry about this. Modern PCs with dual core CPUs are faster than you can use except for video editing. Well, if you’re running Vista, call that 10% – it really is a hog.
    3. More RAM – this is the biggest issue. Unless your computer has 4GB or more of RAM, you will probably need to be careful running VMs. I’m setup with 2GB for Vista and 2GB for WinXP on my DomU. My main concern was giving each DomU the amount of RAM is needs for the workload I perform. No more, no less. Vista on Dom0 will get whatever is left, but no less than 512MB. A Dom0 with resource problems isn’t good for any of the other domains.

The Future

I plan to load Ubuntu Hardy on my laptop soon, but that OS runs very nicely with just 256MB of RAM and 5GB of disk.

I may setup DSL and PuppyLinux DomUs too, just to have them for family and friends who’ve never seen Linux. They each run with 64MB of RAM and 150MB of disk. With checkpoints, I can let them go crazy in the DomU and drop back to a fresh startup when they are done.

Back to Part 1 |
Back to Part 2

What other people have to say

Virtual Machine Trials - p2

Posted by JD 09/01/2008 at 11:03

Continued from Virtual Machine Trials – p1

  • Xen
    Xen has a host, Dom0, and a client, DomU. I’ve been using Xen on my Linux hosts for about 8 months. Unfortunately, it wouldn’t load WinXP without a fairly recent x86 CPU – something within the last 2 years. At the time, I was using an Athon 1800+ for this blog and a few other services.
    Setting up Xen after installing Ubuntu 8.04 LTS “Hardy” is almost trivial. A single `apt-get install ubuntu-xen-server’ was it. Next create a small DomU for testing so you get the hang of running under Xen. Starting, stopping, checkpointing, etc.
    I like Xen. It is stable, maintainable and, in theory, you can run almost any x86 OS if you have current CPU. As with all VM technologies, RAM will probably be the first limit to your number of running VMs. Today. I’m running:
    • Hardy Dom0
      • Hardy DomU – blog
      • Hardy DomU – mail
  • VMWare Server
    I used VMWare Server a few years ago on different machines in the house, a laptop and a server Linux machine.
    On the linux server, there were issues since it must attach internally to the kernel. That means you have to relink the kernel whenever the kernel or vmware server changes. At a point, that became too much of a hassle to continue.
    On the Laptop, the only issue was with performance. VMs under it were slow. The Dom0 was WinXP and the DomU was ‘DSL’ and ‘Puppy Linux’ – both distributions are designed to run on minimal hardware with very low resource requirements. Since I had performance issues, I stopped using them after a few days and uninstalled VM-Server.
  • VMWare ESXi
    My experience with this host is extremely limited. VMWare announce they were making it free to use, so I registered and pulled a copy down. It is known for being an extremely tight host with minimal overhead. I don’t know. It wouldn’t install on either of my servers or on my laptop. It couldn’t find any disk drives in those machines. Free is nice, but not when your hardware isn’t supported AND doesn’t work at all.
  • MS-Virtual PC
    Free. I hate MS, but with Vista this was an obvious choice for supporting VMs. I loaded it, it worked mostly, but the video performance was poor. Uninstalled.
  • Sun VirtualBox
    I tried this solution about a year ago. It took a little tweaking to get the networking right and didn’t honor my laptop power settings. Basically, the DomU was always “on” which cased the fan to run 24/7. Performance was good, better than any of the other solutions. I had high hopes for this solution. After re-reading the license again, I determined it was safe to use on my laptop and installed it.
    • Vista-64 Dom0
      • WinXP DomU

It is fast – like native fast. Graphics are good enough to perform video editing. Wether running in full screen or window-ed mode, it performs very nicely. Again the networking took a little to get configured properly. The trick seems to be to use the Intel 1000 Pro network adapter. WinXP doesn’t come with a driver for this, so you need to pull it down from Intel.com. I’m running in “host” network mode. I’m very happy with VirtualBox.

See why you’d want to run your desktop in a VM in Virtual Machine Trials – p3

Virtual Machine Trials - p1

Posted by JD 09/01/2008 at 10:46

So mein laptop ist kaput. It fell about 16" to the carpet and never worked again. The disk drive seems ok – I’ve pulled all the data from it already. I also had a backup from the night prior to this accident stored on another server here.

I purchased a new laptop using a huge discount" – it should be blazing fast; core 2 duo, 4GB ram, 320gb drive. It has more memory than either of my servers! The only issues is Vista-64bit. The suckage is high.

Anyway, that’s how I got where a virtual machine setup became necessary. WinXP is the right answer for a business, not Vista and certainly not Vista-64 bit. When I first booted this laptop, I was shocked on how slow this new machine was. It really was slow. Simply amazing. I shutdown as many services, set the desktop to “classic mode” and installed antivirus software.

So, which Virtual Machine Host should you use?

Virtual Machines, VMs, are a good answer for running other operating systems without a big commitment in hardware or disk. Google will help you understand them better.

There are a large number of VM hosts out there. I’ve used many of them. Most for just a few hours, but occasionally for months. We will only worry about x86 compatible VM hosts, not that IBM, HP, and Sun don’t make excellent VMs. I’ve personally used VPAR, NPAR, LPAR, Containers and Domains – they work within the fairly minor limitations. x86 VM Hosts are mostly free for personal use and some can be used in a business for free too.

That’s enough setup in the next article. I’ll go into these VM Hosts in the next.

  • Xen
  • VMWare Server
  • VMWare ESXi
  • MS-Virtual PC
  • Sun VirtualBox

Part 2

Google and NO Privacy

Posted by JD 08/22/2008 at 10:42

Google is out to make money. All of use use google in some way almost every time we get behind an internet connected computer. Google is very good at taking raw data and correlating it for different purposes – mostly to target ads to interested people. That’s today. Soon, I predict, they will have much more relevant data than even Acxiom does about us.

Xen and Zimbra

Posted by JD 08/21/2008 at 12:09

What I need:

  1. Zimbra server running under Xen
  2. Prefer Ubuntu 8.0x LTS as Dom0

The problems seen doing this so far are:

  1. Prefer an Ubuntu-based DomU – <— couldn’t get the zimbra supported version to load
  2. file: needs to be replace by aio:tap: for some reason in the cfg file
  3. Tried CentOS-5 via bootstrap – didn’t work
  4. Tried CentOS-5 via rinse – didn’t work – stuck at maintenance boot but didn’t know the root password
  5. Replaced the CentOS image file with another … and got further after switching from hda2 into sda1 in the cfg file based on error. But the start up had many, many issues – missing modules – i.e. FATAL problems
  6. Along the way, there have been numerous other issues to be solved (NIC drivers, vbd device limits, etc)

There needs to be an easier way and one that actually works with the scripts would be really nice too.

BTW, getting a xen hardy DomU installed is trivial. It will be nice when Zimbra supports the current 8.04.x LTS, which they have committed to do … someday.

Ok, someday seems to be TODAY! YIPPY! 8.04 supported!

10/18/2008 Update

It has been a few months since we started using Xen for our infrastructure. The jury is still out on whether it is a success or not. Two days ago, I would have said it was a complete success … until more of the MAJOR network issues happened yesterday – a Friday.

Some of the DomUs became really slow to access over both the network and by the console. The Dom0 became nearly impossible to access. Ping had 88% packet loss both from other machines and between DomU and Dom0 attempts (once I finally got a connection). Not good. Long periods of un-responsiveness to/from both Dom0 and DomU from other non-virtual machines got really, really bad. It is terrible this morning as I write this.
Last night, I implemented these changes:

  1. to the /etc/network/interface file
    • DomUs: post-up /usr/sbin/ethtool -K eth0 tx off
    • Dom0: post-up /usr/sbin/ethtool -K eth0 tx on
  2. to the /etc/rc.local
    • mv /lib/tls /lib/tls.disabled

So every reboot will reset tls to the desired value – gone. That last command is part of the server setup. It came back, probably due to an apt-get upgrade.

Neither of these changes appear to matter this morning.

How to install Zimbra on Ubuntu 10.04 LTS

Nearly Free WiFi Booster

Posted by JD 08/13/2008 at 21:29

In the interest of full disclosure, I haven’t tried this, but for the cost of a sheet of cardboard, a little toner and foil, you can build a wifi signal booster.

Here are the original plans or you can use the better cleaner template.

New PC in da house!

Posted by JD 08/02/2008 at 09:03

I love Georgia Tax Free Holidays.

On these 4 days, I plan a trip to the local Fry’s to see what’s available as a deal. This year was no different. Thursday a few ex-TIAs from AT&T met up and shopped.
I walked away with this booty:

  1. Intel Core 2 Duo E6550 ($139 bundle with MoBo)
  2. ECS junk MoBo,
  3. PCIe x16 nVidia 7200GS card (free AR) and
  4. 2×1GB RAM ($18 AR)
    All for about about $160 AR today! Life was good. Then I discovered that the Mobo only supports 1 IDE connections – which needs to be a DVD drive. I need to get 1 SATA disk to boot it. Back to Fry’s.

Friday at Fry’s – 2 ex-TIAs meet. The mobo/CPU combo has changed to a 50% faster CPU, E8400 – for the same price!. Must get deal.

  1. Return the Thursday deal, get the Friday CPU/Mobo deal. There’s more to the story because the returns guy said they were sold out – they weren’t.
  2. Need a SATA drive since the exact same cheap Mobo is used. 500GB for $87 – eh, not the best price, but I need it. I mention that sounds expensive since the ad had a hitachi 500GB for $69 (which I don’t recall then).

Go and check out. The E8400 CPU doesn’t come with a fan/heatsink … need one of those!

Return the Thursday Mobo/CPU, come back inside. Search for a heatsink/fan – found $9.90. See a cheap power strip for $1.99 – pick it up. Check the ad and see that Hitachi 500GB for $69 is the deal I wanted. Ask about it – yep – get it. Now I need to return the $87/500GB drive. Pay – they make me sign something that says the disk can’t be returned after 15 days. Guess these are really bad disks? Just the disk in an anti-static bag is provided – no cables. I decide that returning the other 500GB disk is too much hassle – I need to mirror them anyway.

CPU Performance Summary:
|=.CPU|=. SPECInt Rate|=.Relative Perf|
|Intel E6600|=.53.7|=.1.0|
|Intel E6550|=.52.7|=.0.98|
|Intel E8400|=.81.5|=.1.57|

Definitely worth the $9.90 added cost to get 50% performance improvement!

Yes, I spent more than the $200 that I intended. Yes, I got much more machine. Yes, it is much cheaper than buying a new machine anywhere else. Heck, it may be fast enough to run MS-Vista …. ok, maybe not – it only has 2 CPUs and 2GB of RAM.

On the good news side, we couldn’t tell the total amount of RAM this cheapo mobo supported – turns out 4GB with 2×2GB sticks. That’s perfect.

Upgrade Debian/Ubuntu Linux Distributions

Posted by JD 08/01/2008 at 17:59

I had a need to upgrade from a 6.xx release of Ubuntu this week and decided to do that rather than perform a fresh install of the current distro. My server has 3 years of tweaks – I’d hate to have to recall what they are, much less attempt to reproduce them on a fresh install. Not gonna happen.

All the instructions online explain how to do this with a GUI. What do you do when the X/Server doesn’t come up? That happened on my test machine on 7.04 – well, that isn’t exactly true. X did come up, but nothing else did. No menu, no left or right click on the desktop. Nada. Networking was up – I’m glad that I bothered to get it working on the first install – this was just a test machine anyway.

So the shortcut for each upgrade 6.xx>7.04>7.10==>8.04 is:

  1. sudo vi /etc/apt/sources.list
    1. edit edgy ==> feisty
  2. sudo apt-get update
  3. sudo apt-get dist-upgrade
  4. sudo apt-get -f install
  5. sudo dpkg —configure -a
  6. sudo lsb_release -a

Ok, so if you lose your desktop, add in at the end and reboot.

  1. sudo apt-cdrom add
  2. sudo aptitude update
  3. sudo aptitude install ubuntu-desktop
  4. sudo /etc/init.d/gdm start

Output should show a new release.

Simple?