<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>For the good of all of us - Linux</title>
    <link>http://www.skytale.net/blog/</link>
    <description></description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.3 - http://www.s9y.org/</generator>
    <pubDate>Sun, 21 Mar 2010 17:32:26 GMT</pubDate>

    <image>
        <url>http://www.skytale.net/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: For the good of all of us - Linux - </title>
        <link>http://www.skytale.net/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Building a multi OS USB boot stick, Part 1 (Windows)</title>
    <link>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
            <category>Windows</category>
    
    <comments>http://www.skytale.net/blog/archives/33-Building-a-multi-OS-USB-boot-stick,-Part-1-Windows.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=33</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=33</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Among the things I carry around is always a collection of &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks, for various purposes. One of those is usually dedicated to a Linux rescue system, in order to get somehow broken systems back on their feet.&lt;/p&gt;

	&lt;p&gt;While it is possible these days to access non Linux systems from a booted Linux system any repair work beyond simple text file editing and file copying usually requires OS specific tools to get the job done. Thus it would be nice not only to have a Linux rescue system at hand, but a Windows one as well. And Solaris, while we&amp;#8217;re at it. And possibly some more.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; sticks are cheap, at least in this part of the world. 10EUR will get you 4GB off the shelf in almost any electronics store, a little more money will get you 8GB ordered online. So space is not really an issue.&lt;/p&gt;

	&lt;p&gt;Actually installing an operating system in a way that allows it to boot off a removable media requires some specific preparations and tools in each case. This means that a running instance of that specific OS is needed to prepare the installation. This means that to get Windows to boot of an &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick a running Windows installation is needed. The same goes for Solaris and Linux.&lt;/p&gt;

	&lt;h3&gt;Preparations&lt;/h3&gt;

	&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick used for this exercise is a 4G Sandisk. This procedure will &lt;strong&gt;delete all data&lt;/strong&gt; currently on the stick, so either make sure there is nothing of any interest on it, or just get a new one.&lt;/p&gt;

	&lt;p&gt;The initial plan is to have Windows, Linux and Solaris boot off the stick. Each OS will get it&amp;#8217;s own partition, to keep possible clashes between the files of each system to a minimum (and because Solaris wants and &lt;span class=&quot;caps&quot;&gt;UFS&lt;/span&gt; partition, but more on that later).&lt;/p&gt;

	&lt;h3&gt;Installing Windows on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt;&lt;/h3&gt;

	&lt;p&gt;The standard Windows installer does not allow for installation on &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; devices. The standard tool for those tasks is &lt;a href=&quot;http://www.nu2.nu/pebuilder/&quot;&gt;BartPE&lt;/a&gt;, a free tool to create so-called Preinstalled Environments. Those are actually a Microsoft supported way to preinstall an operating system on a PC, which is used by system builders to deliver machines with the OS already installed but not registered. The Microsoft tools to create these environments are not easily available, though, and this is where BartPE came in a few years ago. It&amp;#8217;s original purpose was to create Live CDs of Windows, but booting from &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; was added (experimentally) later.&lt;/p&gt;

	&lt;p&gt;While BartPE is a very valuable tool there is an even better one for this special purpose: &lt;a href=&quot;http://www.ubcd4win.com/&quot;&gt;The Ultimate Boot CD for Windows&lt;/a&gt;, which is basically a BartPE with a lot of useful tools already tacked to the side, and a completely reworked &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installer.&lt;/p&gt;

	&lt;p&gt;To use &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; the following is needed:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; installer, which weighs in at 255MB and is available from the projects site&lt;/li&gt;
		&lt;li&gt;A Windows XP install CD (32 bit)&lt;/li&gt;
		&lt;li&gt;Service Pack 3 for XP, if the Windows CD does not already include it&lt;/li&gt;
		&lt;li&gt;A license for the Windows version (this is more a legal than a technical problem, but the Windows install on the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick needs a separate license to be legal)&lt;/li&gt;
		&lt;li&gt;Drivers&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The last point is especially interesting. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; will take all drivers whichare contained in the Windows XP install CD, which, as everyone knows who tried to install XP on a reasonably recent machine, is not exactly much. While the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; installed will boot (hopefully), access to hard disk drives on the machine or access to network interfaces may be severely limited due to missing drivers.&lt;/p&gt;

	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; already comes with a largeish selection of updated drivers for mass storage, &lt;span class=&quot;caps&quot;&gt;LAN&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt;, so simply building an image with the default settings has a good chance of working on a large number of modern machines (although the &lt;span class=&quot;caps&quot;&gt;WLAN&lt;/span&gt; drivers are disabled by default).&lt;/p&gt;

	&lt;h4&gt;Install procedure&lt;/h4&gt;

	&lt;ul&gt;
		&lt;li&gt;Make a copy of the Windows XP CD (that is, just copy all the files on it into a folder on the hard disk drive)&lt;/li&gt;
		&lt;li&gt;If the CD did not already contain a Windows copy patched to SP3 download the SP3 install package from Microsoft, and &lt;a href=&quot;http://www.howtohaven.com/system/slipstream-xp-service-pack-3.shtml&quot;&gt;slipstream the Service Pack into the copied files&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Install &lt;span class=&quot;caps&quot;&gt;UBDC&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Start &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; and enter the path to the copied Windows CD in the first field&lt;/li&gt;
		&lt;li&gt;Set Media Output to None&lt;/li&gt;
		&lt;li&gt;Click &amp;#8220;Build&amp;#8221;&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 509px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:31 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;509&quot; height=&quot;421&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd1.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;The &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;This will start a build process with the default settings, which are reasonable for a first build. &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; is very customizable, most of the options are available by clicking the &amp;#8220;Plugins&amp;#8221; button on the main screen. Describing the various things that can be done here is beyond this text, but the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; home page has details on this.&lt;/p&gt;

	&lt;p&gt;After the build has finished plug in the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick and start &lt;code&gt;ubusb.exe&lt;/code&gt; from the &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; install folder. To make things easier make sure no other &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; mass storage devices are connected. Set the options to match those in the screenshot below. Specifically:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Make sure the right &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; device is selected&lt;/li&gt;
		&lt;li&gt;Set the partition size to 2048MB (or 2GB)&lt;/li&gt;
		&lt;li&gt;Set the file system to FAT32-&lt;span class=&quot;caps&quot;&gt;LBA&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Set the Boot Loader to grub4dos&lt;/li&gt;
		&lt;li&gt;Select the right BartPE folder (although it should pick up the correct one automatically)&lt;/li&gt;
		&lt;li&gt;Don&amp;#8217;t create a CD image&lt;/li&gt;
	&lt;/ul&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 583px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:32 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;583&quot; height=&quot;554&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd2.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;UBUSB&lt;/span&gt; main screen&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;Clicking &amp;#8220;Go&amp;#8221; will start the process of repartitioning, formattingand copying of data to the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick. This may take a while.&lt;/p&gt;

	&lt;p&gt;After the process has finished (hopefully successful) the resulting &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick can immediately be tested, because &lt;span class=&quot;caps&quot;&gt;UBCD&lt;/span&gt; comes with a copy of &lt;a href=&quot;http://www.qemu.org&quot;&gt;qemu&lt;/a&gt;, which can emulate a PC. Just click the &amp;#8220;Test USB&amp;#8221; button, and a virtual PC will try to boot off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick just created.&lt;/p&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 740px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:33 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;740&quot; height=&quot;438&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd3.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;&lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; boot menu&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;serendipity_imageComment_center&quot; style=&quot;width: 821px&quot;&gt;&lt;div class=&quot;serendipity_imageComment_img&quot;&gt;&lt;!-- s9ymdb:34 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;821&quot; height=&quot;638&quot;  src=&quot;http://www.skytale.net/blog/uploads/ubcd4.png&quot;  alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;serendipity_imageComment_txt&quot;&gt;Windows booted off the &lt;span class=&quot;caps&quot;&gt;USB&lt;/span&gt; stick in qemu&lt;/div&gt;&lt;/div&gt;

	&lt;p&gt;One down, two to go.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Mar 2010 18:23:49 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/33-guid.html</guid>
    
</item>
<item>
    <title>Resetting SATA devices under Linux</title>
    <link>http://www.skytale.net/blog/archives/24-Resetting-SATA-devices-under-Linux.html</link>
            <category>Computer</category>
            <category>Hardware</category>
            <category>Linux</category>
    
    <comments>http://www.skytale.net/blog/archives/24-Resetting-SATA-devices-under-Linux.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=24</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Note: this was tested only on &lt;span class=&quot;caps&quot;&gt;SATA&lt;/span&gt; attached optical drives, not on hard disks. Removing a hard disk with mounted partitions on it (directly or indirectly) is probably not a very smart idea.&lt;/p&gt;

	&lt;p&gt;A device name of &lt;code&gt;/dev/sr0&lt;/code&gt; is assumed.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Find out which controller the device is attached to (we&amp;#8217;ll need this later):&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# readlink /sys/block/sr0
../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
&lt;/pre&gt;

	&lt;p&gt;The interesting part if the answer is &lt;code&gt;host1&lt;/code&gt;, which identifies the controller.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Disconnect the device&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# echo 1 &amp;#62; /sys/block/sr0/device/delete
&lt;/pre&gt;

	&lt;p&gt;This will remove the device from the bus (logically). Look in &lt;code&gt;dmesg&lt;/code&gt; for confirmation.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Rescan the controller&lt;/li&gt;
	&lt;/ul&gt;

&lt;pre&gt;
# echo &amp;#34;- - -&amp;#34; &amp;#62; /sys/class/scsi_host/host1/scan
&lt;/pre&gt;

	&lt;p&gt;&lt;code&gt;host1&lt;/code&gt; is the identifier from step one. Again, &lt;code&gt;dmesg&lt;/code&gt; should show the device being rediscovered.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 18 Nov 2009 13:36:49 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/24-guid.html</guid>
    
</item>
<item>
    <title>iSCSI: Opensolaris target, Fedora initiator, with CHAP</title>
    <link>http://www.skytale.net/blog/archives/18-iSCSI-Opensolaris-target,-Fedora-initiator,-with-CHAP.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/18-iSCSI-Opensolaris-target,-Fedora-initiator,-with-CHAP.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=18</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=18</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;For some reason or another finding instructions on how to actually configure iSCSI for a rather simple and common use case (one target on Solaris, one initiator on Fedora, &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; authentication) seems to be pretty hard.&lt;/p&gt;

	&lt;p&gt;Either my google-fu is seriously broken today, or everyone except for me considers this to be so easy and obvious that it does not warrant documentation. Which, having done this for the last three hours, I seriously doubt. The Solaris side is actually documented quite well (I primarily used &lt;a href=&quot;http://blogs.everycity.co.uk/alasdair/2008/11/solaris-as-an-iscsi-server-with-zfs/&quot;&gt; this blog entry by alasdair&lt;/a&gt;), the Linux side is lacking. It does not help matters that both sides use identically named tools that work in completely different ways.&lt;/p&gt;

	&lt;p&gt;So, the deal is as follows:&lt;/p&gt;

	&lt;p&gt;One OpenSolaris system, acting as iSCSI target (that is the system presenting the storage space).&lt;/p&gt;

	&lt;p&gt;One Fedora Linux system, acting as iSCSI initiator (that is the system that wants to use the storage space)&lt;/p&gt;

	&lt;p&gt;Create 100GB storage space on the target and let the initiator connect to this storage space and create a filesystem on in. The connection has to be authenticated one way (the initiator presents credentials to the target).&lt;/p&gt;

	&lt;h3&gt;The Solaris side&lt;/h3&gt;

	&lt;p&gt;The system is running Nevada, the configuration here was done with build snv_110.&lt;/p&gt;

	&lt;p&gt;First, the iSCSI target software needs to be installed and enabled:&lt;/p&gt;

&lt;pre&gt;
# gkp.pl -d /mnt/Solaris_11/Product SUNWiscsitgtu
# svcadm enable iscsitgt:default
#
&lt;/pre&gt;

	&lt;p&gt;The backing store for the iSCSI volumes shall be provided by ZFS:&lt;/p&gt;

&lt;pre&gt;
# zfs create -o canmount=off tank/iscsi
# zfs create -V 100G -o shareiscsi=on tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
    iSCSI Name: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
    Alias: tank/iscsi/vol001
[...]
#
&lt;/pre&gt;

	&lt;p&gt;The &lt;code&gt;iSCSI Name&lt;/code&gt; will be different for each created volume. Per default this target will be available via all interfaces and IPs of the machine. Since this is not what I want in this special case the target is bound to a fixed IP by a construct called a Target Port Group Tag. The &lt;span class=&quot;caps&quot;&gt;TPGT&lt;/span&gt; used here has the number 1.&lt;/p&gt;

&lt;pre&gt;
# iscsitadm create tpgt 1
# iscsitadm modify tpgt -i 212.51.12.90 1
# iscsitadm list tpgt -v 1
TPGT: 1
    IP Address: 212.51.12.90
# iscsitadm modify target -p 1 tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
[...]
    TPGT list:
            TPGT: 1
[...]
#
&lt;/pre&gt;

	&lt;p&gt;In order to secure access to this volume some more the initiator is required to authenticate itself using &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; before access is granted. To do this three pieces of information are needed:&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;The iqn (basically a unique name) of the initiator&lt;/li&gt;
		&lt;li&gt;A username&lt;/li&gt;
		&lt;li&gt;A password&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;The initiator used here has an iqn of &lt;code&gt;iqn.2005-03.com.max:01.cb5c4c&lt;/code&gt; (see below for the source of this information). The username is &lt;code&gt;lain&lt;/code&gt; and the password is &lt;code&gt;iscsipassword&lt;/code&gt; for the purpose of this demonstration. The password has to be between 12 and 16 charcters in length and should definitely be something stronger for production purposes.&lt;/p&gt;

&lt;pre&gt;
# iscsitadm create initiator -n iqn.2005-03.com.max:01.cb5c4c lain
# iscsitadm modify initiator --chap-name lain lain
# iscsitadm modify initiator --chap-secret lain
[...]
# iscsitadm list initiator -v
Initiator: lain
    iSCSI Name: iqn.2005-03.com.max:01.cb5c4c
    CHAP Name: lain
    CHAP Secret: Set
# iscsitadm modify target --acl lain tank/iscsi/vol001
# iscsitadm list target -v
Target: tank/iscsi/vol001
[...]
    ACL list:
            Initiator: lain
[...]
#
&lt;/pre&gt;

	&lt;p&gt;This concludes the Solaris side of things.&lt;/p&gt;

	&lt;h3&gt;The Fedora side&lt;/h3&gt;

	&lt;p&gt;The system is running Fedora Rawhide, close to the Fedora 11 Beta release at the time of this writing.&lt;/p&gt;

	&lt;p&gt;On the Linux side iSCSI is handled by the open-iscsi toolchain, packaged as &lt;code&gt;iscsi-initiator-utils&lt;/code&gt; in Fedora. To install it:&lt;/p&gt;

&lt;pre&gt;
# yum install iscsi-initiator-utils
[...]
#
&lt;/pre&gt;

	&lt;p&gt;Since the system in question is a notebook, and the iSCSI target may not be available at all times, the iSCSI service must be instructed not to connect to configured devices automatically:&lt;/p&gt;

&lt;pre&gt;
# perl -pi -e &amp;#39;s/node.startup.*/node.startup = manual/&amp;#39; /etc/iscsi/iscsid.conf
#
&lt;/pre&gt;

	&lt;p&gt;The initiator name mentioned in the Solaris section above can be configured freely on the system. A random value is created during package installation and saved in &lt;code&gt;/etc/iscsi/initiatorname.iscsi&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2005-03.com.max:01.cb5c4c
#
&lt;/pre&gt;

	&lt;p&gt;Be sure the name configured there matches the name defined in the initiator on the Solaris side. Even though a username/password pair was defined on the target credentials are not needed for target discovery (the process by which an initiator asks a target which iSCSI volumes are available):&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m discovery -t st -p 212.51.12.90
212.51.12.90:3260,1 iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
# iscsiadm -m node
212.51.12.90:3260,1 iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
#
&lt;/pre&gt;

	&lt;p&gt;The discovery process has found a single volume exported by the target and added it to the local node list. The iqn matches the value shown above in the Solaris section. Now the &lt;span class=&quot;caps&quot;&gt;CHAP&lt;/span&gt; credentials have to be added to the node so the initiator can actually connect to the volume:&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.authmethod&amp;#39; -v &amp;#39;CHAP&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.username&amp;#39; -v &amp;#39;lain&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; \
--name &amp;#39;node.session.auth.password&amp;#39; -v &amp;#39;iscsipassword&amp;#39;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39;
node.name = iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8
node.tpgt = 1
node.startup = manual
[...]
node.session.auth.authmethod = CHAP
node.session.auth.username = lain
node.session.auth.password = ********
[...]
#
&lt;/pre&gt;

	&lt;p&gt;Now the volume can finally be accessed:&lt;/p&gt;

&lt;pre&gt;
# iscsiadm -m node --target &amp;#39;iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8&amp;#39; --login
Logging in to [iface: default, target: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8,
portal: 212.51.12.90,3260]
Login to [iface: default, target: iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8,
portal: 212.51.12.90,3260]: successful
#
&lt;/pre&gt;

	&lt;p&gt;After some seconds a device node for this volume should appear in &lt;code&gt;/dev/disk/by-path&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
# ls /dev/disk/by-path/
ip-212.51.12.90:3260-iscsi-iqn.1986-03.com.sun:02:218c35e0-0881-cb4f-d6bd-80e08bdc98d8-lun-0
[...]
#
&lt;/pre&gt;

	&lt;p&gt;The disk is ready to be used.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 24 Mar 2009 01:16:10 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/18-guid.html</guid>
    
</item>
<item>
    <title>Building an OpenSolaris storage - Software, Part 6</title>
    <link>http://www.skytale.net/blog/archives/14-Building-an-OpenSolaris-storage-Software,-Part-6.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>Software</category>
            <category>Solaris</category>
    
    <comments>http://www.skytale.net/blog/archives/14-Building-an-OpenSolaris-storage-Software,-Part-6.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=14</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=14</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;Since I tend to forget these things, here&amp;#8217;s a short list showing various package management tasks.&lt;/p&gt;

	&lt;table&gt;
		&lt;tr&gt;
			&lt;th&gt;Task &lt;/th&gt;
			&lt;th&gt;&lt;span class=&quot;caps&quot;&gt;RPM&lt;/span&gt; &lt;/th&gt;
			&lt;th&gt;pkg (Solaris) &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; List all installed packages &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -qa&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkginfo&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Show all files belonging to an installed package &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -ql [package]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkgchk -l [package] | grep Pathname&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Find package owning a file &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;rpm -qf [filename]&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; &lt;code&gt;pkgchk -l -p [filename]&lt;/code&gt; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt; 
    </content:encoded>

    <pubDate>Wed, 11 Mar 2009 20:50:18 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/14-guid.html</guid>
    
</item>
<item>
    <title>Reading OSX install media under Linux</title>
    <link>http://www.skytale.net/blog/archives/3-Reading-OSX-install-media-under-Linux.html</link>
            <category>Computer</category>
            <category>Linux</category>
            <category>OSX</category>
            <category>Software</category>
    
    <comments>http://www.skytale.net/blog/archives/3-Reading-OSX-install-media-under-Linux.html#comments</comments>
    <wfw:comment>http://www.skytale.net/blog/wfwcomment.php?cid=3</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.skytale.net/blog/rss.php?version=2.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    

    <author>nospam@example.com (Ralf Ertzinger)</author>
    <content:encoded>
    	&lt;p&gt;If you ever tried to take a look around an &lt;span class=&quot;caps&quot;&gt;OSX&lt;/span&gt; install &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; unter Linux you may have been surprised by&lt;br /&gt;
the marvelous compression algorithms that Apple uses, because there seems to be preciously little data on those disks:&lt;/p&gt;

&lt;pre&gt;
$ du -sh /media/OSX86DVD/
132K    /media/OSX86DVD/
&lt;/pre&gt;

	&lt;p&gt;There is no magic here, as seen by the fact that the same disk inserted into a running &lt;span class=&quot;caps&quot;&gt;OSX&lt;/span&gt; system shows a completely different file structure with more than 4GB of data.&lt;/p&gt;

	&lt;p&gt;The explanation for this is that there are two filesystems on the DVD:&lt;/p&gt;

	&lt;p&gt;First, a normal ISO9660 CD file system, which contains some bootloader files, and not much else. This filesystem is the one that Linux (and Windows) see by default.&lt;/p&gt;

	&lt;p&gt;Behind the ISO9660 filesystem there is another one, which spans the rest of the disk. This is a complete hard disk image with it&amp;#8217;s own partition table, and which contains the real installer data. As Linux does not expect this it does not try to access this filesystem, and the files remain invisible.&lt;/p&gt;

	&lt;p&gt;In order to get at the files in the second part of the disk some command line magic is necessary. You will need root privileges for the following operations. I assume that the &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; device is &lt;code&gt;/dev/sr0&lt;/code&gt;, adjust as neccesary.&lt;/p&gt;

	&lt;p&gt;The Linux kernel has a nice block device mapping layer which allows us to take a slice out of an existing block device and present this slice as a new device. Even more, there is a helper tool that inspects a block device, looks for partitions and automatically creates such a mapping for each partition. This tool is called &lt;code&gt;kpartx&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;So we use &lt;code&gt;kpartx&lt;/code&gt; to inspect the &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; device. The command for this is as follows:&lt;/p&gt;

&lt;pre&gt;
# kpartx -a /dev/sr0
device-mapper: reload ioctl failed: Invalid argument
create/reload failed on sr0p1
device-mapper: reload ioctl failed: Invalid argument
create/reload failed on sr0p2
#
&lt;/pre&gt;

	&lt;p&gt;That did not work too well. For some reason the device mapper does not like CDROM/&lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; devices. So we&amp;#8217;ll have to get a bit inventive. We create a loop device which is backed by the &lt;span class=&quot;caps&quot;&gt;DVD&lt;/span&gt; device, and use that.&lt;/p&gt;

&lt;pre&gt;
# /sbin/losetup /dev/loop0 /dev/sr0
# /sbin/kpartx -av /dev/loop0 
add map loop0p1 (253:5): 0 63 linear /dev/loop0 1
add map loop0p2 (253:6): 0 9178688 linear /dev/loop0 448
#
&lt;/pre&gt;

	&lt;p&gt;The command found and created two partitions. The first partition is the ISO9660 file system at the beginning of the disk, the second one is the partition we are interested in. Let&amp;#8217;s look what&amp;#8217;s in it.&lt;/p&gt;

&lt;pre&gt;
# file -s /dev/mapper/loop0p2
/dev/mapper/loop0p2: Macintosh HFS Extended version 4 data last mounted by: &amp;#39;10.0&amp;#39;, created: 
Tue Oct 30 00:32:01 2007, last modified: Wed Dec 19 16:45:14 2007, last checked: Tue Oct 30 00:32:01
2007, block size: 4096, number of blocks: 1147336, free blocks: 192685
#
&lt;/pre&gt;

	&lt;p&gt;That looks good. We could now mount the filesystem and look around.&lt;/p&gt;

&lt;pre&gt;
# mount /dev/mapper/loop0p2 /mnt
# ls /mnt
Applications  Desktop DB  dev  Install Mac OS X.app  mach_kernel  sbin    tmp  vanilla  Volumes
bin           Desktop DF  etc  Library               private      System  usr  var
#
&lt;/pre&gt;

	&lt;p&gt;To get rid of all this again we have to unmount the file system, destroy the mappings and release the loop device:&lt;/p&gt;

&lt;pre&gt;
# umount /mnt
# kpartx -d /dev/loop0
# losetup -d /dev/loop0
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Sun, 25 Jan 2009 16:21:53 +0100</pubDate>
    <guid isPermaLink="false">http://www.skytale.net/blog/archives/3-guid.html</guid>
    
</item>

</channel>
</rss>