In libguestfs ≥ 1.21.38 you can access at least some iSCSI disks.
On my server (RHEL 6 in this case) I create an iSCSI target backed by a Windows XP disk image:
# service tgtd start Starting SCSI target daemon: [ OK ] # tgtadm --lld iscsi --op new --mode target --tid 1 \ -T iqn.1994-05.com.redhat # chcon system_u:object_r:tgtd_var_lib_t:s0 /tmp/winxp.img # tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \ --lun 1 -b /tmp/winxp.img # tgt-admin -s ...
Previously I opened port 3250 on the server. Because libguestfs doesn’t yet support authentication against the iSCSI server, I had to bypass that:
# tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
Now on the client, I can connect to the iSCSI target using libguestfs like this:
$ export LIBGUESTFS_BACKEND=direct $ guestfish --format=raw -a iscsi://x.x.x.x/iqn.1994-05.com.redhat/1 -i Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Microsoft Windows XP /dev/sda1 mounted on / ><fs> ll / total 1573209 drwxrwxrwx 1 root root 4096 Apr 16 2012 . drwxr-xr-x 23 1000 1000 4096 May 11 17:16 .. -rwxrwxrwx 1 root root 0 Oct 11 2011 AUTOEXEC.BAT -rwxrwxrwx 1 root root 0 Oct 11 2011 CONFIG.SYS drwxrwxrwx 1 root root 4096 Oct 11 2011 Documents and Settings -rwxrwxrwx 1 root root 0 Oct 11 2011 IO.SYS -rwxrwxrwx 1 root root 0 Oct 11 2011 MSDOS.SYS -rwxrwxrwx 1 root root 47564 Apr 14 2008 NTDETECT.COM drwxrwxrwx 1 root root 4096 Oct 11 2011 Program Files drwxrwxrwx 1 root root 4096 Oct 11 2011 System Volume Information drwxrwxrwx 1 root root 28672 Oct 11 2011 WINDOWS -rwxrwxrwx 1 root root 211 Oct 11 2011 boot.ini -rwxrwxrwx 1 root root 250048 Apr 14 2008 ntldr -rwxrwxrwx 1 root root 1610612736 Oct 11 2011 pagefile.sys