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.

9 comments:

  1. thansk, this helped me a lot.

    just one correction: it's "dhclient" not "dhcpclient".

    ReplyDelete
  2. Thanks for the correction. Updated.

    ReplyDelete
  3. But usually is the iSCSI LUN tied to a particular IP/IQN or not?

    ReplyDelete
  4. this is perfect!

    One question: can i modify the clonezilla liveCD to automatically connect to this iSCSI share every time?

    IE, bypass the TTY2 option and "roll my own" LiveCD?

    ReplyDelete
  5. Yes, you can. See: http://clonezilla.org/customized-clonezilla-live.php

    ReplyDelete
  6. Thanks for the tip. I'm using this inside a virtualbox machine to clone a vdi disk to an iSCSI target. The problem though is that it's slow as molasses... I'm getting a sustained transfer speed of a staggering 185 MB per minute in a virtual setup that on another iSCSI disk gets 60 MB/s disk transfer speed.
    From what I understand the problem is that partclone uses 512 byte blocks. Is there any way to increase the blocksize?

    ReplyDelete