Showing posts with label Clonezilla. Show all posts
Showing posts with label Clonezilla. Show all posts

Tuesday, February 1, 2011

Use Clonezilla to image KVM VirtIO disks

I'm always seeking to squeeze more speed out of common administrator tasks like disk imaging and P2V conversions. Today I tried using my favorite FOSS cloning software, Clonezilla, to restore an image to a KVM running VirtIO disks. What I found was that the current stable release (20110113-maverick) doesn't recognize VirtIO's /dev/vh[a,b,c...] disk naming syntax. You get used to this working with KVM and I'm still on the fence about VirtIO's name convention verses the more common /dev/sd[a,b,c...] method.

Luckily, another Clonezilla user already submitted a patch for VirtIO drives back in December. It should make it into a future stable release in a few months.

http://sourceforge.net/tracker/index.php?func=detail&aid=3112544&group_id=115473&atid=671650

I was in rush to get a P2V complete, so I used a quick sed onliner to modify stable Clonezilla's Perl scripts to recognize the /dev/vda disk. You'll need to drop into the shell mode to execute this.

sudo sed -i '/\[hs\]/\[vhs\]/' /opt/drbl/sbin/ocs-*

Keep in mind that these changes will be lost if your booting from a Live CDROM.

Using the VirtIO disk drivers improve the disk imaging throughput for my machine by about 15 percent. Also, don't forget to preload the VirtIO drivers on a Windows machine before imaging and restoring. Otherwise you'll get BSOD on boot.

Monday, May 3, 2010

Use Clonezilla for physical disk to iSCSI volume transfer

For the last few nights, I've been playing around with open-iscsi on Debian, Ubuntu and Windows 2008. Getting things up and running was fairly straight forward thanks to all of the helpful blogs and howtos people have posted. What I found missing was how one moves a Linux installation from a physical or virtual disk to an iSCSI volume. The little I found about the subject involved physically mounting the source disk to the iSCSI host or performing some tricky PXE boot magic to run the Linux distribution's installer. I find both of these methods inelegant and limited.

Tonight I came at it again. This time with my favorite FOSS disk imaging tool, Clonezilla!. The wonderful team behind it didn't skimp out and included the open-iscsi packages.

Instructions


Download and burn a copy of the latest Ubuntu version of Clonezilla.

Boot from the Clonezilla live CDROM. Select all of the regional configuration options you require.

Stop when you get the the ncurses prompt to begin using Clonezilla or use the console. Press +F2 to switch the second tty console. This will let you work with the tools and setup a connection to your iSCSI share.

Get some networking configured otherwise you aren't going to be able to connect to the LUN.
sudo dhclient eth0

Now edit the iscsid.conf file.
sudo vi /etc/iscsi/iscsid.conf

Look for the node.startup property and set it to automatic.

Now start the open-iscsi daemon.
sudo /etc/init.d/open-iscsi start

Use the following command to query the iSCSI target for LUNs.
iscsiadm -m discovery -t sendtargets -p IP_OF_YOUR_TARGET

Here's an example of what mine looked like:
user@karmic:~$ sudo iscsiadm -m discovery -t st -p localhost
192.168.50.10:3260,1 iqn.2007-10.local.server-1:storage.lun0

Now I can connect using the following:
iscsiadm -m node -T iqn.2007-10.local.server-1:storage.lun0 -p 192.168.50.10:3260 -l

Now check the /var/log/messages for the newly created virtual SCSI device.
tail /var/log/messages

Now you can switch back to console #1 and continue with Clonezilla wizard. Select local disk to local disk when prompted for which mode to use.