<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gettin' My Geek On &#187; virtualization</title>
	<atom:link href="http://www.markstevens20.net/blog/category/virtualization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markstevens20.net/blog</link>
	<description>Ramblings on my experiments with Linux, networking, and collaboration aps</description>
	<lastBuildDate>Sat, 30 Jan 2010 01:23:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NFSv4 Configuration</title>
		<link>http://www.markstevens20.net/blog/2009/09/nfsv4-configuration/</link>
		<comments>http://www.markstevens20.net/blog/2009/09/nfsv4-configuration/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 01:35:35 +0000</pubDate>
		<dc:creator>Mark Stevens</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[HomeNetworking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://www.markstevens20.net/blog/?p=278</guid>
		<description><![CDATA[Having figured out Samba shares, I thought I would tackle remote file systems between Linux machines using NFS (Network File Service).  The documentation looked clear enough, but it wasn&#8217;t quit as easy as I expected, largely due to the differences between version 3 and 4 of NFS with respect to:

firewall behavior
exporting file system syntax [...]]]></description>
			<content:encoded><![CDATA[<p>Having figured out <a href="http://www.markstevens20.net/blog/2009/06/linux-windows-xp-home-networking/" target="_blank" title="my Samba config blog post">Samba shares</a>, I thought I would tackle remote file systems between Linux machines using NFS (Network File Service).  The <a href="http://www.centos.org/docs/5/html/5.2/Deployment_Guide/ch-nfs.html" target="_blank" title="Centos.org doc for NFS">documentation</a> looked clear enough, but it wasn&#8217;t quit as easy as I expected, largely due to the differences between version 3 and 4 of NFS with respect to:</p>
<ul>
<li>firewall behavior</li>
<li>exporting file system syntax and use of pseudo file systems</li>
<li>difference in mount command syntax</li>
</ul>
<p>I am running systems that use SELinux and <a href="#footnote" title="link to blog footnote">firewalls*</a>.  I have one Centos 5.3 NFS server and three client machines running as <a href="#footnote" title="link to blog footnote">virtual machines**</a> on the server.  My goal was to establish remote file systems for the virtual machine clients. I&#8217;ll skip some of the introductory steps to set up the nfs server process that are listed in the <a href="http://www.centos.org/docs/5/html/5.2/Deployment_Guide/ch-nfs.html" target="_blank" title="Centos.org doc for NFS">doc</a>.</p>
<p>I&#8217;ll list the commands that I used to export the file system from the server and the mount command I first used on the client.  The file system that I was attempting to export was /junk/client1.  On the server (server.stevens.net), I added the following to /etc/exports:</p>
<div class="code">
[root@sserver ~]# <b>vi /etc/exports</b><br />
<b>/junk/client1  client1.stevens.net(rw)</b> <i>(:wq!)</i><br />
[root@sserver /]# <b>exportfs -rv</b><br />
[root@sserver /]# exportfs -rv<br />
exporting client1.stevens.net:/junk/client1<br />
[root@sserver /]# service nfs restart<br />
Shutting down NFS mountd:                                  [  OK  ]<br />
Shutting down NFS daemon:                                  [  OK  ]<br />
Shutting down NFS quotas:                                  [  OK  ]<br />
Shutting down NFS services:                                [  OK  ]<br />
Starting NFS services:                                     [  OK  ]<br />
Starting NFS quotas:                                       [  OK  ]<br />
Starting NFS daemon:                                       [  OK  ]<br />
Starting NFS mountd:                                       [  OK  ]
</div>
<p>and I used the following mount command on client1.stevens.net (and received the error shown):</p>
<div class="code">
[root@client1 ~]# <b>mount -t nfs4 sserver.stevens.net:/junk/client1 /remotesys</b><br />
mount.nfs4: sserver.stevens.net:/junk/client1 failed, reason given by server: No<br />
such file or directory.
</div>
<p>A bit surprised that it didn&#8217;t work, I poked around the Internet and I found some good info that ultimately helped me get on the right track at <a href="http://www.brennan.id.au/19-Network_File_System.html#nfs4" target="_blank" title="http://www.brennan.id.au/index.html"> Miles Brennan&#8217;s Linux Home Server HOWTO page</a>. He does an excellent job explaining the pseudo file system configuration required for version 4 of NFS.</p>
<p>I built out the following psuedo file system on the server:</p>
<div class="code">
[root@sserver /]# <b>mkdir NFS4exports</b><br />
[root@sserver /]# <b>cd NFS4exports</b><br />
[root@sserver NFS4exports]# <b>mkdir client1</b><br />
[root@sserver NFS4exports]# <b>mkdir client2</b>
</div>
<p>I then created bindings in /etc/fstab between /NFS4exports and /junk directories as follows (Bindings are like symbolic links, but the files are available in both filesystems, rather than being linked to the source location.):</p>
<div class="code">
[root@sserver /]# <b>vi /etc/fstab</b><br />
<b>/junk/client1            /NFS4exports/client1    none    bind         0 0<br />
/junk/client2            /NFS4exports/client2    none    bind         0 0</b><br />
[root@sserver /]# <b>mount -a -t none</b><br />
[root@sserver /]# <b>cd /NFS4exports/client1</b><br />
[root@sserver client1]# <b>ls -ltr</b> <i> This actually displays the files &#038; directories in the /junk/client1/ directory. </i><br />
total 24<br />
drwxrwxrwx 2 root root 4096 Sep  7 13:38 backup<br />
drwxrwxrwx 2 root root 4096 Sep  7 13:38 filestore<br />
-rwxrwxrwx 1 root root   39 Sep  7 13:41 client1.txt
</div>
<p>Then I list the pseudo file systems in the /etc/exports file, and it is critical to note that the fsid=0 option be defined on the /NFS4exports file system (even though /NFS4exports itself will not be mounted by a remote client).  Then all exported file systems are sub-directories of this system.  If I had additional file systems elsewhere on the server that I wanted to share (say, /home), I would need to create an entry in the pseudo file system and bind it to /home in fstab.</p>
<div class="code">
[root@sserver client1]# <b>vi /etc/exports<br />
/NFS4exports *.stevens.net(ro,fsid=0)<br />
/NFS4exports/client1 client1.stevens.net(rw,nohide)</b><br />
<b>/NFS4exports/client2 client2.stevens.net(rw,nohide)</b><br />
<i>then export with <b>exportfs -rv</b> and restart nfs</i>
</div>
<p>Then I mounted the file systems from the client1 system.  A major difference between the NFSv3 and NFSv4 command is that the root pseudo filesystem is <b>not</b> included in the identity of the remote file system (i.e., the NFS4exports directory is omitted from the command.</p>
<div class="code">
[root@client1 /]# <b>mount -t nfs4 sserver.stevens.net:/client1 /remotesys</b><br />
[root@client1 /]# <b>ls -ltr /remotesys</b><br />
total 24<br />
drwxrwxrwx 2 root root 4096 Sep 7 13:38 backup<br />
drwxrwxrwx 2 root root 4096 Sep 7 13:38 filestore<br />
-rwxrwxrwx 1 root root 39 Sep 7 13:41 client1.txt
</div>
<p>And on client2, showing an example that it can mount the client1 directory, but can&#8217;t see anything or write to it:</p>
<div class="code">
[root@client2 /]# <b>mount -t nfs4 sserver.stevens.net:/client1 /remotesys</b><br />
[root@client2 /]# <b> cd /remotesys</b><br />
[root@client2 remotesys]# <b>ls</b><br />
[root@client2 remotesys]# <b>mkdir test</b><br />
mkdir: cannot create director &#8216;test&#8217;: Read-only file system<br />
[root@client2 remotesys]# <b>cd..</b><br />
root@client2 /]# <b>umount /remotesys</b><br />
[root@client2 /]# <b>mount -t nfs4 sserver.stevens.net:/client2/remotesys</b><br />
[root@client2 /]# <b> cd /remotesys</b><br />
[root@client2 remotesys]# <b>ls -ltr</b><br />
total 24<br />
drwxrwxrwx 2 root root 4096 Sep 7 13:38 backup<br />
drwxrwxrwx 2 root root 4096 Sep 7 13:38 filestore<br />
-rwxrwxrwx 1 root root 39 Sep 7 13:41 client2.txt
</div>
<p>And that completed my setup (except to modify /etc/fstab so that the new /remotesys file system will automount at boot).  The main point was to learn about NFS, but I also ended up with a way to provide storage for my virtual machines outside of the .vmdk virtual file system.<br />
<a name="footnote" id="footnote"></a><br />
<i><br />
Footnotes:<br />
* NFSv4 plays better with firewall because, unlike NFSv3, it does not make use of portmapper and rpc.mountd, rpc.statd, and rpc.lockd. I just had to open port 2049 on the firewall for NFS. However, during some troubleshooting, I needed to execute &#8220;showmount -e sserver.stevens.net&#8217; from a client machine.  The firewall blocked it, because it uses rpc.mountd and portmapper picks a random port by default.  I used /etc/sysconfig/nfs to define a static port for rpc.mountd and then opened this port on the firewall too.<br />
**  As a side note with respect to the virtualization setup, I created one vm and installed a small, simple Centos image.  Then I copied the files twice to new folders in /var/lib/vmware/VirtualMachines. Then I imported these virtual machines into VMware Server to quickly make some clones.  Just a quick edit of the /etc/sysconfig/network file to update each machine to a unique hostname, and I had 3 distinct client machines.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markstevens20.net/blog/2009/09/nfsv4-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip of the Virtual Iceburg</title>
		<link>http://www.markstevens20.net/blog/2009/08/tip-of-the-virtual-iceburg/</link>
		<comments>http://www.markstevens20.net/blog/2009/08/tip-of-the-virtual-iceburg/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 21:17:06 +0000</pubDate>
		<dc:creator>Mark Stevens</dc:creator>
				<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://www.markstevens20.net/blog/?p=251</guid>
		<description><![CDATA[Well, I&#8217;ve started messing around with virtualization.  Saying I&#8217;ve only scratched the surface is an understatement, but you&#8217;ve got to start somewhere, right?  I Installed VMware Server 2 on my Centos 5.3 machine, and then installed Windows 7 Release Candidate as a virtual machine.  This was all easier than my initial installation [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.markstevens20.net/blog/wp-content/uploads/2009/08/screenshotdesktop-300x240.png" alt="screenshotdesktop" title="Windows 7 RC Guest on Centos Host" width="400" height="320" class="alignright size-medium wp-image-260" />Well, I&#8217;ve started messing around with <a href="http://en.wikipedia.org/wiki/Platform_virtualization" target="_blank" title="What's virtualization? Click here for basics">virtualization</a>.  Saying I&#8217;ve only scratched the surface is an understatement, but you&#8217;ve got to start somewhere, right?  I Installed VMware Server 2 on my Centos 5.3 machine, and then installed Windows 7 Release Candidate as a virtual machine.  This was all easier than my initial installation of Centos on my home built PC.  It&#8217;s really just installing software and allocating resources of the host machine to the guest machines.</p>
<p>I downloaded VMware Server (The 64 bit Linux RPM package) from <a href="http://www.vmware.com/freedownload/login.php?product=server20" target="_blank">http://www.vmware.com/freedownload/login.php?product=server20</a> as well as the User Guide from <a href="http://www.vmware.com/support/pubs/server_pubs.html" target="_blank">http://www.vmware.com/support/pubs/server_pubs.html.</a>  You will have to register with an email address on the VMWare site to access the downloads.</p>
<p>Chapter 2 of the User Guide walks you through the install.  For me it looked like this:<br />
After downloading the rpm package, I moved it to /tmp and checked the checksum vs. the value on the VMware download page.  (It matched, trust me)</p>
<div class="code">
[markste@sserver VMware]$ <b>mv VMware-server-2.0.1-156745.x86_64.rpm /tmp/</b><br />
[markste@sserver VMware]$ <b>cd /tmp</b><br />
[markste@sserver tmp]$ <b>ls -l VM*</b><br />
-rwxr-xr-x 1 markste markste 456099794 Jul 27 11:21 VMware-server-2.0.1-156745.x86_64.rpm</p>
<p>[markste@sserver tmp]$ <b>openssl dgst -md5 VMware-server-2.0.1-156745.x86_64.rpm</b><br />
MD5(VMware-server-2.0.1-156745.x86_64.rpm)= 697a792c70d50e98a347c06b323bd20b
</div>
<p>Then installed it with the instructions in the User Guide, and ran the vmware-config.pl script</p>
<div class="code">
[markste@sserver tmp]$ <b>su -</b><br />
Password: </p>
<p>[root@sserver ~]# <b>rpm -Uhv /tmp/VMware-server-2.0.1-156745.x86_64.rpm</b><br />
Preparing&#8230;                ########################################### [100%]<br />
 1:VMware-server          ########################################### [100%]</p>
<p>The installation of VMware Server 2.0.1 for Linux completed successfully.<br />
You can decide to remove this software from your system at any time by<br />
invoking the following command: &#8220;rpm -e VMware-server&#8221;.</p>
<p>Before running VMware Server for the first time, you need to<br />
configure it for your running kernel by invoking the<br />
following command: &#8220;/usr/bin/vmware-config.pl&#8221;.</p>
<p>Enjoy,</p>
<p>    &#8211;the VMware team</p>
<p>[root@sserver ~]# <b>vmware-config.pl</b>
</div>
<p>In this script, I had to: </p>
<ul>
<li>Accept the EULA</li>
<li>Configure networking (make all three types: bridged, NAT and host-only.  When you build virtual machines, you may then select which type of network connection you want for each virtual machine.  More info about the network types in chapter 11 of the User’s Guide)</li>
<li>Set an administrator name (user on the computer)</li>
<li>Set some port numbers (used defaults) </li>
<li>Set some directories to store files.  I did not like that the virtual machine files would, by default, be stored in /var/lib/vmware/Virtual Machines (space in directory name &#8211; yuck) so I changed it to /var/lib/vmware/VirtualMachines.  </li>
<li>Enter your license key, provided on the VMware download page. </li>
</ul>
<p>Once it was installed, I fired up Firefox, aimed at http://localhost:8222 which started the VI Web Access (VMware Servers UI). This is when I realized that /var was too small.  I decided to grow /var, since it was a logical volume and i had available space in the Volume Group. (This is worthy of it&#8217;s own post).<br />
<img src="http://www.markstevens20.net/blog/wp-content/uploads/2009/08/vmware-300x243.png" alt="vmware" title="vmware" width="500"/><br />
 I configured my first virtual machine using Chapter 4 of the User Guide and the wizard.  Then I placed my Windows 7 RC installation DVD into the drive and powered on the Virtual Machine, and completed the install of the guest OS.  Poof! Virtualization experienced.</p>
<p>Still loads and loads (and loads?) to learn, but it&#8217;s been good to see the allocation of host resources for the guest machines, as well as the representation of virtual hardware to the guest OS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markstevens20.net/blog/2009/08/tip-of-the-virtual-iceburg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
