From Fedora Project Wiki

StatelessLinux - iSCSI Root

See Stateless Linux HOWTO

Another option which is quite similar to NFS root is to export the ext3 image file as an iSCSI LUN. Again, clients boot using PXE but the initrd downloaded sets up the iSCSI device and mounts the root filesystem from it.

Creating The initrd

Firstly, you need to install iscsi-initiator-utils and set up the iSCSI device. Setting up the device involves discovering and logging into the target.

$> yum install iscsi-initiator-utils
$> iscsiadm -m discovery -t st -p,1
$> iscsiadm -m node -p -T -l

Next, mount the image and set up the chroot which you'll use to create the initrd:

$> mount -o ro /dev/sda tmpmount/
$> mount -t tmpfs none tmpmount/tmp
$> mount -t tmpfs none tmpmount/dev
$> mount -t tmpfs none tmpmount/var/lock
$> mount -t tmpfs none tmpmount/var/lib/iscsi
$> mount -t proc none tmpmount/proc
$> mount -t sysfs none tmpmount/sys

Discover the target in the chroot:

$> chroot tmpmount/ iscsiadm -m discovery -t st -p

Now run mkinitrd:

$> chroot tmpmount/ mkinitrd -with crc32c --with e1000 --net-dev eth0 \
--rootdev /dev/sda --rootfs ext3 -f \
/tmp/initrd.img 2.6.17-1.2693.fc6
$> mv tmpmount/tmp/initrd.img .

Clean up after yourself:

$> for dir in sys proc var/lock var/lib/iscsi dev tmp; do umount tmpmount/$dir; done
$> umount tmpmount/
$> iscsiadm -m node -p -T -u


  • We pass --with crc32c to mkinitrd because of bug #208607

Setting Up A Testing Target

Most people will only use iSCSI root with real iSCSI devices, but for testing purposes it can be quite useful to set up an iSCSI target on your image server.

One option is to use NetBSD project's user space iSCSI initiator from from netbsd-iscsi package, the other one is iSCSI Enterprise Target that is available in Livna repository as iscsitarget. Advantage of NetBSD iSCSI initiator is that it doesn't need a kernel module, on the other hand it doesn't give you possibility to arbitrarily name the target (has to be called target0, target1, ...), and IET is more likely to perform better.

If you don't want the Livna package, you can build IET it from source code:

First, build a Fedora kernel and then build IET, setting KSRC to point to the location of your kernel build:

$> svn co
$> make KSRC=/usr/src/redhat/BUILD/kernel-2.6.17/linux-2.6.17.x86_6

Load the iscsi_trgt kernel module:

$> insmod ./kernel/iscsi_trgt.ko

Create an ietd.conf config file:

$> cat > ./test-ietd.conf << EOF
Lun 0 Path=/stateless/terminal/terminal.img,Type=fileio

Start ietd:

$> ./usr/ietd -f -d 8 -c ./test-ietd.conf

Open TCP port 3260 in your firewall:

$> cat >> /etc/sysconfig/system-config-securitylevel << EOF
$> lokkit --quiet


  • The developer of IET is also helping to develop Linux SCSI target framework (stgt) which looks like it might lead to an iSCSI target implementation with an upstream kernel component. There's still some debate about how the kernel component should actually work and the prototype iSCSI implementation doesn't work.
  • mkinitrd-5.1.17 has a bug (bug 208383 ) where if you create the initrd on the same machine as the iSCSI target, the initrd will try to bring up the loopback network device on the client.
  • mkinitrd-5.1.17 also has a problem (bug 209110 ) whereby if the iSCSI target device is available as anything other than /dev/sda on the machine where the initrd is created, then the client won't boot. You can workaround this by booting the client with root=/dev/sda on the kernel command line.
  • Don't be surprised if you see an iSCSI related kernel oops when booting the client. That's currently the case when booting in a Xen guest with kernel-xen-2.6.17-1.2693.fc6