<?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>Technology, Computer, Network and Games Cheat &#187; Linux</title>
	<atom:link href="http://www.gamescheat.ca/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamescheat.ca</link>
	<description>Day to day technical how to - by Andrew Lin</description>
	<lastBuildDate>Thu, 26 May 2011 18:48:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to extend the filesystem on a Vmware ESX guest Red Hat Linux server</title>
		<link>http://www.gamescheat.ca/2011/05/how-to-extend-the-filesystem-on-a-vmware-esx-guest-red-hat-linux-server/</link>
		<comments>http://www.gamescheat.ca/2011/05/how-to-extend-the-filesystem-on-a-vmware-esx-guest-red-hat-linux-server/#comments</comments>
		<pubDate>Thu, 26 May 2011 18:48:10 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[VMware ESX]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=889</guid>
		<description><![CDATA[Being the administrator of a large Linux shop, I have had to extend the filesystems on the Red Hat Linux server a few times. Each time I had the opportunity to extend the filesystem, I found that I struggled to remember the commands and steps. This is because Linx is a very command line driven [...]]]></description>
			<content:encoded><![CDATA[<p>Being the administrator of a large Linux shop, I have had to extend the filesystems on the Red Hat Linux server a few times.  Each time I had the opportunity to extend  the filesystem, I found that I struggled to remember the commands and steps.  This is because Linx is a very command line driven operating system.  All right that is not completely true anymore, some variants of Linux have graphical interfaces.  Such as Red Hat has the graphical Logical Volume Manager (LVM), but I find the LVM to be buggy and unreliable at times. Personally I find it more reliable and easier to extend the filesystem using the command line interface.</p>
<p><strong>The sequence to extend the filesystem is as follow.</strong><br />
(1) Add the new disk.  In my case I was running Red Hat Enterprise 5 Linux as a guest operating system in Vmware ESX server.  I simply had to increase the disk size using the Vmware Vcenter interface, under edit setting, disk provisioning.  You will need to reboot the guest OS after to recognize the new disk size.</p>
<p>(2) Partition the new disk space using fdisk.</p>
<p>(3) Initialize the new partition, using the command pvcreate.  Run partprobe to update the kernel.</p>
<p>(4) Extend the existing volume group with the new partition using the command vgextend.</p>
<p>(5) Extend the existing logical volume group using lvextend.</p>
<p>(6) Grow the filesystem with the command resize2fs.</p>
<p><strong>Take a snapshot of the existing disks and to understand how they are partitioned.</strong><br />
The fdisk command will display the configuration of the existing disks. In this example there are two disks, a 10.7 GB /dev/sda and /dev/sdb which is 21.4 GB.  Disk sda has two partitions, sda1 and sda2. The second disk sdb has only one partition sdb1.</p>
<blockquote><p>
[root@linux_server ~]# fdisk -l</p>
<p>Disk /dev/sda: 10.7 GB, 10737418240 bytes<br />
255 heads, 63 sectors/track, 1305 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>  ice Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          13      104391   83  Linux<br />
/dev/sda2              14        1305    10377990   8e  Linux LVM</p>
<p>Disk /dev/sdb: 21.4 GB, 21475491840 bytes<br />
255 heads, 63 sectors/track, 2610 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>  ice Boot      Start         End      Blocks   Id  System<br />
/dev/sdb1               1        2610    20964793+  8e  Linux LVM</p></blockquote>
<p>You also need to take a snapshot of how the partitions are allocated to the volume groups.  In the below example, the result of pvscan indicates that sda2 is mapped to the volume group VolGroup00.  But where is sda1?  Well sda1 is mapped to the /boot filesystem, you will see it when you issue the mount command.  You can also use the command pvs or pvdisplay instead of pvscan.</p>
<blockquote><p>[root@linux_server ~]# pvscan<br />
  PV /dev/sdb1   VG gfs_vg       lvm2 [19.99 GB / 8.99 GB free]<br />
  PV /dev/sda2   VG VolGroup00   lvm2 [9.88 GB / 0    free]<br />
  Total: 2 [29.84 GB] / in use: 2 [29.84 GB] / in no VG: 0 [0   ]</p></blockquote>
<p>The mount command will show you that /dev/sda1 is mounted as /boot.  In this example we will be extending the / (root) filesystem.</p>
<blockquote><p>[root@linux_server ~]# mount<br />
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)<br />
proc on /proc type proc (rw)<br />
sysfs on /sys type sysfs (rw)<br />
devpts on /dev/pts typepts (rw,gid=5,mode=620)<br />
/dev/sda1 on /boot type ext3 (rw)<br />
tmpfs on /dev/shm type tmpfs (rw)<br />
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)<br />
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)<br />
none on /sys/kernel/config type configfs (rw)<br />
/dev/mapper/gfs_vg-gfs_lv on /mnt/gfs type gfs2 (rw,noatime,nodiratime,hostdata=jid=0:id=196609:first=0)</p></blockquote>
<p><strong>Add the new disk or extend the existing disk in Vmware.</strong><br />
Expand the disk sda using the VMware Vcenter management console.  Under the summary tab of the guest server, go to edit settings &#8211; disk provisioning. Simply increase the disk size and then reboot the guest OS.</p>
<p><strong>Partition the disk</strong><br />
After the guest server has been rebooted it should see the size increment in sda.  You now need to partition the new disk space using the command fdisk.</p>
<blockquote><p>[root@linux_server ~]# fdisk /dev/sda</p>
<p>The number of cylinders for this disk is set to 2610.<br />
There is nothing wrong with that, but this is larger than 1024,<br />
and could in certain setups cause problems with:<br />
1) software that runs at boot time (e.g., old versions of LILO)<br />
2) booting and partitioning software from other OSs<br />
   (e.g., DOS FDISK, OS/2 FDISK)</p>
<p>Command (m for help): m  <strong>(select m to display the help screen)</strong><br />
Command action<br />
   a   toggle a bootable flag<br />
   b   edit bsd disklabel<br />
   c   toggle the dos compatibility flag<br />
   d   delete a partition<br />
   l   list known partition types<br />
   m   print this menu<br />
   n   add a new partition<br />
   o   create a new empty DOS partition table<br />
   p   print the partition table<br />
   q   quit without saving changes<br />
   s   create a new empty Sun disklabel<br />
   t   change a partition&#8217;s system id<br />
   u   change display/entry units<br />
   v   verify the partition table<br />
   w   write table to disk and exit<br />
   x   extra functionality (experts only)</p>
<p>Command (m for help): n <strong>(select n to add a new partition)</strong></p>
<p>Command action<br />
   e   extended<br />
   p   primary partition (1-4)<br />
p <strong>(select p to create a primary partition)</strong><br />
Partition number (1-4): 3 (enter 3 for partition number, we already know from the output of fdisk -l that sda1 and sda2 already exist, therefore the new partition will be sda3)</p>
<p>First cylinder (1306-2610, default 1306): <strong>(hit the enter key to accept the default)</strong><br />
Using default value 1306<br />
Last cylinder or +size or +sizeM or +sizeK (1306-2610, default 2610): <strong>(press the enter key to accept the default. You can also select something lower than 2610, if you do not want to use all available free disk space)</strong><br />
Using default value 2610</p>
<p>Command (m for help): t <strong>(select t to change the system id)</strong><br />
Partition number (1-4): 3 <strong>(select the new partition number)</strong><br />
Hex code (type L to list codes): 8e <strong>(Enter 8e which is the code for Linux LVM)</strong><br />
Changed system type of partition 3 to 8e <strong>(Linux LVM)</strong></p>
<p>Command (m for help): p <strong>(this will print the partition table, verify the changes you made)</strong></p>
<p>Disk /dev/sda: 21.4 GB, 21474836480 bytes<br />
255 heads, 63 sectors/track, 2610 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>  ice Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          13      104391   83  Linux<br />
/dev/sda2              14        1305    10377990   8e  Linux LVM<br />
/dev/sda3            1306        2610    10482412+  8e  Linux LVM</p>
<p>Command (m for help): w <strong>(this will write the table tto disk committing it)</strong><br />
The partition table has been altered!<br />
Calling ioctl() to re-read partition table.<br />
WARNING: Re-reading the partition table failed with error 16:ice or resource busy.<br />
The kernel still uses the old table.<br />
The new table will be used at the next reboot.<br />
Syncing disks.</p>
<p>Note: <strong>(May have to hit enter to get command prompt back)</strong></p></blockquote>
<p><strong>Initialize the physical volume</strong><br />
Initialize the new physical volume with the command pvcreate /dev/sda3. If you have not rebooted the operating system after creating the new partition, then you will need to run partprobe for the kernel to recognize the new partition. Or else you will get an error.</p>
<blockquote><p>[root@linux_server ~]# pvcreate /dev/sda3<br />
 ice /dev/sda3 not found (or ignored by filtering).</p></blockquote>
<p>Run partrobe to update the kernel.</p>
<blockquote><p>[root@linux_server]# partprobe -s<br />
/dev/sda: msdos partitions 1 2 3<br />
/dev/sdb: msdos partitions 1</p></blockquote>
<p>Initialize the partition.</p>
<blockquote><p>[root@linux_server]# pvcreate /dev/sda3<br />
  Physical volume &#8220;/dev/sda3&#8243; successfully created</p></blockquote>
<p><strong>Add new physical volume to the volume group VolGroup00</strong><br />
The command vgdisplay will show you the specifics of the existing volume groups. Note the VG size is 9.88 GB. You can also use vgs and vgscan to display a different view of all volume groups.</p>
<blockquote><p>[root@linux_server ~]# vgdisplay<br />
  &#8212; Volume group &#8212;<br />
  VG Name               gfs_vg<br />
  System ID<br />
  Format                lvm2<br />
  Metadata Areas        1<br />
  Metadata Sequence No  7<br />
  VG Access             read/write<br />
  VG Status             resizable<br />
  Clustered             yes<br />
  Shared                no<br />
  MAX LV                0<br />
  Cur LV                2<br />
  Open LV               2<br />
  Max PV                0<br />
  Cur PV                1<br />
  Act PV                1<br />
  VG Size               19.99 GB<br />
  PE Size               4.00 MB<br />
  Total PE              5118<br />
  Alloc PE / Size       2816 / 11.00 GB<br />
  Free  PE / Size       2302 / 8.99 GB<br />
  VG UUID               ws74W5-bejg-UUqe-ReFJ-ip6i-4Ixy-CAKkDC</p>
<p>  &#8212; Volume group &#8212;<br />
  VG Name               VolGroup00<br />
  System ID<br />
  Format                lvm2<br />
  Metadata Areas        1<br />
  Metadata Sequence No  3<br />
  VG Access             read/write<br />
  VG Status             resizable<br />
  MAX LV                0<br />
  Cur LV                2<br />
  Open LV               2<br />
  Max PV                0<br />
  Cur PV                1<br />
  Act PV                1<br />
  VG Size               9.88 GB<br />
  PE Size               32.00 MB<br />
  Total PE              316<br />
  Alloc PE / Size       316 / 9.88 GB<br />
  Free  PE / Size       0 / 0<br />
  VG UUID               KxKjSV-yOQl-T0gR-vse1-Z0RO-nJfM-FQxMZ0</p></blockquote>
<p>Add sda3 to VolGroup00</p>
<blockquote><p>[root@linux_server]# vgextend /dev/VolGroup00 /dev/sda3<br />
  Volume group &#8220;VolGroup00&#8243; successfully extended</p>
<p>Note that the VG size has increased to 19.84 GB.<br />
[root@linux_server]# vgdisplay<br />
  &#8212; Volume group &#8212;<br />
  VG Name               gfs_vg<br />
  System ID<br />
  Format                lvm2<br />
  Metadata Areas        1<br />
  Metadata Sequence No  7<br />
  VG Access             read/write<br />
  VG Status             resizable<br />
  Clustered             yes<br />
  Shared                no<br />
  MAX LV                0<br />
  Cur LV                2<br />
  Open LV               2<br />
  Max PV                0<br />
  Cur PV                1<br />
  Act PV                1<br />
  VG Size               19.99 GB<br />
  PE Size               4.00 MB<br />
  Total PE              5118<br />
  Alloc PE / Size       2816 / 11.00 GB<br />
  Free  PE / Size       2302 / 8.99 GB<br />
  VG UUID               ws74W5-bejg-UUqe-ReFJ-ip6i-4Ixy-CAKkDC</p>
<p>  &#8212; Volume group &#8212;<br />
  VG Name               VolGroup00<br />
  System ID<br />
  Format                lvm2<br />
  Metadata Areas        2<br />
  Metadata Sequence No  4<br />
  VG Access             read/write<br />
  VG Status             resizable<br />
  MAX LV                0<br />
  Cur LV                2<br />
  Open LV               2<br />
  Max PV                0<br />
  Cur PV                2<br />
  Act PV                2<br />
  VG Size               19.84 GB<br />
  PE Size               32.00 MB<br />
  Total PE              635<br />
  Alloc PE / Size       316 / 9.88 GB<br />
  Free  PE / Size       319 / 9.97 GB<br />
  VG UUID               KxKjSV-yOQl-T0gR-vse1-Z0RO-nJfM-FQxMZ0</p></blockquote>
<p><strong>Extend the Logical Volume Group /dev/VolGroup00/LogVol00 which is mounted as the root filesystem.</strong><br />
Display the specifics for all logical volume with lvdisplay.  You can also use lvscan or lvs to display a summarized view.</p>
<blockquote><p>[root@linux_server]# lvdisplay<br />
  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/gfs_vg/gfs_lv<br />
  VG Name                gfs_vg<br />
  LV UUID                NZrcfq-6Shf-z5cZ-fWJM-fQVi-wOTa-kPhUVG<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 1<br />
  LV Size                10.00 GB<br />
  Current LE             2560<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Blockice           253:2</p>
<p>  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/gfs_vg/quorum_lv<br />
  VG Name                gfs_vg<br />
  LV UUID                Pr27bq-X1AM-U6WC-ceJd-dlIu-AipK-pFRfAE<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 1<br />
  LV Size                1.00 GB<br />
  Current LE             256<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Blockice           253:3</p>
<p>  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/VolGroup00/LogVol00<br />
  VG Name                VolGroup00<br />
  LV UUID                n4QGnw-R9Wj-RHXU-Q1QO-X2aa-vKdx-Js3fwp<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 1<br />
  LV Size                8.88 GB<br />
  Current LE             284<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Blockice           253:0</p>
<p>  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/VolGroup00/LogVol01<br />
  VG Name                VolGroup00<br />
  LV UUID                qqyXcr-nys3-K7MO-LsbU-5CL8-d2hR-MyliKF<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 1<br />
  LV Size                1.00 GB<br />
  Current LE             32<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Blockice           253:1</p></blockquote>
<p>Extend /dev/VolGroup00/LogVol00 using lvextend. The option -l +100%FREE will use up all available disk space.  You can also specify the size with the option -L18G, which will extend the logical volume to 18 GB. The option -L+1G will add another gigabyte to the logical volume.</p>
<blockquote><p>[root@linux_server]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00<br />
  Extending logical volume LogVol00 to 18.84 GB<br />
  Logical volume LogVol00 successfully resized</p></blockquote>
<p><strong>Extend the filesystem</strong><br />
We are almost done, the last step is to extend the filesystem.</p>
<p>Record the size of the existing filesystems with the df -h command.</p>
<blockquote><p>[root@linux_server]# df -h<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
                      8.6G  8.0G  205M  98% /<br />
/dev/sda1              99M   19M   75M  21% /boot<br />
tmpfs                 490M     0  490M   0% /dev/shm<br />
/dev/mapper/gfs_vg-gfs_lv<br />
                      9.8G  584M  9.2G   6% /mnt/gfs</p></blockquote>
<p>Expand the filesystem /dev/mapper/VolGroup00-LogVol00 which is mounted on /. The command resize2fs can be used to enlarge or shrink ext2 or ext3 filesystems that are unmounted. On Linux kernel version that is equal or greater than 2.6, resize2fs can expand a mounted ext3 filesystem only.</p>
<blockquote><p>[root@linux_server]# resize2fs /dev/mapper/VolGroup00-LogVol00<br />
resize2fs 1.39 (29-May-2006)<br />
Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required<br />
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 4939776 (4k) blocks.<br />
The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 4939776 blocks long.</p></blockquote>
<p>Verify that /dev/mapper/VolGroup00-LogVol00 has increased in size.</p>
<blockquote><p>[root@linux_server]# df -h<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
                       19G  8.0G  9.4G  46% /<br />
/dev/sda1              99M   19M   75M  21% /boot<br />
tmpfs                 490M     0  490M   0% /dev/shm<br />
/dev/mapper/gfs_vg-gfs_lv<br />
                      9.8G  584M  9.2G   6% /mnt/gfs</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/05/how-to-extend-the-filesystem-on-a-vmware-esx-guest-red-hat-linux-server/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Unable to login to remote server via ssh</title>
		<link>http://www.gamescheat.ca/2011/05/unable-to-login-to-remote-server-via-ssh/</link>
		<comments>http://www.gamescheat.ca/2011/05/unable-to-login-to-remote-server-via-ssh/#comments</comments>
		<pubDate>Wed, 18 May 2011 11:00:26 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Aix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=887</guid>
		<description><![CDATA[A funny thing happened to one of my Red Hat 5 Enterprise servers after applying the errata. I rebooted the servers as usual after applying the updates, and they came up just fine. But unfortunately I was not able to logon remotely via ssh to a server. I tried various different accounts including root, but [...]]]></description>
			<content:encoded><![CDATA[<p>A funny thing happened to one of my Red Hat 5 Enterprise servers after applying the errata.  I rebooted the servers as usual after applying the updates, and they came up just fine.  But unfortunately I was not able to logon remotely via ssh to a server.  I tried various different accounts including root, but none of them worked. </p>
<p>It seems that I was able to login successfully into the server, but within few seconds it would kick me out.  Just before it disconnected my ssh session, I saw the message ‘The server is going down..’.   For some strange reason that message was stuck in the operating system, it was the message displayed just before the scheduled reboot.  I had pushed out the reboot command from the Red Hat Satellite server.  All the other servers rebooted fine.</p>
<p>I knew that clearing this message would resolve my dilemma, but I had no idea which file held it.  After much searching I found the culprit, it was /etc/nologin. Due to reason I did not want to try and figure out as it would take too much time, this file did not get automatically deleted after the reboot.  I deleted /etc/nologin, and then was able to successfully login via ssh to the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/05/unable-to-login-to-remote-server-via-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a new superuser in Linux</title>
		<link>http://www.gamescheat.ca/2011/05/how-to-create-a-new-superuser-in-linux/</link>
		<comments>http://www.gamescheat.ca/2011/05/how-to-create-a-new-superuser-in-linux/#comments</comments>
		<pubDate>Tue, 17 May 2011 18:06:59 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=883</guid>
		<description><![CDATA[The administrative account ‘root’ is the most powerful user in Linux and Unix. This account is created by default during installation of the operating system. Most security consultants will recommend that the root account be deleted or renamed. This is to make it harder for a hacker to find out what a valid user account [...]]]></description>
			<content:encoded><![CDATA[<p>The administrative account ‘root’ is the most powerful user in Linux and Unix.  This account is created by default during installation of the operating system.   Most security consultants will recommend that the root account be deleted or renamed.  This is to make it harder for a hacker to find out what a valid user account is. </p>
<p>Before you delete or rename the root account it is important that you create a new account with the same privileges as root.  This account should have the same capabilities as root, a new superuser account.  I will explain the steps to create a new superuser account in Redhat Linux.  The steps are similar for Centos, Fedora and most other variants of Linux.</p>
<p>Let’s begin by checking the characteristics of the root account.</p>
<blockquote><p># id root<br />
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)</p>
<p>uid=0(root), this indicates that root has a user id of 0.<br />
gid=0, the group id is 0.<br />
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel), these are the groups root belongs to.  The numbers signifies the group id numbers, e.g. disk has a group id of 6.</p></blockquote>
<p>To create a new superuser, it must have the same uid, gid and belong to the same groups as the root account.</p>
<p>You can create a new superuser account using the adduser command.</p>
<blockquote><p># adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M andrew</p>
<p>-u 0 –o, this sets the uid to 0.<br />
-g 0, sets the gid to 0.<br />
-G 0,1,2,3,4,6,10, sets the group membership to 0 = root, 1 = bin, 2 = daemon, 3 = sys, 4 = adm, 6 = disk and 10 = wheel.<br />
-M, do not create a home directory.<br />
andrew, new user account name.</p></blockquote>
<p>Create a password for the new account.</p>
<blockquote><p># passwd andrew<br />
Changing password for user andrew:<br />
New UNIX password:<br />
Retype new UNIX password:<br />
Passwd: all authentication tokens updated successfully.</p></blockquote>
<p>What if you want to promote an existing user to superuser?  Then you will need to edit two files, /etc/passwd and /etc/group.</p>
<p>Open /etc/passwd with Vi editor and change the gid and uid to 0 for andrew.</p>
<blockquote><p>andrew:x:0:0::/home/andrew:/bin/bash</p></blockquote>
<p>Edit /etc/group and add andrew to the groups root, bin, daemon, sys, adm, disk and wheel.</p>
<blockquote><p>root:x:0:root,andrew<br />
bin:x:1:root,bin,daemon,andrew<br />
daemon:x:2:root,bin,daemon,andrew<br />
sys:x:3:root,bin,adm,andrew<br />
adm:x:4:root,adm,daemon,andrew<br />
disk:x:6:root,andrew<br />
wheel:x:10:root,andrew</p></blockquote>
<p>If the user account andrew has and existing home directory such as /home/andrew, then you will need to change the ownership to reflect root. </p>
<blockquote><p># chown root:root /home/andrew</p></blockquote>
<p>Otherwise you will receive the following error message, upon logging in.</p>
<blockquote><p>User’s $HOME/.dmrc file is being ignored. This prevents the default session and language from being saved. File should be owned by user and have 644 permission. User $HOME directory must be owned by user and not writable by other users.</p></blockquote>
<p>This is because the uid and gid for andrew has been changed to 0, this is the same as root.  Whereas /home/andrew still belongs to the username andrew, which had a uid and gid of 500 or higher number.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/05/how-to-create-a-new-superuser-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshoot problem with yum update and rebuild the rpm database</title>
		<link>http://www.gamescheat.ca/2011/03/troubleshoot-problem-with-yum-update-and-rebuild-the-rpm-database/</link>
		<comments>http://www.gamescheat.ca/2011/03/troubleshoot-problem-with-yum-update-and-rebuild-the-rpm-database/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 18:45:03 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=864</guid>
		<description><![CDATA[I have created a step by step approach to troubleshoot a problem with performing yum update and how to rebuild the rpm database. I received and error while trying to update the Redhat Enterprise 5 server kernel using yum update. Looking at the output of yum update it seems that the dependency mkinitrd was missing. [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a step by step approach to troubleshoot a problem with performing yum update and how to rebuild the rpm database.</p>
<p>I received and error while trying to update the Redhat Enterprise 5 server kernel using yum update.  Looking at the output of yum update it seems that the dependency mkinitrd was missing.  </p>
<blockquote><p># yum update<br />
Loaded plugins: rhnplugin, security<br />
Skipping security plugin, no data<br />
Setting up Update Process<br />
Resolving Dependencies<br />
Skipping security plugin, no data<br />
&#8211;> Running transaction check<br />
&#8212;> Package kernel.i686 0:2.6.18-238.5.1.el5 set to be installed<br />
&#8211;> Processing Dependency: mkinitrd >= 4.2.21-1 for package: kernel<br />
&#8211;> Finished Dependency Resolution<br />
kernel-2.6.18-238.5.1.el5.i686 from rhel-i386-server-5 has depsolving problems<br />
  &#8211;> Missing Dependency: mkinitrd >= 4.2.21-1 is needed by package kernel-2.6.18-238.5.1.el5.i686 (rhel-i386-server-5)<br />
Error: Missing Dependency: mkinitrd >= 4.2.21-1 is needed by package kernel-2.6.18-238.5.1.el5.i686 (rhel-i386-server-5)<br />
 You could try using &#8211;skip-broken to work around the problem<br />
 You could try running: package-cleanup &#8211;problems<br />
                        package-cleanup &#8211;dupes<br />
                        rpm -Va &#8211;nofiles &#8211;nodigest</p></blockquote>
<p>I tried the suggested fix by running the commands package-cleanup.  But that did not resolve the problem.  I then tried clear all yum cache and to re-synch with the Red Hat Network Satellite server.  But yum update failed with the same error.</p>
<blockquote><p># rm -rf /var/cache/yum/*<br />
# yum clean all<span id="more-864"></span><br />
# rhn-profile-sync<br />
# yum update</p></blockquote>
<p>The next logical thing to do was to check and see if mkinitrd was installed, and it was.</p>
<blockquote><p># rpm -q mkinitrd<br />
mkinitrd-5.1.19.6-68.el5</p></blockquote>
<p>Now I was really puzzled, if the dependency was installed then was it healthy? Using the rpm –Va command I found out that mkinitrd was missing the dependency nash.</p>
<blockquote><p># rpm -Va mkinitrd<br />
Unsatisfied dependencies for mkinitrd-5.1.19.6-68.el5.i386: config(mkinitrd) = 5.1.19.6-68.el5, nash = 5.1.19.6-68.el5, mkinitrd</p></blockquote>
<p>Following the trail, I checked to see if nash was installed, and it was.</p>
<blockquote><p># rpm –q nash<br />
nash-5.1.19.6-68.el5</p></blockquote>
<p>Is nash healthy? No result means no fault found.</p>
<blockquote><p># rpm -Va nash</p></blockquote>
<p>If mkinitrd claims that it is dependent on nash, then checking to see what requires nash should result in mkinitrd.  But I did not receive any result back on the check.</p>
<blockquote><p># rpm -q &#8211;whatrequires nash</p></blockquote>
<p>Now I was stumped, if mkinitrd says that it was dependant on nash, then why is nash not reporting that mkinitrd requires it?  Using the rpm –q –whatrequires I checked to see what required mkinitrd.</p>
<blockquote><p># rpm -q &#8211;whatrequires mkinitrd<br />
mkbootdisk-1.5.3-2.1<br />
system-config-kdump-1.0.14-4.el5<br />
kernel-2.6.18-194.17.1.el5</p></blockquote>
<p>I compared the result of rpm –q –whatrequires nash to different installation of Redhat.  Below is what the result should be.</p>
<blockquote><p># rpm -q &#8211;whatrequires nash<br />
mkinitrd-5.1.19.6-68.el5</p></blockquote>
<p>To sum it up, the kernel cannot be updated because it is missing the dependency mkinitrd.  Mkinitrd is installed but not healthy because it is missing the dependency nash.  Nash is installed and healthy which contradicts the former statement.  Therefore there is nothing wrong with mkinitrd or nash, the problem then lies with the yum cache or rpm database.  I already ran yum clean all to clear all yum cache and headers, it did not resolve the issue.  The logical answer is that the rpm database is corrupted and requires a rebuild.</p>
<p>It may be beneficial to backup the current rpm databases before deleting.  The rpm database are in /var/lib/rpm.  It is also recommended that rebuidling be done in single user mode, although I did it successfully in init 3 run level.</p>
<p>Delete the lock files.</p>
<blockquote><p># rm –f /var/lib/rpm/__db*</p></blockquote>
<p>Rebuild the database</p>
<blockquote><p># rpm &#8211;rebuilddb</p></blockquote>
<p>You can also use the -vv option for verbose mode.</p>
<blockquote><p># rpm -vv &#8211;rebuilddb</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/03/troubleshoot-problem-with-yum-update-and-rebuild-the-rpm-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Booting Red Hat Linux into rescue mode.</title>
		<link>http://www.gamescheat.ca/2011/01/booting-red-hat-linux-into-rescue-mode/</link>
		<comments>http://www.gamescheat.ca/2011/01/booting-red-hat-linux-into-rescue-mode/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 10:00:37 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=853</guid>
		<description><![CDATA[Red Hat Linux can be booted into rescue mode from the installation CD, or any other boot method instead of the system’s hard drive. This also applies to other versions of Linux such as Fedora and Centos. The rescue mode is provided for troubleshooting and repair purposes. This is really handy when the OS is [...]]]></description>
			<content:encoded><![CDATA[<p>Red Hat Linux can be booted into rescue mode from the installation CD, or any other boot method instead of the system’s hard drive.  This also applies to other versions of Linux such as Fedora and Centos.</p>
<p>The rescue mode is provided for troubleshooting and repair purposes.  This is really handy when the OS is broken and you are unable to access the system drive.  Using rescue mode you can access the files stored on the system’s hard drive.</p>
<p>Boot the system from the installation CD-ROM, or you cab also use the iso file in the case of Vmware.  When presented with the boot: prompt, type the following command:<br />
<strong> linux rescue</strong>.</p>
<p><a href="http://www.gamescheat.ca/wp-content/uploads/2011/01/linux-rescue-mode.gif"><img src="http://www.gamescheat.ca/wp-content/uploads/2011/01/linux-rescue-mode.gif" alt="" title="linux-rescue-mode" width="542" height="364" class="aligncenter size-full wp-image-855" /></a><br />
You are prompted to answer a few basic questions, such as language to use,  and keyboard type.  Select do not start network interface, unless you have a reason to.</p>
<p>When prompted with the message “The rescue environment will attempt to find the Linux installation and mount it under the directory /mnt/sysimage…..”, select continue.  You should then see a message “Your system had been mounted under /mnt/sysimage…”.  Select OK, you are now is single-user mode.</p>
<p>The default root partition while in rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (runlevel 3 or 5). If you selected to mount your file system and it mounted successfully, you can change the root partition of the rescue mode environment to the root partition of your file system by executing the following command:<br />
<strong>Chroot /mnt/sysimage</strong></p>
<p>This is useful if you need to run commands such as rpm that require your root partition to be mounted as /. To exit the chroot environment, type exit, and you will return to the prompt. </p>
<p>You can also mount a partition manually inside rescue mode by creating a directory such as /foo, and typing the following command:<br />
<strong>mount -t ext3 /dev/hda5 /foo</strong><br />
In the above command, /foo is a directory that you have created and /dev/hda5 is the partition you want to mount. If the partition is of type ext2, replace ext3 with ext2. </p>
<p>If you do not know the names of your partitions, use the following command to list them:<br />
<strong>fdisk –l</strong></p>
<p>From the prompt, you can run many useful commands such as<br />
list-harddrives to list the hard drives in the system<br />
ssh, scp, and ping if the network is started<br />
dump and restore for users with tape drives<br />
parted and fdisk for managing partitions<br />
rpm for installing or upgrading software<br />
joe for editing configuration files (If you try to start other popular editors such as emacs, pico, or vi, the joe editor will be started.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/01/booting-red-hat-linux-into-rescue-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Identifying the kernel version and changing the default boot kernel in RedHat and Centos Linux.</title>
		<link>http://www.gamescheat.ca/2011/01/identifying-the-kernel-version-and-changing-the-default-boot-kernel-in-redhat-and-centos-linux/</link>
		<comments>http://www.gamescheat.ca/2011/01/identifying-the-kernel-version-and-changing-the-default-boot-kernel-in-redhat-and-centos-linux/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 15:49:41 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=847</guid>
		<description><![CDATA[Use the command uname to print system information in Linux. # uname -r 2.6.18-194.32.1.el5 The –r option will print the kernel release. # uname -s Linux -s prints the kernel name. # uname -n mycomputer.wiivil.com Print the node name or hostname. # uname -p i686 Print the processor type, the i686 signifies a 32 bit [...]]]></description>
			<content:encoded><![CDATA[<p>Use the command uname to print system information in Linux.</p>
<blockquote><p># uname -r<br />
2.6.18-194.32.1.el5</p></blockquote>
<p>The –r option will print the kernel release.</p>
<blockquote><p># uname -s<br />
Linux</p></blockquote>
<p>-s prints the kernel name.</p>
<blockquote><p># uname -n<br />
mycomputer.wiivil.com</p></blockquote>
<p>Print the node name  or hostname.</p>
<blockquote><p># uname -p<br />
i686</p></blockquote>
<p>Print the processor type, the i686 signifies a 32 bit processor.  If it was a 64 processor it would display x86_64 instead.</p>
<blockquote><p># uname -a<br />
Linux myserver.wiivil.com 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux</p></blockquote>
<p>Print all the information except omit –o and –I if unknown.</p>
<blockquote><p># cat /etc/redhat-release<br />
CentOS release 5.5 (Final)</p></blockquote>
<p>This will give you the version of RedHat Linux you are running.</p>
<blockquote><p># cat /proc/version<br />
Linux version 2.6.18-194.32.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Wed Jan 5 17:53:09 EST 2011</p></blockquote>
<p>This will give you who and when compiled the kernel and what gcc compiler was used to build it.</p>
<blockquote><p># rpm -q kernel<br />
kernel-2.6.18-194.11.3.el5<br />
kernel-2.6.18-194.26.1.el5<br />
kernel-2.6.18-194.32.1.el5</p></blockquote>
<p>This will list all the kernels installed on your system. </p>
<p>If the new kernel causes issues then you have the option to revert to the older version.  You may have to boot the system with the boot media and re-configure the boot loader. The AMD and Intel architecture uses GRUB boot loader.  You will need to make changes to /boot/grub/grub.conf  to activate a different default kernel.</p>
<p>Please not that when the kernel is installed using rpm, the kernel package creates an entry in the boot loader configuration file for the new kernel.  But the rpm does not configure the new kernel to boot as the default kernel, this must be done manually.</p>
<p>Below is an example of /boot/grub/grub.conf.  The directive default=0 means that default boot kernel is 0, which is the first stanza that starts with the title entry.</p>
<p>So in this case title CentOS (2.6.18-194.32.1.el5) is stanza 0.  When the system boots this kernel will be used.  The title contains the kernel version number 2.6.18-194.32.1.el5, which must match with the version number in the kernel /vmlinuz-2.6.18-194.32.1.el5 (this is the line below root. </p>
<p>If a separate /boot/ partition was created, the paths to the kernel and the initramfs image are relative to /boot/. This is the case in Example 23.2, “/boot/grub/grub.conf”, above. Therefore the initrd /initramfs-2.6.32-22.el6.x86_64.img line in the first kernel stanza means that the initramfs image is actually located at /boot/initramfs-2.6.32-22.el6.x86_64.img when the root file system is mounted, and likewise for the kernel path (for example: kernel /vmlinuz-2.6.32-22.el6.x86_64) in each stanza of grub.conf</p>
<p>To clarify further, stanza 0 starts with title CentOS (2.6.18-194.32.1.el5)<br />
Stanza 1 starts with title CentOS (2.6.18-194.26.1.el5)<br />
Stanza 2 is title CentOS (2.6.18-194.11.3.el5)</p>
<p>To change the default boot kernel to stanza 2 simply change the line default=0 to default=2.</p>
<blockquote><p># grub.conf generated by anaconda<br />
#<br />
# Note that you do not have to rerun grub after making changes to this file<br />
# NOTICE:  You have a /boot partition.  This means that<br />
#          all kernel and initrd paths are relative to /boot/, eg.<br />
#          root (hd0,0)<br />
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00<br />
#          initrd /initrd-version.img<br />
#boot=/dev/sda<br />
default=0<br />
timeout=5<br />
splashimage=(hd0,0)/grub/splash.xpm.gz<br />
hiddenmenu<br />
title CentOS (2.6.18-194.32.1.el5)<br />
        root (hd0,0)<br />
        kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet<br />
        initrd /initrd-2.6.18-194.32.1.el5.img<br />
title CentOS (2.6.18-194.26.1.el5)<br />
        root (hd0,0)<br />
        kernel /vmlinuz-2.6.18-194.26.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet<br />
        initrd /initrd-2.6.18-194.26.1.el5.img<br />
title CentOS (2.6.18-194.11.3.el5)<br />
        root (hd0,0)<br />
        kernel /vmlinuz-2.6.18-194.11.3.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet<br />
        initrd /initrd-2.6.18-194.11.3.el5.img</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2011/01/identifying-the-kernel-version-and-changing-the-default-boot-kernel-in-redhat-and-centos-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nslookup resolves address but ping is unable to resolve hostname on Unix server</title>
		<link>http://www.gamescheat.ca/2010/11/nslookup-resolves-addpress-but-ping-is-unable-to-resolve-hostname-on-unix-server/</link>
		<comments>http://www.gamescheat.ca/2010/11/nslookup-resolves-addpress-but-ping-is-unable-to-resolve-hostname-on-unix-server/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 14:42:58 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Aix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[SUN]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=844</guid>
		<description><![CDATA[I came across this issue on my newly built Solaris 10 server. I was able to ping a remote machine by Ip address, but not by its hostname. This indicated that I had the correct route and gateway. Using nslookup and dig I verified that the DNS servers were resolving the hostname to IP address. [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this issue on my newly built Solaris 10 server.  I was able to ping a remote machine by Ip address, but not by its hostname. This indicated that I had the correct route and gateway. Using nslookup and dig I verified that the DNS servers were resolving the hostname to IP address.  I confirmed that the file /etc/resolv.conf had the correct syntax for search domain-name.com.</p>
<p>Here is what my /etc/resolv.conf looks like, the two DNS servers are defined correctly as it the search domain.<br />
<strong>domain andrewlin.com<br />
namesserver 10.10.10.11<br />
namesserver 10.10.11.13<br />
search andrewlin.com</strong><br />
The gateway was defined in /etc/defaultrouter.<br />
<strong>10.10.0.1</strong><br />
It seems that ping did not know how to resolve an address.  I was also not able to surf the internet with the Firefox browser in the Sun Java Desktop System for Soalris.  All symptoms indicated that the nsswitch.conf did not have the correct environment defined.  The /etc/nsswitch.conf file defines which services are to used to retrieve information such as hostnames, password files, and group files.  So in this case for the command ping and firefox which wants to resolve and address, it will check the nsswitch.conf file to see what services to use.</p>
<p>Below are the lines I changed in /etc/nsswitch.conf, by adding dns to the end of each lines.<br />
<strong>hosts: files dns<br />
ipnodes: files dns</strong><br />
I am now able to ping and surf the internet without any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2010/11/nslookup-resolves-addpress-but-ping-is-unable-to-resolve-hostname-on-unix-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to map to a remote NFS directory from a VMware ESX 4 server.</title>
		<link>http://www.gamescheat.ca/2010/11/how-to-map-to-a-remote-nfs-directory-from-a-vmware-esx-4-server/</link>
		<comments>http://www.gamescheat.ca/2010/11/how-to-map-to-a-remote-nfs-directory-from-a-vmware-esx-4-server/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 12:00:02 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[VMware ESX]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=842</guid>
		<description><![CDATA[I ran into this error while trying to mount a NFS directory on a remote server from my Vmware ESX4 server. My Vmware esx server is called esx4-server and the remote NFS server is called remote-server. I executed the mount commant and got the below error. [root@esx4-server /]# mount -t nfs remote-server:/home/andrew/mnt mount.nfs: Input/output error [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into this error while trying to mount a NFS directory on a remote server from my Vmware ESX4 server.  My Vmware esx server is called esx4-server and the remote NFS server is called remote-server.<br />
I executed the mount commant and got the below error.<br />
<strong>[root@esx4-server /]# mount -t nfs remote-server:/home/andrew/mnt<br />
mount.nfs: Input/output error</strong><br />
I then decided to use the -v (verbose) option for mount.  This will list the mounting process in verbose, it is better for troubleshooting.<br />
<strong>[root@esx4-server /]# mount -vt nfs remote-server:/home/andrew/mnt<br />
mount: trying 192.20.66.88 prog 100003 vers 3 prot tcp port 2049<br />
mount: trying 192.20.66.88 prog 100005 vers 3 prot udp port 32794<br />
mount.nfs: Input/output error</strong></p>
<p>I then checked the log files for more information, and below are the messages I saw.<br />
<strong>[root@esx4-server /]# cat /var/log/messages<br />
Oct 26 10:32:30 esx4-server vobd: Oct 26 10:32:30.936: 159470608100us: [esx.problem.vmfs.nfs.mount.connect.failed] Failed to mount to server 192.20.66.88 mount point /VMLibrary/. Error: Unable to connect to NFS server.<br />
Oct 26 11:36:50 esx4-server kernel: [162970.448490] portmap: server localhost not responding, timed out<br />
Oct 26 11:36:50 esx4-server kernel: [162970.453525] RPC: failed to contact portmap (errno -5).</strong><br />
From the log file I was able to determine that the pormap service was not started. It is required to map to a remote NFS directory.  I then proceeded with starting the protmap service.<br />
service portmap start</p>
<p>To esure that the service starts automatically when the server reboots use the below command.<br />
<strong>chkconfig portmap on</strong><br />
You may also have to stop the firewall service on the esx server with the command <strong>service firewall stop</strong>.  To prevent it from starting after a reboot, <strong>chkconfig firewall off</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2010/11/how-to-map-to-a-remote-nfs-directory-from-a-vmware-esx-4-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating RDM to LUN (SAN) mapping on VMware ESX 4, Vcenter.</title>
		<link>http://www.gamescheat.ca/2010/08/creating-rdm-to-lun-san-mapping-on-vmware-esx-4-vcenter/</link>
		<comments>http://www.gamescheat.ca/2010/08/creating-rdm-to-lun-san-mapping-on-vmware-esx-4-vcenter/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 20:42:52 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[VMware ESX]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=830</guid>
		<description><![CDATA[In the past I have written articles about how to create a RDM to LUN disk mapping for VMware ESX 3. http://www.gamescheat.ca/2009/10/scripts-to-automate-the-process-of-identifying-and-compiling-an-rdm-to-lun-mapping-list-for-vmware-esx-30/ and http://www.gamescheat.ca/2009/10/how-to-identify-and-compile-an-rdm-to-lun-mapping-list-for-vmware-esx-30/ The procedure to identify the path for the RDM (raw disk mapping) to LUN (disk on SAN) on Vmware ESX 4 is different from Vmware Esx 3. There are a few [...]]]></description>
			<content:encoded><![CDATA[<p>In the past I have written articles about how to create a RDM to LUN disk mapping for <a href="http://www.gamescheat.ca/2009/10/scripts-to-automate-the-process-of-identifying-and-compiling-an-rdm-to-lun-mapping-list-for-vmware-esx-30/">VMware ESX 3</a>.<br />
<a href="http://www.gamescheat.ca/2009/10/scripts-to-automate-the-process-of-identifying-and-compiling-an-rdm-to-lun-mapping-list-for-vmware-esx-30/">http://www.gamescheat.ca/2009/10/scripts-to-automate-the-process-of-identifying-and-compiling-an-rdm-to-lun-mapping-list-for-vmware-esx-30/</a> and <a href="http://www.gamescheat.ca/2009/10/how-to-identify-and-compile-an-rdm-to-lun-mapping-list-for-vmware-esx-30/">http://www.gamescheat.ca/2009/10/how-to-identify-and-compile-an-rdm-to-lun-mapping-list-for-vmware-esx-30/</a></p>
<p>The procedure to identify the path for the RDM (raw disk mapping) to LUN (disk on SAN) on Vmware ESX 4 is different from Vmware Esx 3.  There are a few more steps in version 4.  I will explain below how to determine the path for RDM to LUN in ESX 4.</p>
<p>Login to the console with root permission.</p>
<blockquote><p># find /vmfs/volumes -name **-rdm**<br />
/vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1-rdmp.vmdk</p></blockquote>
<p>Find all RDM file in .vmfs/volumes. Remove -rdmp from the result and that is the path you need for the next step.</p>
<blockquote><p># vmkfstools -q /vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1.vmdk<br />
Disk /vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1.vmdk is a Passthrough Raw Device Mapping<br />
Maps to: vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56</p></blockquote>
<p>Use the vmkfstools -q command to find the vml id of the LUN, it is vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56.</p>
<blockquote><p># esxcfg-scsidevs -u | grep vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56<br />
naa.60060e80058c7b0000008c7b0000310b                            vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56</p></blockquote>
<p>Now use the esxcfg-scsidevs command to find the Network Addressing Authority identifier (naa) for the LUN.</p>
<blockquote><p># esxcfg-mpath -l &#8211;device=naa.60060e80058c7b0000008c7b0000310b<br />
fc.2001001b3232c093:2101001b3232c093-fc.50060e80058c7b55:50060e80058c7b55-naa.60060e80058c7b0000008c7b0000310b<br />
   Runtime Name: vmhba2:C0:T0:L10<br />
   Device: naa.60060e80058c7b0000008c7b0000310b<br />
   Device Display Name: HITACHI Fibre Channel Disk (naa.60060e80058c7b0000008c7b0000310b)<br />
   Adapter: vmhba2 Channel: 0 Target: 0 LUN: 10<br />
   Adapter Identifier: fc.3001001b3232c093:2101001b3232c093<br />
   Target Identifier: fc.60060e80058c7b55:50060e80058c7b55<br />
   Plugin: NMP<br />
   State: active<br />
   Transport: fc<br />
   Adapter Transport Details: WWNN: 22:01:00:1b:32:32:c0:93 WWPN: 23:01:00:1b:32:32:c0:93<br />
   Target Transport Details: WWNN: 55:06:0e:80:05:8c:7b:55 WWPN: 56:06:0e:80:05:8c:7b:55</p>
<p>fc.2000001b3212c093:2100001b3212c093-fc.50060e80058c7b45:50060e80058c7b45-naa.60060e80058c7b0000008c7b0000310b<br />
   Runtime Name: vmhba1:C0:T0:L10<br />
   Device: naa.60060e80058c7b0000008c7b0000310b<br />
   Device Display Name: HITACHI Fibre Channel Disk (naa.60060e80058c7b0000008c7b0000310b)<br />
   Adapter: vmhba1 Channel: 0 Target: 0 LUN: 10<br />
   Adapter Identifier: fc.3000001b3212c093:2100001b3212c093<br />
   Target Identifier: fc.60060e80058c7b45:50060e80058c7b45<br />
   Plugin: NMP<br />
   State: active<br />
   Transport: fc<br />
   Adapter Transport Details: WWNN: 22:00:00:1b:32:12:c0:93 WWPN: 23:00:00:1b:32:12:c0:93<br />
   Target Transport Details: WWNN: 55:06:0e:80:05:8c:7b:45 WWPN: 56:06:0e:80:05:8c:7b:45</p></blockquote>
<p>The esxcfg-mpath -l command generates the detailed information for the LUN.  Because there are redundant path to the LUN on the SAN, the result is listed twice with different fiber channel HBA interfaces.</p>
<p>Now what if your VMware ESX server is hosting many servers all with different RDMs.  It would be very tedious to manually compile a report for RDM to LUN mapping.  I create a script that will automatically do all the above steps and will output the result to screen or you can redirect the result to a file.  This will script will search for all the RDMs and create the mappings.  Below is the script and explanation of how it works.</p>
<p><strong><br />
<blockquote>#!/bin/bash<br />
# Andrew Lin<br />
# August 4, 2010<br />
# Pay Andrew Lin lot&#8217;s of money before you<br />
# can use this script</p>
<p>date<br />
hostname</p>
<p>find /vmfs/volumes -name **-rdm** | sed &#8216;s/-rdmp.vmdk/.vmdk/g&#8217; | sed &#8216;s/-rdm.vmdk/.vmdk/g&#8217; | sed &#8216;s/^/vmkfstools -q /g&#8217; >> andrew-disk-map |<br />
chmod 645 andrew-disk-map</p>
<p>file=andrew-disk-map<br />
while read line<br />
do<br />
 $line<br />
 $line | grep vml | sed &#8216;s/.*to:/esxcfg-scsidevs -u | grep/g&#8217; > andrew_lin1</p>
<p>     chmod 755 andrew_lin1<br />
     ./andrew_lin1 | sed &#8216;s/ .*//g&#8217;<br />
     ./andrew_lin1 | sed &#8216;s/ .*//g&#8217; | sed &#8216;s/^/esxcfg-mpath -L &#8211;device=/g&#8217; >andrew_lin2<br />
     # rm andrew_lin1</p>
<p>     chmod 755 andrew_lin2<br />
     ./andrew_lin2<br />
     # rm andrew_lin2</p>
<p> echo -e &#8220;\n&#8221;<br />
done <$file</p></blockquote>
<p></strong></p>
<p>I will explain below what the above script does.</p>
<blockquote><p>find /vmfs/volumes -name **-rdm**<br />
/vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1-rdmp.vmdk</p></blockquote>
<p>Search for all RDM (raw disk mapping), VMware1_1-rdmp.vmdk is found.</p>
<blockquote><p>sed &#8216;s/-rdmp.vmdk/.vmdk/g&#8217;</p></blockquote>
<p>Change the characters -rdmp.vmdk to .vmdk. The s/ means to substitute, and /g means globally apply the changes for all matches. Some RDM have the -rdmp.vmdk extension (not shown in the above example).</p>
<blockquote><p>sed &#8216;s/-rdm.vmdk/.vmdk/g&#8217;</p></blockquote>
<p>Change -rdm.vmdk to .vmdk for all matches.</p>
<blockquote><p>sed &#8216;s/^/vmkfstools -q /g&#8217;</p></blockquote>
<p>Add the command vmkfstools -q to the beginning of each line.</p>
<blockquote><p>>> andrew-disk-map | chmod 645 andrew-disk-map</p></blockquote>
<p>Redirect the output to the file andrew-disk-map.  Change the file permission to 645 to make it executable.</p>
<p>Below is the result of the above command stored in andrew-disk-map.</p>
<blockquote><p>vmkfstools -q /vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1.vmdk</p></blockquote>
<blockquote><p>file=andrew-disk-map</p></blockquote>
<p>Define the variable called file which contains the name of the file andrew-disk-map.</p>
<blockquote><p>while read line<br />
do<br />
 ..<br />
 &#8230;<br />
 &#8230;.<br />
done <$file</p></blockquote>
<p>The while loop will read the contents of the file defined in the variable $file (which is andrew-disk-map).  The file is read one line at a time and the commands defined within the while loop are executed for each line read.</p>
<blockquote><p>$line</p></blockquote>
<p>Execute the line read from the file andrew-disk-map and send the output to screen.</p>
<blockquote><p><strong>Command</strong><br />
vmkfstools -q /vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1.vmdk<br />
<strong>Output</strong><br />
Disk /vmfs/volumes/4c20ca1e-d32d6ed6-96cb-001e4f3fdc36/VMware1/VMware1_1.vmdk is a Passthrough Raw Device Mapping<br />
Maps to: vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56</p></blockquote>
<blockquote><p>$line | grep vml | sed &#8216;s/.*to:/esxcfg-scsidevs -u | grep/g&#8217; > andrew_lin1</p></blockquote>
<p>Grep will find the line that contains the characters vml,  this is the unique LUN id.  Replace all characters before and upto the characters to: with esxcfg-scsidevs -u | grep.  The result will look like the below line which is redirected to the file andrew_lin1.</p>
<blockquote><p>esxcfg-scsidevs -u | grep vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56</p></blockquote>
<blockquote><p>chmod 755 andrew_lin1</p></blockquote>
<p>Chmod 755 will make the file andrew_lin1 executable.</p>
<blockquote><p>./andrew_lin1 | sed &#8216;s/ .*//g&#8217;</p></blockquote>
<p>Execute the file andrew_lin1.  Sed &#8216;s/ .*//g&#8217; will delete everything after the first space found, otherwise the output will look like the below.</p>
<blockquote><p><strong>Command executed (this is the content of the file andrew_lin1).</strong><br />
esxcfg-scsidevs -u | grep vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56<br />
<strong>Output</strong><br />
naa.60060e80058c7b0000008c7b0000310b                            vml.02000a000060060e80058c7b0000008c7b0000310b4f50454e2d56</p></blockquote>
<blockquote><p>./andrew_lin1 | sed &#8216;s/ .*//g&#8217; | sed &#8216;s/^/esxcfg-mpath -l &#8211;device=/g&#8217; >andrew_lin2</p></blockquote>
<p>Execute the file andrew_lin1, from the result remove everything after the LUN ID number (naa.60060e80058c7b0000008c7b0000310b). Then add the command esxcfg-mpath -L &#8211;device= in front of the LUN ID number, see below example.  The output is redirected to the file andrew_lin2.<br />
esxcfg-mpath -l &#8211;device=naa.60060e80058c7b0000008c7b0000310b</p>
<blockquote><p># rm andrew_lin1</p></blockquote>
<p>You are done with file andrew_lin1 and can delete it. If you want to save the file for troubleshooting then comment out the above line with the # sign.</p>
<blockquote><p>chmod 755 andrew_lin2</p></blockquote>
<p>Make the file andrew_lin2 executable.</p>
<blockquote><p>./andrew_lin2</p></blockquote>
<p>Execute andrew_lin2.  Which contains the command esxcfg-mpath -l &#8211;device=naa.60060e80058c7b0000008c7b0000310b.  The output below is displayed on screen.  Notice that there are redundant paths to the LUN on the SAN.</p>
<blockquote><p>fc.2001001b3232c093:2101001b3232c093-fc.50060e80058c7b55:50060e80058c7b55-naa.60060e80058c7b0000008c7b0000310b<br />
   Runtime Name: vmhba2:C0:T0:L10<br />
   Device: naa.60060e80058c7b0000008c7b0000310b<br />
   Device Display Name: HITACHI Fibre Channel Disk (naa.60060e80058c7b0000008c7b0000310b)<br />
   Adapter: vmhba2 Channel: 0 Target: 0 LUN: 10<br />
   Adapter Identifier: fc.3001001b3232c093:2101001b3232c093<br />
   Target Identifier: fc.60060e80058c7b55:50060e80058c7b55<br />
   Plugin: NMP<br />
   State: active<br />
   Transport: fc<br />
   Adapter Transport Details: WWNN: 22:01:00:1b:32:32:c0:93 WWPN: 23:01:00:1b:32:32:c0:93<br />
   Target Transport Details: WWNN: 55:06:0e:80:05:8c:7b:55 WWPN: 56:06:0e:80:05:8c:7b:55</p>
<p>fc.2000001b3212c093:2100001b3212c093-fc.50060e80058c7b45:50060e80058c7b45-naa.60060e80058c7b0000008c7b0000310b<br />
   Runtime Name: vmhba1:C0:T0:L10<br />
   Device: naa.60060e80058c7b0000008c7b0000310b<br />
   Device Display Name: HITACHI Fibre Channel Disk (naa.60060e80058c7b0000008c7b0000310b)<br />
   Adapter: vmhba1 Channel: 0 Target: 0 LUN: 10<br />
   Adapter Identifier: fc.3000001b3212c093:2100001b3212c093<br />
   Target Identifier: fc.60060e80058c7b45:50060e80058c7b45<br />
   Plugin: NMP<br />
   State: active<br />
   Transport: fc<br />
   Adapter Transport Details: WWNN: 22:00:00:1b:32:12:c0:93 WWPN: 23:00:00:1b:32:12:c0:93<br />
   Target Transport Details: WWNN: 55:06:0e:80:05:8c:7b:45 WWPN: 56:06:0e:80:05:8c:7b:45</p></blockquote>
<blockquote><p># rm andrew_lin2</p></blockquote>
<p>Delete the file andrew_lin2 by removing the # comment.</p>
<blockquote><p>echo -e &#8220;\n&#8221;</p></blockquote>
<p>Enter a line space.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2010/08/creating-rdm-to-lun-san-mapping-on-vmware-esx-4-vcenter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to list the status of swap in Solaris</title>
		<link>http://www.gamescheat.ca/2010/02/how-to-list-the-status-of-swap-in-solaris/</link>
		<comments>http://www.gamescheat.ca/2010/02/how-to-list-the-status-of-swap-in-solaris/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 10:00:36 +0000</pubDate>
		<dc:creator>Andrew Lin</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Aix]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.gamescheat.ca/?p=796</guid>
		<description><![CDATA[List the status of all swap areas. # swap -l swapfile dev swaplo blocks free dev/dsk/c0t0d0s1 32,9 16 8425712 8425712 The output has five columns: path The path name for the swap area. dev The major/minor device number in decimal if it is a block special device; zeroes otherwise. swaplo The swaplow value for the [...]]]></description>
			<content:encoded><![CDATA[<p>List the status of all swap areas.</p>
<blockquote><p># swap -l<br />
swapfile             dev  swaplo blocks   free<br />
dev/dsk/c0t0d0s1   32,9      16 8425712 8425712</p></blockquote>
<p>The  output  has five columns:<br />
path<br />
The path name for the swap area.</p>
<p>dev<br />
The major/minor device number in decimal if it is a block special device; zeroes otherwise.</p>
<p>swaplo<br />
The swaplow value for the area in 512-byte blocks.</p>
<p>blocks<br />
The swaplen value for the area in 512-byte blocks.</p>
<p>free<br />
The number of 512-byte blocks in this area that are not currently allocated.</p>
<p>To find the status of total swap usage use the -s option.</p>
<blockquote><p># swap -s<br />
total: 180928k bytes allocated + 28456k reserved = 209384k used, 10691424k available     </p></blockquote>
<p>List the status of all the swap areas. The output has five columns:</p>
<p>path<br />
The path name for the swap area.</p>
<p>dev<br />
The major/minor device number in decimal if it is a block special device; zeroes otherwise.</p>
<p>swaplo<br />
The swaplow value for the area in 512-byte blocks.</p>
<p>blocks<br />
The swaplen value for the area in 512-byte blocks.</p>
<p>free<br />
The number of 512-byte blocks in this area that are not currently allocated.</p>
<p>The total amount of swap space in bytes currently allocated for use as backing store.</p>
<p>reserved<br />
The total amount of swap space in bytes not currently allocated, but claimed by memory mappings for possible future use.</p>
<p>used<br />
The total amount of swap space in bytes that is either allocated or reserved.</p>
<p>available<br />
The total swap space in bytes that is currently available for future reservation and allocation.</p>
<p>These   numbers include swap space from all configured swap areas as listed by the -l option, as well swap space in the form of physical memory.                                                                                                                                  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamescheat.ca/2010/02/how-to-list-the-status-of-swap-in-solaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

