iSCSI as PV for KVM Host LVM

Direct connetion as pool

<pool type='iscsi'>
        <host name=''/>
        <device path='iqn.xxxxx'/>

I prefer iSCSI as backing storage for LVM

  • iSCSI target attached as /dev/sdc on KVM Host
  • partitioning /dev/sdc
# fdisk -l /dev/sdc
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4194303     2096128   8e  Linux LVM
  • Virt-manager GUI:
    • Host → Details → Storage → Add pool
      • Step1: Name=iscsi1, Type=logical:LVM Volume Group
      • Step2: Target Path=/dev/iscsi1vg, Source Path=(NO /dev/sdc1, better by-path)'/dev/disk/by-path/iqnxxx', Build Pool: flagged → Finish
    • Select iscsi1 in left pane then NewVolume: Name=tubu1b
    • VM(tubu1) → Open → Details → Add Hardware → Storage
      • Allocate entire disk now= flagged
      • Select managed or..
      • Browse to volume tubu1b: /dev/iscsi1vg/tubu1b
      • Device type= Virtio disk
      • Cache mode= default
      • Storage format: leave blank
      • Finish
  • Check KVM Host
# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               iscsi1vg
  PV Size               2.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              511
  Free PE               0
  Allocated PE          511
  --- Physical Segments ---
  Physical extent 0 to 510:
    Logical volume	/dev/iscsi1vg/tubu1b
    Logical extents	0 to 510
  • On Guest tubu1 format and mount new disk
# fdisk -l /dev/vdb
Disk /dev/vdb: 2143 MB, 2143289344 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048     4186111     2092032   83  Linux

# mkfs.ext4 /dev/vdb1
# mount /dev/vdb1 /media/test
  • Check copy with cluster failover

Trig a cluster failover (crm node standby node1) during copy1, VM freeze for 2 seconds

# pv ubuntu-12.04-server-amd64.iso > /media/test/ubuntu.iso

Trig a second cluster failover (crm node standby node2) during copy2, VM freeze for 2 seconds

# pv ubuntu-12.04-server-amd64.iso > /media/test/ubuntu1.iso

Verify data integrity

diff /media/test/ubuntu.iso /media/test/ubuntu1.iso

NOTE: a bug then you need /etc/init.d/udev restart on KVM host if virt-manager timeout

VM clone

hypervisor/iscsi1.txt · Last modified: 2012/08/10 18:56 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ and Anna Perin (anna.perin _@_
DigiBess is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki