{"id":715,"date":"2011-09-30T10:29:16","date_gmt":"2011-09-30T10:29:16","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=715"},"modified":"2011-09-30T10:29:16","modified_gmt":"2011-09-30T10:29:16","slug":"iscsi-target-on-ubuntu","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=715","title":{"rendered":"ISCSI TARGET on Ubuntu"},"content":{"rendered":"<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div id=\"content\">\n<div>\n<div>\n<p>This guide explains how you can set up an iSCSI target and an iSCSI initiator (client), both running Ubuntu 10.04. The iSCSI protocol is a storage area network (SAN) protocol which allows iSCSI initiators to use storage devices on the (remote) iSCSI target using normal ethernet cabling. To the iSCSI initiator, the remote storage looks like a normal, locally-attached hard drive.<\/p>\n<p>I do not issue any guarantee that this will work for you!<\/p>\n<p>&nbsp;<\/p>\n<h3>1 Preliminary Note<\/h3>\n<p>I&#8217;m using two Ubuntu 10.04 servers here:<\/p>\n<ul>\n<li>server1.example.com\u00a0(Initiator): IP address\u00a0192.168.0.100<\/li>\n<li>server2.example.com\u00a0(Target): IP address\u00a0192.168.0.101<\/li>\n<\/ul>\n<p>Because we will run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string\u00a0sudo, or we become root right now by typing<\/p>\n<p>sudo su<\/p>\n<p>&nbsp;<\/p>\n<h3>2 Setting Up The Target (server2)<\/h3>\n<p>server2:<\/p>\n<p>First we set up the target (server2):<\/p>\n<p>aptitude install iscsitarget<\/p>\n<p>Open\u00a0\/etc\/default\/iscsitarget&#8230;<\/p>\n<p>vi \/etc\/default\/iscsitarget<\/p>\n<p>&#8230; and set\u00a0ISCSITARGET_ENABLE\u00a0to\u00a0true:<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#cccccc\">\n<tbody>\n<tr>\n<td>\n<pre>ISCSITARGET_ENABLE=true<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We can use unused logical volumes, image files, hard drives (e.g.\u00a0\/dev\/sdb), hard drive partitions (e.g.\u00a0\/dev\/sdb1) or RAID devices (e.g.\u00a0\/dev\/md0) for the storage. In this example I will create a logical volume of 20GB named\u00a0storage_lun1\u00a0in the volume group\u00a0vg0:<\/p>\n<p>lvcreate -L20G -n storage_lun1 vg0<\/p>\n<p>(If you want to use an image file, you can create it as follows:<\/p>\n<p>mkdir \/storage<br \/>\ndd if=\/dev\/zero of=\/storage\/lun1.img bs=1024k count=20000<\/p>\n<p>This creates the image file\u00a0\/storage\/lun1.img\u00a0with a size of 20GB.<\/p>\n<p>)<\/p>\n<p>Next we edit\u00a0\/etc\/ietd.conf&#8230;<\/p>\n<p>vi \/etc\/ietd.conf<\/p>\n<p>&#8230; and comment out everything in that file. At the end we add the following stanza:<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#cccccc\">\n<tbody>\n<tr>\n<td>\n<pre>[...]\r\nTarget iqn.2001-04.com.example:storage.lun1\r\n        IncomingUser someuser secret\r\n        OutgoingUser\r\n        Lun 0 Path=\/dev\/vg0\/storage_lun1,Type=fileio\r\n        Alias LUN1\r\n        #MaxConnections  6<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The target name must be a globally unique name, the iSCSI standard defines the &#8220;iSCSI Qualified Name&#8221; as follows:\u00a0iqn.yyyy-mm.&lt;reversed domain name&gt;[:identifier];\u00a0yyyy-mm\u00a0is the date at which the domain is valid; the identifier is freely selectable. The\u00a0IncomingUser\u00a0line contains a username and a password so that only the initiators (clients) that provide this username and password can log in and use the storage device; if you don&#8217;t need authentication, don&#8217;t specify a username and password in the\u00a0IncomingUser\u00a0line. In the\u00a0Lun\u00a0line, we must specify the full path to the storage device (e.g.\/dev\/vg0\/storage_lun1,\u00a0\/storage\/lun1.img,\u00a0\/dev\/sdb, etc.).<\/p>\n<p>Now we tell the target that we want to allow connections to the device\u00a0iqn.2001-04.com.example:storage.lun1\u00a0from the IP address\u00a0192.168.0.100\u00a0(server1.example.com) (comment out the\u00a0ALL ALLline because that would allow all initiators to connect to all targets)&#8230;<\/p>\n<p>vi \/etc\/initiators.allow<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#cccccc\">\n<tbody>\n<tr>\n<td>\n<pre>[...]\r\niqn.2001-04.com.example:storage.lun1 192.168.0.100\r\n#ALL ALL<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#8230; and start the target:<\/p>\n<p>\/etc\/init.d\/iscsitarget start<\/p>\n<p>&nbsp;<\/p>\n<h3>3 Setting Up The Initiator (server1)<\/h3>\n<p>server1:<\/p>\n<p>On\u00a0server1, we install the initiator:<\/p>\n<p>aptitude install open-iscsi<\/p>\n<p>Next we open\u00a0\/etc\/iscsi\/iscsid.conf&#8230;<\/p>\n<p>vi \/etc\/iscsi\/iscsid.conf<\/p>\n<p>&#8230; and set\u00a0node.startup\u00a0to\u00a0automatic:<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#cccccc\">\n<tbody>\n<tr>\n<td>\n<pre>[...]\r\nnode.startup = automatic\r\n[...]<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Then we restart the initiator:<\/p>\n<p>\/etc\/init.d\/open-iscsi restart<\/p>\n<p>Now we connect to the target (server2) and check what storage devices it has to offer:<\/p>\n<p>iscsiadm -m discovery -t st -p 192.168.0.101<\/p>\n<p>root@server1:~# iscsiadm -m discovery -t st -p 192.168.0.101<br \/>\n192.168.0.101:3260,1 iqn.2001-04.com.example:storage.lun1<br \/>\nroot@server1:~#<\/p>\n<p>iscsiadm -m node<\/p>\n<p>root@server1:~# iscsiadm -m node<br \/>\n192.168.0.101:3260,1 iqn.2001-04.com.example:storage.lun1<br \/>\nroot@server1:~#<\/p>\n<p>The settings for the storage device\u00a0iqn.2001-04.com.example:storage.lun1\u00a0on\u00a0192.168.0.101:3260,1\u00a0are stored in the file\u00a0\/etc\/iscsi\/nodes\/iqn.2001-04.com.example:storage.lun1\/192.168.0.101,3260,1\/default. We need to set the username and password for the target in that file; instead of editing that file manually, we can use the\u00a0iscsiadmcommand to do this for us:<\/p>\n<p>iscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;op=update &#8211;name node.session.auth.authmethod &#8211;value=CHAP<br \/>\niscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;op=update &#8211;name node.session.auth.username &#8211;value=someuser<br \/>\niscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;op=update &#8211;name node.session.auth.password &#8211;value=secret<\/p>\n<p>Now we can log in, either by running&#8230;<\/p>\n<p>iscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;login<\/p>\n<p>root@server1:~# iscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;login<br \/>\nLogging in to [iface: default, target: iqn.2001-04.com.example:storage.lun1, portal: 192.168.0.101,3260]<br \/>\nLogin to [iface: default, target: iqn.2001-04.com.example:storage.lun1, portal: 192.168.0.101,3260]: successful<br \/>\nroot@server1:~#<\/p>\n<p>&#8230; or by restarting the initiator:<\/p>\n<p>\/etc\/init.d\/open-iscsi restart<\/p>\n<p>(If you want to log out, you can run<\/p>\n<p>iscsiadm -m node &#8211;targetname &#8220;iqn.2001-04.com.example:storage.lun1&#8221; &#8211;portal &#8220;192.168.0.101:3260&#8221; &#8211;logout<\/p>\n<p>)<\/p>\n<p>In the output of<\/p>\n<p>fdisk -l<\/p>\n<p>you should now find a new hard drive (\/dev\/sdb\u00a0in this example); that&#8217;s our iSCSI storage device:<\/p>\n<p>root@server1:~#\u00a0fdisk\u00a0-l<\/p>\n<p>Disk\u00a0\/dev\/sda:\u00a032.2\u00a0GB,\u00a032212254720\u00a0bytes<br \/>\n255\u00a0heads,\u00a063\u00a0sectors\/track,\u00a03916\u00a0cylinders<br \/>\nUnits\u00a0=\u00a0cylinders\u00a0of\u00a016065\u00a0*\u00a0512\u00a0=\u00a08225280\u00a0bytes<br \/>\nSector\u00a0size\u00a0(logical\/physical):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nI\/O\u00a0size\u00a0(minimum\/optimal):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nDisk\u00a0identifier:\u00a00x00016be9<\/p>\n<p>Device\u00a0Boot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0End\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Blocks\u00a0\u00a0\u00a0Id\u00a0\u00a0System<br \/>\n\/dev\/sda1\u00a0\u00a0\u00a0*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0248832\u00a0\u00a0\u00a083\u00a0\u00a0Linux<br \/>\nPartition\u00a01\u00a0does\u00a0not\u00a0end\u00a0on\u00a0cylinder\u00a0boundary.<br \/>\n\/dev\/sda2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03917\u00a0\u00a0\u00a0\u00a031205377\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0Extended<br \/>\n\/dev\/sda5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03917\u00a0\u00a0\u00a0\u00a031205376\u00a0\u00a0\u00a08e\u00a0\u00a0Linux\u00a0LVM<\/p>\n<p>Disk\u00a0\/dev\/sdb:\u00a021.5\u00a0GB,\u00a021474836480\u00a0bytes<br \/>\n64\u00a0heads,\u00a032\u00a0sectors\/track,\u00a020480\u00a0cylinders<br \/>\nUnits\u00a0=\u00a0cylinders\u00a0of\u00a02048\u00a0*\u00a0512\u00a0=\u00a01048576\u00a0bytes<br \/>\nSector\u00a0size\u00a0(logical\/physical):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nI\/O\u00a0size\u00a0(minimum\/optimal):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nDisk\u00a0identifier:\u00a00x00000000<\/p>\n<p>Disk\u00a0\/dev\/sdb\u00a0doesn&#8217;t\u00a0contain\u00a0a\u00a0valid\u00a0partition\u00a0table<br \/>\nroot@server1:~#<\/p>\n<p>To use that device, we must format it:<\/p>\n<p>fdisk \/dev\/sdb<\/p>\n<p>server1:~#\u00a0fdisk\u00a0\/dev\/sdb<br \/>\nDevice\u00a0contains\u00a0neither\u00a0a\u00a0valid\u00a0DOS\u00a0partition\u00a0table,\u00a0nor\u00a0Sun,\u00a0SGI\u00a0or\u00a0OSF\u00a0disklabel<br \/>\nBuilding\u00a0a\u00a0new\u00a0DOS\u00a0disklabel\u00a0with\u00a0disk\u00a0identifier\u00a00x882944df.<br \/>\nChanges\u00a0will\u00a0remain\u00a0in\u00a0memory\u00a0only,\u00a0until\u00a0you\u00a0decide\u00a0to\u00a0write\u00a0them.<br \/>\nAfter\u00a0that,\u00a0of\u00a0course,\u00a0the\u00a0previous\u00a0content\u00a0won&#8217;t\u00a0be\u00a0recoverable.<\/p>\n<p>The\u00a0number\u00a0of\u00a0cylinders\u00a0for\u00a0this\u00a0disk\u00a0is\u00a0set\u00a0to\u00a020480.<br \/>\nThere\u00a0is\u00a0nothing\u00a0wrong\u00a0with\u00a0that,\u00a0but\u00a0this\u00a0is\u00a0larger\u00a0than\u00a01024,<br \/>\nand\u00a0could\u00a0in\u00a0certain\u00a0setups\u00a0cause\u00a0problems\u00a0with:<br \/>\n1)\u00a0software\u00a0that\u00a0runs\u00a0at\u00a0boot\u00a0time\u00a0(e.g.,\u00a0old\u00a0versions\u00a0of\u00a0LILO)<br \/>\n2)\u00a0booting\u00a0and\u00a0partitioning\u00a0software\u00a0from\u00a0other\u00a0OSs<br \/>\n(e.g.,\u00a0DOS\u00a0FDISK,\u00a0OS\/2\u00a0FDISK)<br \/>\nWarning:\u00a0invalid\u00a0flag\u00a00x0000\u00a0of\u00a0partition\u00a0table\u00a04\u00a0will\u00a0be\u00a0corrected\u00a0by\u00a0w(rite)<\/p>\n<p>Command\u00a0(m\u00a0for\u00a0help):\u00a0&lt;&#8211; m<br \/>\nCommand\u00a0action<br \/>\na\u00a0\u00a0\u00a0toggle\u00a0a\u00a0bootable\u00a0flag<br \/>\nb\u00a0\u00a0\u00a0edit\u00a0bsd\u00a0disklabel<br \/>\nc\u00a0\u00a0\u00a0toggle\u00a0the\u00a0dos\u00a0compatibility\u00a0flag<br \/>\nd\u00a0\u00a0\u00a0delete\u00a0a\u00a0partition<br \/>\nl\u00a0\u00a0\u00a0list\u00a0known\u00a0partition\u00a0types<br \/>\nm\u00a0\u00a0\u00a0print\u00a0this\u00a0menu<br \/>\nn\u00a0\u00a0\u00a0add\u00a0a\u00a0new\u00a0partition<br \/>\no\u00a0\u00a0\u00a0create\u00a0a\u00a0new\u00a0empty\u00a0DOS\u00a0partition\u00a0table<br \/>\np\u00a0\u00a0\u00a0print\u00a0the\u00a0partition\u00a0table<br \/>\nq\u00a0\u00a0\u00a0quit\u00a0without\u00a0saving\u00a0changes<br \/>\ns\u00a0\u00a0\u00a0create\u00a0a\u00a0new\u00a0empty\u00a0Sun\u00a0disklabel<br \/>\nt\u00a0\u00a0\u00a0change\u00a0a\u00a0partition&#8217;s\u00a0system\u00a0id<br \/>\nu\u00a0\u00a0\u00a0change\u00a0display\/entry\u00a0units<br \/>\nv\u00a0\u00a0\u00a0verify\u00a0the\u00a0partition\u00a0table<br \/>\nw\u00a0\u00a0\u00a0write\u00a0table\u00a0to\u00a0disk\u00a0and\u00a0exit<br \/>\nx\u00a0\u00a0\u00a0extra\u00a0functionality\u00a0(experts\u00a0only)<\/p>\n<p>Command\u00a0(m\u00a0for\u00a0help):\u00a0&lt;&#8211; n<br \/>\nCommand\u00a0action<br \/>\ne\u00a0\u00a0\u00a0extended<br \/>\np\u00a0\u00a0\u00a0primary\u00a0partition\u00a0(1-4)<br \/>\n&lt;&#8211; p<br \/>\nPartition\u00a0number\u00a0(1-4):\u00a0&lt;&#8211; 1<br \/>\nFirst\u00a0cylinder\u00a0(1-20480,\u00a0default\u00a01):\u00a0&lt;&#8211; ENTER<br \/>\nUsing\u00a0default\u00a0value\u00a01<br \/>\nLast\u00a0cylinder\u00a0or\u00a0+size\u00a0or\u00a0+sizeM\u00a0or\u00a0+sizeK\u00a0(1-20480,\u00a0default\u00a020480):\u00a0&lt;&#8211; ENTER<br \/>\nUsing\u00a0default\u00a0value\u00a020480<\/p>\n<p>Command\u00a0(m\u00a0for\u00a0help):\u00a0&lt;&#8211; t<br \/>\nSelected\u00a0partition\u00a01<br \/>\nHex\u00a0code\u00a0(type\u00a0L\u00a0to\u00a0list\u00a0codes):\u00a0&lt;&#8211; L<\/p>\n<p>0\u00a0\u00a0Empty\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01e\u00a0\u00a0Hidden\u00a0W95\u00a0FAT1\u00a080\u00a0\u00a0Old\u00a0Minix\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0be\u00a0\u00a0Solaris\u00a0boot<br \/>\n1\u00a0\u00a0FAT12\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a024\u00a0\u00a0NEC\u00a0DOS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a081\u00a0\u00a0Minix\u00a0\/\u00a0old\u00a0Lin\u00a0bf\u00a0\u00a0Solaris<br \/>\n2\u00a0\u00a0XENIX\u00a0root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a039\u00a0\u00a0Plan\u00a09\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a082\u00a0\u00a0Linux\u00a0swap\u00a0\/\u00a0So\u00a0c1\u00a0\u00a0DRDOS\/sec\u00a0(FAT-<br \/>\n3\u00a0\u00a0XENIX\u00a0usr\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03c\u00a0\u00a0PartitionMagic\u00a0\u00a083\u00a0\u00a0Linux\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0c4\u00a0\u00a0DRDOS\/sec\u00a0(FAT-<br \/>\n4\u00a0\u00a0FAT16\u00a0&lt;32M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a040\u00a0\u00a0Venix\u00a080286\u00a0\u00a0\u00a0\u00a0\u00a084\u00a0\u00a0OS\/2\u00a0hidden\u00a0C:\u00a0\u00a0c6\u00a0\u00a0DRDOS\/sec\u00a0(FAT-<br \/>\n5\u00a0\u00a0Extended\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a041\u00a0\u00a0PPC\u00a0PReP\u00a0Boot\u00a0\u00a0\u00a085\u00a0\u00a0Linux\u00a0extended\u00a0\u00a0c7\u00a0\u00a0Syrinx<br \/>\n6\u00a0\u00a0FAT16\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a042\u00a0\u00a0SFS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a086\u00a0\u00a0NTFS\u00a0volume\u00a0set\u00a0da\u00a0\u00a0Non-FS\u00a0data<br \/>\n7\u00a0\u00a0HPFS\/NTFS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04d\u00a0\u00a0QNX4.x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a087\u00a0\u00a0NTFS\u00a0volume\u00a0set\u00a0db\u00a0\u00a0CP\/M\u00a0\/\u00a0CTOS\u00a0\/\u00a0.<br \/>\n8\u00a0\u00a0AIX\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04e\u00a0\u00a0QNX4.x\u00a02nd\u00a0part\u00a088\u00a0\u00a0Linux\u00a0plaintext\u00a0de\u00a0\u00a0Dell\u00a0Utility<br \/>\n9\u00a0\u00a0AIX\u00a0bootable\u00a0\u00a0\u00a0\u00a04f\u00a0\u00a0QNX4.x\u00a03rd\u00a0part\u00a08e\u00a0\u00a0Linux\u00a0LVM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0df\u00a0\u00a0BootIt<br \/>\na\u00a0\u00a0OS\/2\u00a0Boot\u00a0Manag\u00a050\u00a0\u00a0OnTrack\u00a0DM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a093\u00a0\u00a0Amoeba\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e1\u00a0\u00a0DOS\u00a0access<br \/>\nb\u00a0\u00a0W95\u00a0FAT32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a051\u00a0\u00a0OnTrack\u00a0DM6\u00a0Aux\u00a094\u00a0\u00a0Amoeba\u00a0BBT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e3\u00a0\u00a0DOS\u00a0R\/O<br \/>\nc\u00a0\u00a0W95\u00a0FAT32\u00a0(LBA)\u00a052\u00a0\u00a0CP\/M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a09f\u00a0\u00a0BSD\/OS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e4\u00a0\u00a0SpeedStor<br \/>\ne\u00a0\u00a0W95\u00a0FAT16\u00a0(LBA)\u00a053\u00a0\u00a0OnTrack\u00a0DM6\u00a0Aux\u00a0a0\u00a0\u00a0IBM\u00a0Thinkpad\u00a0hi\u00a0eb\u00a0\u00a0BeOS\u00a0fs<br \/>\nf\u00a0\u00a0W95\u00a0Ext&#8217;d\u00a0(LBA)\u00a054\u00a0\u00a0OnTrackDM6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0a5\u00a0\u00a0FreeBSD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ee\u00a0\u00a0EFI\u00a0GPT<br \/>\n10\u00a0\u00a0OPUS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a055\u00a0\u00a0EZ-Drive\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0a6\u00a0\u00a0OpenBSD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ef\u00a0\u00a0EFI\u00a0(FAT-12\/16\/<br \/>\n11\u00a0\u00a0Hidden\u00a0FAT12\u00a0\u00a0\u00a0\u00a056\u00a0\u00a0Golden\u00a0Bow\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0a7\u00a0\u00a0NeXTSTEP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0f0\u00a0\u00a0Linux\/PA-RISC\u00a0b<br \/>\n12\u00a0\u00a0Compaq\u00a0diagnost\u00a05c\u00a0\u00a0Priam\u00a0Edisk\u00a0\u00a0\u00a0\u00a0\u00a0a8\u00a0\u00a0Darwin\u00a0UFS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0f1\u00a0\u00a0SpeedStor<br \/>\n14\u00a0\u00a0Hidden\u00a0FAT16\u00a0&lt;3\u00a061\u00a0\u00a0SpeedStor\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0a9\u00a0\u00a0NetBSD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0f4\u00a0\u00a0SpeedStor<br \/>\n16\u00a0\u00a0Hidden\u00a0FAT16\u00a0\u00a0\u00a0\u00a063\u00a0\u00a0GNU\u00a0HURD\u00a0or\u00a0Sys\u00a0ab\u00a0\u00a0Darwin\u00a0boot\u00a0\u00a0\u00a0\u00a0\u00a0f2\u00a0\u00a0DOS\u00a0secondary<br \/>\n17\u00a0\u00a0Hidden\u00a0HPFS\/NTF\u00a064\u00a0\u00a0Novell\u00a0Netware\u00a0\u00a0b7\u00a0\u00a0BSDI\u00a0fs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0fd\u00a0\u00a0Linux\u00a0raid\u00a0auto<br \/>\n18\u00a0\u00a0AST\u00a0SmartSleep\u00a0\u00a065\u00a0\u00a0Novell\u00a0Netware\u00a0\u00a0b8\u00a0\u00a0BSDI\u00a0swap\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0fe\u00a0\u00a0LANstep<br \/>\n1b\u00a0\u00a0Hidden\u00a0W95\u00a0FAT3\u00a070\u00a0\u00a0DiskSecure\u00a0Mult\u00a0bb\u00a0\u00a0Boot\u00a0Wizard\u00a0hid\u00a0ff\u00a0\u00a0BBT<br \/>\n1c\u00a0\u00a0Hidden\u00a0W95\u00a0FAT3\u00a075\u00a0\u00a0PC\/IX<br \/>\nHex\u00a0code\u00a0(type\u00a0L\u00a0to\u00a0list\u00a0codes):\u00a0&lt;&#8211; 83<\/p>\n<p>Command\u00a0(m\u00a0for\u00a0help):\u00a0&lt;&#8211; w<br \/>\nThe\u00a0partition\u00a0table\u00a0has\u00a0been\u00a0altered!<\/p>\n<p>Calling\u00a0ioctl()\u00a0to\u00a0re-read\u00a0partition\u00a0table.<br \/>\nSyncing\u00a0disks.<br \/>\nserver1:~#<\/p>\n<p>Afterwards, the output of<\/p>\n<p>fdisk -l<\/p>\n<p>should look as follows:<\/p>\n<p>root@server1:~#\u00a0fdisk\u00a0-l<\/p>\n<p>Disk\u00a0\/dev\/sda:\u00a032.2\u00a0GB,\u00a032212254720\u00a0bytes<br \/>\n255\u00a0heads,\u00a063\u00a0sectors\/track,\u00a03916\u00a0cylinders<br \/>\nUnits\u00a0=\u00a0cylinders\u00a0of\u00a016065\u00a0*\u00a0512\u00a0=\u00a08225280\u00a0bytes<br \/>\nSector\u00a0size\u00a0(logical\/physical):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nI\/O\u00a0size\u00a0(minimum\/optimal):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nDisk\u00a0identifier:\u00a00x00016be9<\/p>\n<p>Device\u00a0Boot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0End\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Blocks\u00a0\u00a0\u00a0Id\u00a0\u00a0System<br \/>\n\/dev\/sda1\u00a0\u00a0\u00a0*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0248832\u00a0\u00a0\u00a083\u00a0\u00a0Linux<br \/>\nPartition\u00a01\u00a0does\u00a0not\u00a0end\u00a0on\u00a0cylinder\u00a0boundary.<br \/>\n\/dev\/sda2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03917\u00a0\u00a0\u00a0\u00a031205377\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0Extended<br \/>\n\/dev\/sda5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a032\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03917\u00a0\u00a0\u00a0\u00a031205376\u00a0\u00a0\u00a08e\u00a0\u00a0Linux\u00a0LVM<\/p>\n<p>Disk\u00a0\/dev\/sdb:\u00a021.5\u00a0GB,\u00a021474836480\u00a0bytes<br \/>\n64\u00a0heads,\u00a032\u00a0sectors\/track,\u00a020480\u00a0cylinders<br \/>\nUnits\u00a0=\u00a0cylinders\u00a0of\u00a02048\u00a0*\u00a0512\u00a0=\u00a01048576\u00a0bytes<br \/>\nSector\u00a0size\u00a0(logical\/physical):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nI\/O\u00a0size\u00a0(minimum\/optimal):\u00a0512\u00a0bytes\u00a0\/\u00a0512\u00a0bytes<br \/>\nDisk\u00a0identifier:\u00a00x725b9dff<\/p>\n<p>Device\u00a0Boot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0End\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Blocks\u00a0\u00a0\u00a0Id\u00a0\u00a0System<br \/>\n\/dev\/sdb1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a020480\u00a0\u00a0\u00a0\u00a020971504\u00a0\u00a0\u00a083\u00a0\u00a0Linux<br \/>\nroot@server1:~#<\/p>\n<p>Now we create a filesystem on\u00a0\/dev\/sdb1&#8230;<\/p>\n<p>mkfs.ext4 \/dev\/sdb1<\/p>\n<p>&#8230; and mount it for test purposes:<\/p>\n<p>mount \/dev\/sdb1 \/mnt<\/p>\n<p>You should now see the new device in the outputs of&#8230;<\/p>\n<p>mount<\/p>\n<p>root@server1:~# mount<br \/>\n\/dev\/mapper\/server1-root on \/ type ext4 (rw,errors=remount-ro)<br \/>\nproc on \/proc type proc (rw,noexec,nosuid,nodev)<br \/>\nnone on \/sys type sysfs (rw,noexec,nosuid,nodev)<br \/>\nnone on \/sys\/fs\/fuse\/connections type fusectl (rw)<br \/>\nnone on \/sys\/kernel\/debug type debugfs (rw)<br \/>\nnone on \/sys\/kernel\/security type securityfs (rw)<br \/>\nnone on \/dev type devtmpfs (rw,mode=0755)<br \/>\nnone on \/dev\/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)<br \/>\nnone on \/dev\/shm type tmpfs (rw,nosuid,nodev)<br \/>\nnone on \/var\/run type tmpfs (rw,nosuid,mode=0755)<br \/>\nnone on \/var\/lock type tmpfs (rw,noexec,nosuid,nodev)<br \/>\nnone on \/lib\/init\/rw type tmpfs (rw,nosuid,mode=0755)<br \/>\nnone on \/var\/lib\/ureadahead\/debugfs type debugfs (rw,relatime)<br \/>\n\/dev\/sda1 on \/boot type ext2 (rw)<br \/>\n\/dev\/sdb1 on \/mnt type ext4 (rw)<br \/>\nroot@server1:~#<\/p>\n<p>&#8230; and<\/p>\n<p>df -h<\/p>\n<p>root@server1:~#\u00a0df\u00a0-h<br \/>\nFilesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Size\u00a0\u00a0Used\u00a0Avail\u00a0Use%\u00a0Mounted\u00a0on<br \/>\n\/dev\/mapper\/server1-root<br \/>\n18G\u00a0\u00a0838M\u00a0\u00a0\u00a016G\u00a0\u00a0\u00a05%\u00a0\/<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0243M\u00a0\u00a0180K\u00a0\u00a0242M\u00a0\u00a0\u00a01%\u00a0\/dev<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/dev\/shm<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a036K\u00a0\u00a0247M\u00a0\u00a0\u00a01%\u00a0\/var\/run<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/var\/lock<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/lib\/init\/rw<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a018G\u00a0\u00a0838M\u00a0\u00a0\u00a016G\u00a0\u00a0\u00a05%\u00a0\/var\/lib\/ureadahead\/debugfs<br \/>\n\/dev\/sda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0228M\u00a0\u00a0\u00a017M\u00a0\u00a0199M\u00a0\u00a0\u00a08%\u00a0\/boot<br \/>\n\/dev\/sdb1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a020G\u00a0\u00a0172M\u00a0\u00a0\u00a019G\u00a0\u00a0\u00a01%\u00a0\/mnt<br \/>\nroot@server1:~#<\/p>\n<p>You can unmount it like this:<\/p>\n<p>umount \/mnt<\/p>\n<p>To have the device mounted automatically at boot time, e.g. in the directory\u00a0\/storage, we create that directory&#8230;<\/p>\n<p>mkdir \/storage<\/p>\n<p>&#8230; and add the following line to\u00a0\/etc\/fstab:<\/p>\n<p>vi \/etc\/fstab<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#cccccc\">\n<tbody>\n<tr>\n<td>\n<pre>[...]\r\n\/dev\/sdb1       \/storage        ext4    defaults,auto,_netdev 0 0<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>For test purposes, you can now reboot the system:<\/p>\n<p>reboot<\/p>\n<p>After the reboot, the device should be mounted:<\/p>\n<p>mount<\/p>\n<p>root@server1:~# mount<br \/>\n\/dev\/mapper\/server1-root on \/ type ext4 (rw,errors=remount-ro)<br \/>\nproc on \/proc type proc (rw,noexec,nosuid,nodev)<br \/>\nnone on \/sys type sysfs (rw,noexec,nosuid,nodev)<br \/>\nnone on \/sys\/fs\/fuse\/connections type fusectl (rw)<br \/>\nnone on \/sys\/kernel\/debug type debugfs (rw)<br \/>\nnone on \/sys\/kernel\/security type securityfs (rw)<br \/>\nnone on \/dev type devtmpfs (rw,mode=0755)<br \/>\nnone on \/dev\/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)<br \/>\nnone on \/dev\/shm type tmpfs (rw,nosuid,nodev)<br \/>\nnone on \/var\/run type tmpfs (rw,nosuid,mode=0755)<br \/>\nnone on \/var\/lock type tmpfs (rw,noexec,nosuid,nodev)<br \/>\nnone on \/lib\/init\/rw type tmpfs (rw,nosuid,mode=0755)<br \/>\nnone on \/var\/lib\/ureadahead\/debugfs type debugfs (rw,relatime)<br \/>\n\/dev\/sda1 on \/boot type ext2 (rw)<br \/>\n\/dev\/sdb1 on \/storage type ext4 (rw,_netdev)<br \/>\nroot@server1:~#<\/p>\n<p>df -h<\/p>\n<p>root@server1:~#\u00a0df\u00a0-h<br \/>\nFilesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Size\u00a0\u00a0Used\u00a0Avail\u00a0Use%\u00a0Mounted\u00a0on<br \/>\n\/dev\/mapper\/server1-root<br \/>\n18G\u00a0\u00a0839M\u00a0\u00a0\u00a016G\u00a0\u00a0\u00a05%\u00a0\/<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0243M\u00a0\u00a0180K\u00a0\u00a0242M\u00a0\u00a0\u00a01%\u00a0\/dev<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/dev\/shm<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a036K\u00a0\u00a0247M\u00a0\u00a0\u00a01%\u00a0\/var\/run<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/var\/lock<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0247M\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0247M\u00a0\u00a0\u00a00%\u00a0\/lib\/init\/rw<br \/>\nnone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a018G\u00a0\u00a0839M\u00a0\u00a0\u00a016G\u00a0\u00a0\u00a05%\u00a0\/var\/lib\/ureadahead\/debugfs<br \/>\n\/dev\/sda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0228M\u00a0\u00a0\u00a017M\u00a0\u00a0199M\u00a0\u00a0\u00a08%\u00a0\/boot<br \/>\n\/dev\/sdb1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a020G\u00a0\u00a0172M\u00a0\u00a0\u00a019G\u00a0\u00a0\u00a01%\u00a0\/storage<br \/>\nroot@server1:~#<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>This guide explains how you can set up an iSCSI target and an iSCSI initiator (client), both running Ubuntu 10.04. The iSCSI [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10,20],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-info-on-tech","tag-server","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=715"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/715\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}