Setting up iSER-enabled TGT RAM Disk
TweetCreate a super tmpfs
by constructing a RAID-0 array of remote RAM disks
using TGT and iSCSI. In this example we'll export two 25 GB remote RAM disks
and use mdadm
for the RAID device. Format them with ext4
and disable
journaling for a fast in-memory file system.
On the target (server):
# ramdisk 1
mkdir /tmp/rd1
mount -t tmpfs -o size=25G tmpfs /tmp/rd1
dd if=/dev/zero of=/tmp/rd1/lun bs=1M
# ramdisk 2
mkdir /tmp/rd2
mount -t tmpfs -o size=25G tmpfs /tmp/rd2
dd if=/dev/zero of=/tmp/rd2/lun bs=1M
# target 1
tgtadm --lld iser --op new --mode target --tid 1 -T iqn.2015-01.cln5.rd1
tgtadm --lld iser --op bind --mode target --tid 1 -I ALL
tgtadm --lld iser --op new --mode logicalunit --tid 1 --lun 1 --backing-store /tmp/rd1/lun
# target 2
tgtadm --lld iser --op new --mode target --tid 2 -T iqn.2015-01.cln5.rd2
tgtadm --lld iser --op bind --mode target --tid 2 -I ALL
tgtadm --lld iser --op new --mode logicalunit --tid 2 --lun 1 --backing-store /tmp/rd2/lun
On the client (initiator) connect to the devices using a tool such as
iscsiadm
. Then create the RAID array and file system:
# create the raid array
mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
# setup the file system
mkfs.ext4 -b 4096 -O ^has_journal /dev/md0
And there you have it.