<?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/"
	>

<channel>
	<title>UtahSysAdmin.com &#187; Technical</title>
	<atom:link href="http://www.utahsysadmin.com/category/Technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.utahsysadmin.com</link>
	<description>Ramblings of a Utah System Administrator</description>
	<pubDate>Tue, 30 Dec 2008 04:59:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Solaris 8: Bad Superblock at block 16</title>
		<link>http://www.utahsysadmin.com/2008/12/29/solaris-8-bad-superblock/</link>
		<comments>http://www.utahsysadmin.com/2008/12/29/solaris-8-bad-superblock/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 04:59:45 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=127</guid>
		<description><![CDATA[This weekend I got the joy of rebuilding a Solaris 8 server from scratch with backups.  I had another server of the same hardware available to use for the restore, except it had Solaris 9 mirrored across 2 hard drives.  Someday, I&#8217;ll go through and document the whole process, but basically I broke [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I got the joy of rebuilding a Solaris 8 server from scratch with backups.  I had another server of the same hardware available to use for the restore, except it had Solaris 9 mirrored across 2 hard drives.  Someday, I&#8217;ll go through and document the whole process, but basically I broke the mirror, repartitioned the second drive, mounted the new partitions inside of the Solaris 9 environment, restored the data and rebooted off the drive with the restored data.</p>
<p>The interesting thing that I found that I wanted to post about was the corruption of the Solaris 8 superblock that was caused by mounting the partitions within Solaris 9.  There were changes made in fsck on Solaris 9 that made the superblock incompatible with Solaris 8.  When you boot off of a Solaris 8 partition that has been mounted by Solaris 9, you&#8217;ll get the following errors:</p>
<blockquote><p>The / file system (/dev/rdsk/c0t2d0s0) is being checked.<br />
/dev/rdsk/c0t2d0s0: BAD SUPERBLOCK AT BLOCK 16: BAD VALUES IN SUPER BLOCK<br />
/dev/rdsk/c0t2d0s0: USE AN ALTERNATE SUPERBLOCK TO SUPPLY NEEDED INFORMATION;<br />
/dev/rdsk/c0t2d0s0: e.g. fsck [-F ufs] -o b=# [special ...]<br />
/dev/rdsk/c0t2d0s0: where # is the alternate super block. SEE fsck_ufs(1M).</p>
<p>/dev/rdsk/c0t2d0s0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.</p>
<p>WARNING - Unable to repair the / filesystem. Run fsck<br />
manually (fsck -F ufs /dev/rdsk/c0t2d0s0). Exit the shell when<br />
done to continue the boot process.</p></blockquote>
<p>Of course, the drive path may be different, etc.  The solution to this is simple, run fsck and restore the superblock from one of it&#8217;s backups - in this case I restored from block 32:</p>
<blockquote><p>fsck -F ufs -y -o b=32 /dev/rdsk/c0t2d0s0</p></blockquote>
<p>Run this on each of the affected partitions (all the partitions that you mounted) and you are good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/12/29/solaris-8-bad-superblock/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Postfix fails to shutdown on Linux VM</title>
		<link>http://www.utahsysadmin.com/2008/12/15/postfix-fails-to-shutdown-on-linux-vm/</link>
		<comments>http://www.utahsysadmin.com/2008/12/15/postfix-fails-to-shutdown-on-linux-vm/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 18:25:03 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=113</guid>
		<description><![CDATA[So I had a problem with a RHEL5 clone (OEL5) Linux VM that would not shutdown postfix correctly on either a powerdown or on a reboot.  Here&#8217;s the error I saw:
Dec 15 16:43:01 testvm postfix[3160]: fatal: could not find any active network interfaces
Dec 15 16:44:04 testvm postfix/postfix-script: starting the Postfix mail system
Dec 15 16:44:04 [...]]]></description>
			<content:encoded><![CDATA[<p>So I had a problem with a RHEL5 clone (OEL5) Linux VM that would not shutdown postfix correctly on either a powerdown or on a reboot.  Here&#8217;s the error I saw:</p>
<blockquote><p>Dec 15 16:43:01 testvm postfix[3160]: fatal: could not find any active network interfaces<br />
Dec 15 16:44:04 testvm postfix/postfix-script: starting the Postfix mail system<br />
Dec 15 16:44:04 testvm postfix/master[1995]: daemon started &#8212; version 2.3.3, configuration /etc/postfix</p></blockquote>
<p>The first trick was realizing that the error was being generated during the shutdown and not during startup.    I had checked through my main.cf and verified my /etc/hosts several times thinking that I had some configuration problem within Postfix itself.  A virtual machine reboots so fast it&#8217;s very easy to miss a reboot within the timestamps.</p>
<p>This VM had the VMware Tools installed and apparently when you install the tools, it sets the priority on shutdown of the tools to be 08.  The VMware Tools shutdown the network interfaces and a priority of 08 is way too early to be shutting down the network interfaces.  Postfix is set to shutdown at 30 and normal Linux network interfaces are shutdown at 90.  So, to fix this issue I simply changed the priority of the VMware Tools shutdown to 89:</p>
<blockquote><p>mv /etc/rc0.d/K08vmware-tools /etc/rc0.d/K89vmware-tools<br />
mv /etc/rc6.d/K08vmware-tools /etc/rc6.d/K89vmware-tools</p></blockquote>
<p>I&#8217;m sure there is probably some way to do this through chkconfig or something, but sometimes it&#8217;s easier to do it the old fashioned way.  Here&#8217;s my guess on how you would do it through chkconfig:</p>
<blockquote><p>chkconfig vmware-tools off<br />
vi /etc/init.d/vmware-tools # change chkconfig line from 08 to 89<br />
chkconfig vmware-tools on</p></blockquote>
<p>Of course, if you reinstall VMware Tools, it will probably replace the symlinks again with the default.  Maybe it will even add a second symlink and then you&#8217;ll get more errors.  I&#8217;ll let you know next time I upgrade the tools.</p>
<p>There are several things wrong with the VMware Tools, including it&#8217;s automatic installation of hgfs for folder sharing on a server, which I&#8217;ll post something about later.  I&#8217;m still trying to decide if there is any advantage to installing the tools when there is no GUI, especially with it&#8217;s poor configuration setups.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/12/15/postfix-fails-to-shutdown-on-linux-vm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Add a hard drive in Linux with LVM</title>
		<link>http://www.utahsysadmin.com/2008/10/10/add-a-hard-drive-in-linux-with-lvm/</link>
		<comments>http://www.utahsysadmin.com/2008/10/10/add-a-hard-drive-in-linux-with-lvm/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 03:38:16 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=111</guid>
		<description><![CDATA[I posted last time about modifying the swap space on Linux with LVM and also introduced expanding a file system to match a new larger partition.  Next is to add another drive for data storage.  I&#8217;m just adding one drive, because the drive is actually a virtual drive through VMware that sits on [...]]]></description>
			<content:encoded><![CDATA[<p>I posted last time about <a title="Swap Linux LVM" href="http://www.utahsysadmin.com/2008/10/05/modify-swap-space-in-linux-with-lvm/">modifying the swap space on Linux with LVM</a> and also introduced expanding a file system to match a new larger partition.  Next is to add another drive for data storage.  I&#8217;m just adding one drive, because the drive is actually a virtual drive through VMware that sits on a RAID5 raid group on our SAN.  So redundancy is not really an issue.  This example is from a Red Hat Enterprise (RHEL5) clone and is using Logical Volume Management (LVM), but should be usable in other Linux distributions.</p>
<p>Since this is a VM, I simply attached a new blank hard drive through VirtualCenter.  Now, of course, I could have rebooted the server to pick up the new drive, but what fun is that?  So, the question then became, how do you detect a new hard drive without rebooting in Linux?  Currently, it looks like this:</p>
<blockquote><p># cat /proc/scsi/scsi<br />
Attached devices:<br />
Host: scsi0 Channel: 00 Id: 00 Lun: 00<br />
Vendor: VMware   Model: Virtual disk     Rev: 1.0<br />
Type:   Direct-Access                    ANSI SCSI revision: 02</p></blockquote>
<p>In Solaris, you simply run devfsadm.  In Linux, you just need to have the OS rescan the SCSI bus.  To do this, we utilize the /proc file system.  Determine what the parameters of the new SCSI drive are and the run the following command:</p>
<blockquote><p># echo &#8220;scsi add-single-device 0 0 1 0&#8243; &gt; /proc/scsi/scsi</p></blockquote>
<p>The four numbers in order are host, channel, id, and LUN.  Now, when we check we see the new drive:</p>
<blockquote><p># cat /proc/scsi/scsi<br />
Attached devices:<br />
Host: scsi0 Channel: 00 Id: 00 Lun: 00<br />
Vendor: VMware   Model: Virtual disk     Rev: 1.0<br />
Type:   Direct-Access                    ANSI SCSI revision: 02<br />
Host: scsi0 Channel: 00 Id: 01 Lun: 00<br />
Vendor: VMware   Model: Virtual disk     Rev: 1.0<br />
Type:   Direct-Access                    ANSI SCSI revision: 02</p></blockquote>
<p>At the same time, you will see the following lines in /var/log/messages:</p>
<blockquote><p>kernel:   Vendor: VMware    Model: Virtual disk      Rev: 1.0<br />
kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02<br />
kernel:  target0:0:1: Beginning Domain Validation<br />
kernel:  target0:0:1: Domain Validation skipping write tests<br />
kernel:  target0:0:1: Ending Domain Validation<br />
kernel:  target0:0:1: FAST-160 WIDE SCSI 320.0 MB/s DT IU RDSTRM RTI WRFLOW PCOMP (6.25 ns, offset 127)<br />
kernel: SCSI device sdb: 104857600 512-byte hdwr sectors (53687 MB)</p></blockquote>
<p>Since this is a brand new drive, we need to setup any partitions we would like on the drive.  If you&#8217;re not sure what the name of the drive is, you can always do a fdisk -l first:</p>
<blockquote><p># fdisk -l<br />
Disk /dev/sda: 12.8 GB, 12884901888 bytes<br />
255 heads, 63 sectors/track, 1566 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          13      104391   83  Linux<br />
/dev/sda2              14        1566    12474472+  8e  Linux LVM</p>
<p>Disk /dev/sdb: 53.6 GB, 53687091200 bytes<br />
255 heads, 63 sectors/track, 6527 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p><strong>Disk /dev/sdb doesn&#8217;t contain a valid partition table</strong></p></blockquote>
<p>Go ahead and setup the partitions, I just need one:</p>
<blockquote><p># fdisk /dev/sdb<br />
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel<br />
Building a new DOS disklabel. Changes will remain in memory only,<br />
until you decide to write them. After that, of course, the previous<br />
content won&#8217;t be recoverable.</p>
<p>The number of cylinders for this disk is set to 6527.<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)<br />
Warning: invalid flag 0&#215;0000 of partition table 4 will be corrected by w(rite)</p>
<p>Command (m for help): <strong>n</strong><br />
Command action<br />
e   extended<br />
p   primary partition (1-4)<br />
<strong> p</strong><br />
Partition number (1-4): <strong>1</strong><br />
First cylinder (1-6527, default 1):<br />
Using default value 1<br />
Last cylinder or +size or +sizeM or +sizeK (1-6527, default 6527):<br />
Using default value 6527</p>
<p>Command (m for help): <strong>p</strong></p>
<p>Disk /dev/sdb: 53.6 GB, 53687091200 bytes<br />
255 heads, 63 sectors/track, 6527 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdb1               1        6527    52428096   83  Linux</p>
<p>Command (m for help): <strong>w</strong><br />
The partition table has been altered!</p>
<p>Calling ioctl() to re-read partition table.<br />
Syncing disks.</p></blockquote>
<p>Now you can see the partitions are defined:</p>
<blockquote><p># fdisk -l<br />
Disk /dev/sda: 12.8 GB, 12884901888 bytes<br />
255 heads, 63 sectors/track, 1566 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          13      104391   83  Linux<br />
/dev/sda2              14        1566    12474472+  8e  Linux LVM</p>
<p>Disk /dev/sdb: 53.6 GB, 53687091200 bytes<br />
255 heads, 63 sectors/track, 6527 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdb1               1        6527    52428096   83  Linux</p></blockquote>
<p>Now, if you don&#8217;t have LVM, you would just make the new file system on the physical drive.  (If you are using LVM, don&#8217;t do this, skip to the next step.)</p>
<blockquote><p># mkfs.ext3 /dev/sdb1<br />
mke2fs 1.39 (29-May-2006)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
6553600 inodes, 13107024 blocks<br />
655351 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
Maximum filesystem blocks=0<br />
400 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
16384 inodes per group<br />
Superblock backups stored on blocks:<br />
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,<br />
4096000, 7962624, 11239424</p>
<p>Writing inode tables: done<br />
Creating journal (32768 blocks): done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 22 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.</p></blockquote>
<p>Since we have LVM, we will be using that instead.  Using lvmscan, we can see that the new partition is available:</p>
<blockquote><p># lvmdiskscan<br />
&#8230;skip&#8230;<br />
/dev/sdb                 [       50.00 GB]<br />
/dev/sdb1                [       50.00 GB]</p></blockquote>
<p>First step is to turn it into a new physical volume:</p>
<blockquote><p># pvcreate /dev/sdb1<br />
Physical volume &#8220;/dev/sdb1&#8243; successfully created</p></blockquote>
<p>Now we need a volume group and add the physical volume to it:</p>
<blockquote><p># vgcreate VolGroup01 /dev/sdb1<br />
Volume group &#8220;VolGroup01&#8243; successfully created</p></blockquote>
<p>And then create the logical volume (using all of the available space on the volume group):</p>
<blockquote><p># lvcreate -l 100%FREE -n LogVol00 VolGroup01<br />
Logical volume &#8220;LogVol00&#8243; created</p></blockquote>
<p>Now we make the file system on the logical volume:</p>
<blockquote><p># mkfs.ext3 /dev/VolGroup01/LogVol00<br />
mke2fs 1.39 (29-May-2006)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
6553600 inodes, 13106176 blocks<br />
655308 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
Maximum filesystem blocks=0<br />
400 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
16384 inodes per group<br />
Superblock backups stored on blocks:<br />
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,<br />
4096000, 7962624, 11239424</p>
<p>Writing inode tables: done<br />
Creating journal (32768 blocks): done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 31 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.</p></blockquote>
<p>Add the appropriate line to /etc/fstab:</p>
<blockquote><p>/dev/VolGroup01/LogVol00 /data                   ext3    defaults        1 1</p></blockquote>
<p>Create the mount point and mount the new file system:</p>
<blockquote><p># mkdir /data<br />
# mount /data</p></blockquote>
<p>See that it&#8217;s now available to the OS:</p>
<blockquote><p># df -h /data<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/mapper/VolGroup01-LogVol00<br />
50G  180M   47G   1% /data</p></blockquote>
<p>All done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/10/10/add-a-hard-drive-in-linux-with-lvm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modify swap space in Linux (with LVM)</title>
		<link>http://www.utahsysadmin.com/2008/10/05/modify-swap-space-in-linux-with-lvm/</link>
		<comments>http://www.utahsysadmin.com/2008/10/05/modify-swap-space-in-linux-with-lvm/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 17:31:29 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=110</guid>
		<description><![CDATA[I posted a while back how to modify your swap space in Solaris 10, now I will show you how to do it in Linux.  This example is from a Red Hat Enterprise (RHEL5) clone and is using Logical Volume Management (LVM), but should be usable in other Linux distributions and you could use [...]]]></description>
			<content:encoded><![CDATA[<p>I posted a while back how to <a title="Swap space on Solaris 10" href="http://www.utahsysadmin.com/2008/04/10/how-to-add-a-swap-drive-to-solaris-10/">modify your swap space in Solaris 10</a>, now I will show you how to do it in Linux.  This example is from a Red Hat Enterprise (RHEL5) clone and is using Logical Volume Management (LVM), but should be usable in other Linux distributions and you could use fdisk to resize the partition instead of using LVM.  I will specifically show how to reduce swap space here, put is applicable to enlarging it as well.</p>
<p>To see what file system is being used for your current swap space, use proc:</p>
<blockquote><p># cat /proc/swaps<br />
Filename                                Type            Size    Used    Priority<br />
/dev/mapper/VolGroup00-LogVol01         partition       4194296 0       -1</p></blockquote>
<p>And then to see how much swap is in use, run the free command:</p>
<blockquote><p># free<br />
total       used       free     shared    buffers     cached<br />
Mem:        385560      76388     309172          0      11328      33788<br />
-/+ buffers/cache:      31272     354288<br />
Swap:      4194296          0    4194296</p></blockquote>
<p>If your swap space is in use, you will need to reboot into single user mode, shut some applications down until it is free, or add a separate swap drive or file for swap use temporarily.  Once your swap space is free to be modified, turn off the swap space that you want to modify:</p>
<blockquote><p># swapoff -v /dev/VolGroup00/LogVol01<br />
swapoff on /dev/VolGroup00/LogVol01</p></blockquote>
<p>You can now verify that the swap space is no longer in use:</p>
<blockquote><p># free<br />
total       used       free     shared    buffers     cached<br />
Mem:        385560      74404     311156          0      11340      33780<br />
-/+ buffers/cache:      29284     356276<br />
Swap:            0          0          0<br />
# cat /proc/swaps</p></blockquote>
<p>Now that the file system is not is use, we are free to modify it.  In this case, I am reducing the 4 GB set aside for swap to 1 GB so that I can reuse it on my root partition.  Here&#8217;s the layout of my current LVM partitions:</p>
<blockquote><p># lvdisplay<br />
&#8212; Logical volume &#8212;<br />
LV Name                /dev/VolGroup00/LogVol00<br />
VG Name                VolGroup00<br />
LV UUID                jzjdTT-Md9K-iP52-3kv4-OqSL-2Y0c-yxUq7o<br />
LV Write Access        read/write<br />
LV Status              available<br />
# open                 1<br />
LV Size                7.88 GB<br />
Current LE             252<br />
Segments               1<br />
Allocation             inherit<br />
Read ahead sectors     0<br />
Block device           253:0</p>
<p>&#8212; Logical volume &#8212;<br />
LV Name                /dev/VolGroup00/LogVol01<br />
VG Name                VolGroup00<br />
LV UUID                ixEabw-7lMg-ho6h-GcVq-pEOE-rHPb-X3HY3e<br />
LV Write Access        read/write<br />
LV Status              available<br />
# open                 1<br />
LV Size                4.00 GB<br />
Current LE             128<br />
Segments               1<br />
Allocation             inherit<br />
Read ahead sectors     0<br />
Block device           253:1</p></blockquote>
<p>Now to shrink the swap space partition.  The fact that shrinking the partition is destructive doesn&#8217;t matter since it is just swap space anyway:</p>
<blockquote><p># lvm lvreduce /dev/VolGroup00/LogVol01 -L -3G<br />
WARNING: Reducing active logical volume to 1.00 GB<br />
THIS MAY DESTROY YOUR DATA (filesystem etc.)<br />
Do you really want to reduce LogVol01? [y/n]: y<br />
Reducing logical volume LogVol01 to 1.00 GB<br />
Logical volume LogVol01 successfully resized</p></blockquote>
<p>And now to extend the root partition.  (You can increase the size while the partition is in use and it is non-destructive.):</p>
<blockquote><p># lvm lvextend -l +100%FREE /dev/VolGroup00/LogVol00<br />
Extending logical volume LogVol00 to 10.88 GB<br />
Logical volume LogVol00 successfully resized</p></blockquote>
<p>Let&#8217;s take a look at the new partition sizes:</p>
<blockquote><p># lvdisplay<br />
&#8212; Logical volume &#8212;<br />
LV Name                /dev/VolGroup00/LogVol00<br />
VG Name                VolGroup00<br />
LV UUID                jzjdTT-Md9K-iP52-3kv4-OqSL-2Y0c-yxUq7o<br />
LV Write Access        read/write<br />
LV Status              available<br />
# open                 1<br />
LV Size                10.88 GB<br />
Current LE             348<br />
Segments               2<br />
Allocation             inherit<br />
Read ahead sectors     0<br />
Block device           253:0</p>
<p>&#8212; Logical volume &#8212;<br />
LV Name                /dev/VolGroup00/LogVol01<br />
VG Name                VolGroup00<br />
LV UUID                ixEabw-7lMg-ho6h-GcVq-pEOE-rHPb-X3HY3e<br />
LV Write Access        read/write<br />
LV Status              available<br />
# open                 0<br />
LV Size                1.00 GB<br />
Current LE             32<br />
Segments               1<br />
Allocation             inherit<br />
Read ahead sectors     0<br />
Block device           253:1</p></blockquote>
<p>Now to remake the smaller partition into usable swap space:</p>
<blockquote><p># mkswap /dev/VolGroup00/LogVol01<br />
Setting up swapspace version 1, size = 1073737 kB</p></blockquote>
<p>And then re-add it back to the OS as usable swap space:</p>
<blockquote><p># swapon -va<br />
swapon on /dev/VolGroup00/LogVol01</p></blockquote>
<p>Verify that the swap space is back:</p>
<blockquote><p># cat /proc/swaps<br />
Filename                                Type            Size    Used    Priority<br />
/dev/mapper/VolGroup00-LogVol01         partition       1048568 0       -2</p>
<p># free<br />
total       used       free     shared    buffers     cached<br />
Mem:        385560      76156     309404          0      11668      35036<br />
-/+ buffers/cache:      29452     356108<br />
Swap:      1048568          0    1048568</p></blockquote>
<p>Let&#8217;s go ahead and resize the actual file system on the root partition to take into account the newly available space.  First, a before snapshot:</p>
<blockquote><p># df -h /<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
7.7G  764M  6.5G  11% /</p></blockquote>
<p>Now to increase it.  Note, that if you do not specify a new size, it will automatically fill up to the maximum size of the underlying partition:</p>
<blockquote><p># resize2fs -p /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 2850816 (4k) blocks.<br />
The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 2850816 blocks long.</p></blockquote>
<p>Verify the new size:</p>
<blockquote><p># df -h /<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/mapper/VolGroup00-LogVol00<br />
11G  766M  9.3G   8% /</p></blockquote>
<p>Next post I&#8217;ll explain how to add a second drive to this system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/10/05/modify-swap-space-in-linux-with-lvm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Resyncing a failed SVM Miror</title>
		<link>http://www.utahsysadmin.com/2008/09/29/resyncing-a-failed-svm-mirror/</link>
		<comments>http://www.utahsysadmin.com/2008/09/29/resyncing-a-failed-svm-mirror/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 04:14:08 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=109</guid>
		<description><![CDATA[So in my last post, I replaced a failed hard drive.  What if the drive isn&#8217;t bad?  Maybe the mirror just got out of sync for some other reason.  As I mentioned previously, sometimes metastat, iostat and cfgadm will still show the failed drive.  In this case, it is very possible [...]]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/">in my last post</a>, I replaced a failed hard drive.  What if the drive isn&#8217;t bad?  Maybe the mirror just got out of sync for some other reason.  As I mentioned previously, sometimes metastat, iostat and cfgadm will still show the failed drive.  In this case, it is very possible that the hard drive is still functional.</p>
<p>So, here&#8217;s how you can analyze the hard drive to verify that it is still good and then resync your mirror that was built through Solaris Volume Manager on Solaris 9. First we check metastat and find the failed mirrors and the bad drive is  c1t0d0.  The line showing the failed drive at the bottom (in bold) is often missing when the drive is dead.  On this failure the drive is still visible and may be reusable.</p>
<blockquote><p># metastat<br />
d7: Mirror<br />
Submirror 0: d17<br />
State: Needs maintenance<br />
Submirror 1: d27<br />
State: Okay<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 48049848 blocks (22 GB)</p>
<p>d17: Submirror of d7<br />
State: Needs maintenance<br />
Invoke: metareplace d7 c1t0d0s7 &lt;new device&gt;<br />
Size: 48049848 blocks (22 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t0d0s7          0     No     Maintenance   Yes</p>
<p>d27: Submirror of d7<br />
State: Okay<br />
Size: 48049848 blocks (22 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t1d0s7          0     No            Okay   Yes</p>
<p>d3: Mirror<br />
Submirror 0: d13<br />
State: Needs maintenance<br />
Submirror 1: d23<br />
State: Okay<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 8386767 blocks (4.0 GB)</p>
<p>d13: Submirror of d3<br />
State: Needs maintenance<br />
Invoke: metareplace d3 c1t0d0s3 &lt;new device&gt;<br />
Size: 8386767 blocks (4.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t0d0s3          0     No     Maintenance   Yes</p>
<p>d23: Submirror of d3<br />
State: Okay<br />
Size: 8386767 blocks (4.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t1d0s3          0     No            Okay   Yes</p>
<p>d1: Mirror<br />
Submirror 0: d11<br />
State: Needs maintenance<br />
Submirror 1: d21<br />
State: Okay<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 6292242 blocks (3.0 GB)</p>
<p>d11: Submirror of d1<br />
State: Needs maintenance<br />
Invoke: metareplace d1 c1t0d0s1 &lt;new device&gt;<br />
Size: 6292242 blocks (3.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t0d0s1          0     No     Maintenance   Yes</p>
<p>d21: Submirror of d1<br />
State: Okay<br />
Size: 6292242 blocks (3.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t1d0s1          0     No            Okay   Yes</p>
<p>d0: Mirror<br />
Submirror 0: d10<br />
State: Needs maintenance<br />
Submirror 1: d20<br />
State: Okay<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 8386767 blocks (4.0 GB)</p>
<p>d10: Submirror of d0<br />
State: Needs maintenance<br />
Invoke: metareplace d0 c1t0d0s0 &lt;new device&gt;<br />
Size: 8386767 blocks (4.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t0d0s0          0     No     Maintenance   Yes</p>
<p>d20: Submirror of d0<br />
State: Okay<br />
Size: 8386767 blocks (4.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c1t1d0s0          0     No            Okay   Yes</p>
<p>Device Relocation Information:<br />
Device   Reloc  Device ID<br />
c1t1d0   Yes    id1,sd@SSEAGATE_ST336607LSUN36G_3JA1WZCX00007348J389<br />
<strong>c1t0d0   Yes    id1,sd@SSEAGATE_ST336607LSUN36G_3JA1B1CW00007337MZU9</strong></p></blockquote>
<p>And then we check with iostat.  We can also see the failed drive in this output and that it has no errors.  Often failed drives will contain invalid or incomplete information:</p>
<blockquote><p># iostat -En<br />
<strong> c1t0d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0<br />
Vendor: SEAGATE  Product: ST336607LSUN36G  Revision: 0207 Serial No: 0312A1B1CW<br />
Size: 36.42GB &lt;36418595328 bytes&gt;<br />
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0<br />
Illegal Request: 0 Predictive Failure Analysis: 0<br />
</strong> c1t1d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0<br />
Vendor: SEAGATE  Product: ST336607LSUN36G  Revision: 0207 Serial No: 0322A1WZCX<br />
Size: 36.42GB &lt;36418595328 bytes&gt;<br />
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0<br />
Illegal Request: 0 Predictive Failure Analysis: 0</p></blockquote>
<p>Next we see if it&#8217;s available through format and then start testing the drive with a surface analysis:</p>
<blockquote><p># format<br />
AVAILABLE DISK SELECTIONS:<br />
0. c1t0d0 &lt;SUN36G cyl 24620 alt 2 hd 27 sec 107&gt;<br />
/pci@1c,600000/scsi@2/sd@0,0<br />
1. c1t1d0 &lt;SUN36G cyl 24620 alt 2 hd 27 sec 107&gt;<br />
/pci@1c,600000/scsi@2/sd@1,0<br />
Specify disk (enter its number): 0<br />
selecting c1t0d0<br />
format&gt; analyze<br />
analyze&gt; read<br />
Ready to analyze (won&#8217;t harm SunOS). This takes a long time,<br />
but is interruptable with CTRL-C. Continue? y</p>
<p>pass 0<br />
24619/26/53</p>
<p>pass 1<br />
24619/26/53</p>
<p>Total of 0 defective blocks repaired.<br />
analyze&gt; refresh<br />
Ready to analyze (won&#8217;t harm data). This takes a long time,<br />
but is interruptable with CTRL-C. Continue? y</p>
<p>pass 0<br />
24619/26/53</p>
<p>pass 1<br />
24619/26/53</p>
<p>Total of 0 defective blocks repaired.<br />
analyze&gt; test<br />
Ready to analyze (won&#8217;t harm data). This takes a long time,<br />
but is interruptable with CTRL-C. Continue? y</p>
<p>pass 0 - pattern = 0xc6dec6de<br />
24619/26/53</p>
<p>pass 1 - pattern = 0&#215;6db6db6d<br />
24619/26/53</p>
<p>Total of 0 defective blocks repaired.</p></blockquote>
<p>Since everything went well on the analysis, let&#8217;s go ahead and reuse this drive and resync the mirrors.  You&#8217;ll notice that I am using the metareplace command, but it&#8217;s different then recommended in metastat.  You need to use the -e parameter to have it resync the original drive (this can also be used when you have physically replaced the drive as well).</p>
<blockquote><p># metareplace -e d0 c1t0d0s0<br />
d0: device c1t0d0s0 is enabled<br />
# metareplace -e d1 c1t0d0s1<br />
d1: device c1t0d0s1 is enabled<br />
# metareplace -e d3 c1t0d0s3<br />
d3: device c1t0d0s3 is enabled<br />
# metareplace -e d7 c1t0d0s7<br />
d7: device c1t0d0s7 is enabled</p></blockquote>
<p>You can now see that all the mirrors are re-syncing.  Of course, you&#8217;ll want to keep an eye on this server to see if it fails again.</p>
<blockquote><p># metastat | grep -i resync<br />
State: Resyncing<br />
Resync in progress: 0 % done<br />
State: Resyncing<br />
c1t0d0s7          0     No       Resyncing   Yes<br />
State: Resyncing<br />
Resync in progress: 2 % done<br />
State: Resyncing<br />
c1t0d0s3          0     No       Resyncing   Yes<br />
State: Resyncing<br />
Resync in progress: 7 % done<br />
State: Resyncing<br />
c1t0d0s1          0     No       Resyncing   Yes<br />
State: Resyncing<br />
Resync in progress: 21 % done<br />
State: Resyncing<br />
c1t0d0s0          0     No       Resyncing   Yes</p></blockquote>
<p>Don&#8217;t forget to run installboot if you rebuilt your s0 partition as well as re-adding metadevice database replicas if you removed them due to a reboot.  For more info, check my <a href="http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/">previous post</a>.</p>
<blockquote><p># installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0<br />
# metadb -i<br />
flags           first blk       block count<br />
a m  p  luo        16              4096            /dev/dsk/c1t1d0s4<br />
a    p  luo        4112            4096            /dev/dsk/c1t1d0s4<br />
# metadb -a -c 2 c1t0d0s4<br />
# metadb -i<br />
flags           first blk       block count<br />
a m  p  luo        16              4096            /dev/dsk/c1t1d0s4<br />
a    p  luo        4112            4096            /dev/dsk/c1t1d0s4<br />
a        u         16              4096            /dev/dsk/c1t0d0s4<br />
a        u         4112            4096            /dev/dsk/c1t0d0s4</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/09/29/resyncing-a-failed-svm-mirror/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Replacing a hard drive with Solaris Volume Manager</title>
		<link>http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/</link>
		<comments>http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 15:08:06 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=108</guid>
		<description><![CDATA[Last time I posted about my experience replacing a drive in an array created with Veritas Volume Manager.  That was a RAID 0 array that had lost its data immediately when the drive died, so I didn&#8217;t worry about saving the data when rebuilding it.  This time I was rebuilding a RAID 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Last time I posted about my experience <a title="Rebuild drive with Veritas Volume Manager" href="http://www.utahsysadmin.com/2008/09/11/replacing-a-hard-drive-with-veritas-volume-manager/" target="_blank">replacing a drive in an array created with Veritas Volume Manager</a>.  That was a RAID 0 array that had lost its data immediately when the drive died, so I didn&#8217;t worry about saving the data when rebuilding it.  This time I was rebuilding a RAID 1 array that was built with Solaris Volume Manager.  When I lost this hard drive the data was still intact on the existing functional drive and I wanted to keep it that way.  <strong>So as far as disclaimers on this post, I kept my data with no problems, but don&#8217;t just copy and paste commands without understanding how it will effect your system.  Every server is different, so don&#8217;t assume yours is setup the same as mine!</strong> So this is a Solaris 9 server, with two IDE drives setup into 4 separate mirrors: d0, d1, d3, &amp; d7.  Since there are two hard drives, there are two components or submirrors under each mirror.  The first drive is always setup as 1x where x is the number from the parent mirror.  The second drive is always 2x where x is the number from the parent mirror.  So d0 is the parent mirror, d10 is the drive one submirror, and d20 is the drive two submirror.  Make sense?  Let&#8217;s go!</p>
<p>The first problem that occurs when you have two drives and you don&#8217;t notice that you lost one, is when you reboot or the system restarts for some reason.  The problem is with the metadevice database replicas.  Sun recommends that you store at least one metadevice database replica on each of your hard drives.  So if you only have two drives, it is very likely you have an even number of replicas.  Solaris 9 uses a majority consensus algorithm to determine if there are stale databases and will not boot without one more than half of the total replicas online.  Quite obviously, this will cause your system to not boot if you have two hard drives and one dies.  Here&#8217;s the console output for this situation:</p>
<blockquote><p>metainit: <em>hostname</em>: stale databases</p>
<p>Insufficient metadevice database replicas located.</p>
<p>Use metadb to delete databases which are broken.<br />
Ignore any &#8220;Read-only file system&#8221; error messages.<br />
Reboot the system when finished to reload the metadevice database.<br />
After reboot, repair any broken database replicas which were deleted.</p>
<p>Type control-d to proceed with normal startup,<br />
(or give root password for system maintenance):</p></blockquote>
<p>The solution is to simply remove the bad replicas and reboot.  First check to see how the replicas are defined:</p>
<blockquote><p># metadb -i<br />
flags           first blk       block count<br />
M     p             16              unknown         /dev/dsk/c0t0d0s4<br />
M     p             4112            unknown         /dev/dsk/c0t0d0s4<br />
a m  p  lu         16              4096            /dev/dsk/c0t2d0s4<br />
a    p  l          4112            4096            /dev/dsk/c0t2d0s4</p></blockquote>
<p>Remove the replicas from the dead drive:</p>
<blockquote><p># metadb -d c0t0d0s4<br />
metadb: rembrandt: c0t0d0s4: no metadevice database replica on device</p></blockquote>
<p>Recheck that they&#8217;re gone:</p>
<blockquote><p># metadb -i<br />
flags           first blk       block count<br />
a m  p  lu         16              4096            /dev/dsk/c0t2d0s4<br />
a    p  l          4112            4096            /dev/dsk/c0t2d0s4</p></blockquote>
<p>Once logged out, the system will continue to boot and then reset again before fully booting.</p>
<blockquote><p># exit<br />
logout<br />
Resuming system initialization. Metadevice database will remain stale.</p></blockquote>
<p>Once the system is back up and running, we can go about replacing the bad drive.  The first thing you want to do is backup your lvm configs:</p>
<blockquote><p># cp /etc/lvm /root/lvm.backup</p></blockquote>
<p>Now take a look at what mirrors/drives you have down.  To keep the post shorter, I am just showing one mirror here.  The others look the same.  You&#8217;ll also notice at the end that in my case, the second hard drive isn&#8217;t showing up at all, a pretty good sign that the drive is dead.  If it&#8217;s still listed you might have a chance that it&#8217;s still good.  (I&#8217;ll go over that scenario in my next post.)</p>
<blockquote><p># metastat</p>
<p>&#8230;  &lt;SNIP&gt; &#8230;</p>
<p>d0: Mirror<br />
Submirror 0: d10<br />
State: Needs maintenance<br />
Submirror 1: d20<br />
State: Okay<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 6295440 blocks (3.0 GB)</p>
<p>d10: Submirror of d0<br />
State: Needs maintenance<br />
Invoke: metareplace d0 c0t0d0s0<br />
Size: 6295440 blocks (3.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c0t0d0s0          0     No     Maintenance   Yes</p>
<p>d20: Submirror of d0<br />
State: Okay<br />
Size: 6295440 blocks (3.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c0t2d0s0          0     No            Okay   Yes</p>
<p>Device Relocation Information:<br />
Device   Reloc  Device ID<br />
c0t2d0   Yes    id1,dad@AWDC_WD1200BB-00CAA1=WD-WMA8C2168885</p></blockquote>
<p>This can also be verified through iostat.  If the drive is still in here, it has some useful information like model numbers and serial numbers.  If it&#8217;s gone, the info is still useful too.  You know which drive(s) are good and through the process of elimination, you know which one is bad.</p>
<blockquote><p># iostat -En<br />
c0t2d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0<br />
Model: WDC WD1200BB-00C Revision: 17.07W17 Serial No: WD-WMA8C2168885<br />
Size: 120.03GB &lt;120031641600 bytes&gt;<br />
Media Error: 0 Device Not Ready: 0  No Device: 0 Recoverable: 0<br />
Illegal Request: 0</p></blockquote>
<p>This can also be verified through format and cfgadm:</p>
<blockquote><p># format<br />
Searching for disks&#8230;done</p>
<p>AVAILABLE DISK SELECTIONS:<br />
0. c0t2d0<br />
/pci@1f,0/ide@d/dad@2,0<br />
Specify disk (enter its number):</p>
<p># cfgadm -al<br />
Ap_Id                          Type         Receptacle   Occupant     Condition<br />
c0                             scsi-bus     connected    configured   unknown<br />
c0::dsk/c0t2d0                 disk         connected    configured   unknown<br />
c0::dsk/c0t3d0                 CD-ROM       connected    configured   unknown<br />
usb0/1                         unknown      empty        unconfigured ok<br />
usb0/2                         unknown      empty        unconfigured ok</p></blockquote>
<p>Since, I had all the information I needed, I shutdown the server (since they were IDE drives and not hot swappable) and replaced the faulty drive with another one of the same model, size, etc.  Once booted, I went into format, it saw the drive, so I went ahead and cleared the partitions since I had used this drive previously for something else.  I&#8217;m not going to go through all the format screens, they&#8217;re self explanatory.  So I went to format &gt; 0 &gt; part &gt; zero out partitions (all but partition 2) &gt; label &gt; quit &gt; quit.  Next, I needed to partition the drive to be the same as the drive it was going to mirror.  The prtvtoc command makes this easy.  Just make sure you type the right drives:</p>
<blockquote><p># prtvtoc -h /dev/rdsk/c0t2d0s2 | fmthard -s - /dev/rdsk/c0t0d0s2<br />
fmthard:  New volume table of contents now in place.</p></blockquote>
<p>You can verify that both partition tables match now if you like, compare the output of the two commands:</p>
<blockquote><p># prtvtoc -h /dev/rdsk/c0t0d0s2<br />
# prtvtoc -h /dev/rdsk/c0t2d0s2</p></blockquote>
<p>Now go into your lvm backup and cat out md.cf, copy it to another screen somewhere since you will be referring back to it several times.  I have highlighted the lines I used:</p>
<blockquote><p># cd /root/lvm.backup/<br />
# cat md.cf<br />
d3 -m d13 d23 1<br />
<strong>d13 1 1 c0t0d0s3</strong><br />
d23 1 1 c0t2d0s3<br />
d7 -m d17 d27 1<br />
<strong> d17 1 1 c0t0d0s7</strong><br />
d27 1 1 c0t2d0s7<br />
d1 -m d11 d21 1<br />
<strong> d11 1 1 c0t0d0s1</strong><br />
d21 1 1 c0t2d0s1<br />
d0 -m d10 d20 1<br />
<strong> d10 1 1 c0t0d0s0</strong><br />
d20 1 1 c0t2d0s0</p></blockquote>
<p>Now we will be going through the process of detaching the failed submirror, clearing , rebuilding, and then reattaching it.  Go through this for every submirror that has failed.  I will show you the output from the first round then just the commands for the additional rounds.  The third command (metainit) just uses the information from the md.cf file:</p>
<blockquote><p># metadetach -f d3 d13<br />
d3: submirror d13 is detached<br />
# metaclear d13<br />
d13: Concat/Stripe is cleared<br />
# metainit d13 1 1 c0t0d0s3<br />
d13: Concat/Stripe is setup<br />
# metattach d3 d13<br />
d3: submirror d13 is attached</p></blockquote>
<p>Now you can check the status of the resync with metastat:</p>
<blockquote><p># metastat d3<br />
d3: Mirror<br />
Submirror 0: d13<br />
State: Resyncing<br />
Submirror 1: d23<br />
State: Okay<br />
Resync in progress: 12 % done<br />
Pass: 1<br />
Read option: roundrobin (default)<br />
Write option: parallel (default)<br />
Size: 4198320 blocks (2.0 GB)</p>
<p>d13: Submirror of d3<br />
State: Resyncing<br />
Size: 4198320 blocks (2.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c0t0d0s3          0     No            Okay   Yes</p>
<p>d23: Submirror of d3<br />
State: Okay<br />
Size: 4198320 blocks (2.0 GB)<br />
Stripe 0:<br />
Device     Start Block  Dbase        State Reloc Hot Spare<br />
c0t2d0s3          0     No            Okay   Yes</p>
<p>Device Relocation Information:<br />
Device   Reloc  Device ID<br />
c0t0d0   Yes    id1,dad@AWDC_WD1200BB-00CAA1=WD-WMA8C2114374<br />
c0t2d0   Yes    id1,dad@AWDC_WD1200BB-00CAA1=WD-WMA8C2168885</p></blockquote>
<p>Now run through the rest of the commands:</p>
<blockquote><p># metadetach -f d7 d17<br />
# metaclear d17<br />
# metainit d17 1 1 c0t0d0s7<br />
# metattach d7 d17</p>
<p># metadetach -f d1 d11<br />
# metaclear d11<br />
# metainit d11 1 1 c0t0d0s1<br />
# metattach d1 d11</p>
<p># metadetach -f d0 d10<br />
# metaclear d10<br />
# metainit d10 1 1 c0t0d0s0<br />
# metattach d0 d10</p></blockquote>
<p>Of course, you can always check at anytime any of the mirrors or submirrors to see what you&#8217;re doing.  If you want to check the status on multiple rebuilds, just run:</p>
<blockquote><p># metastat | grep Resync<br />
State: Resyncing<br />
Resync in progress: 2 % done<br />
State: Resyncing<br />
State: Resyncing<br />
Resync in progress: 99 % done<br />
State: Resyncing<br />
State: Resyncing<br />
Resync in progress: 1 % done<br />
State: Resyncing</p></blockquote>
<p>Once the drives have finished syncing, we need to make sure that we can still boot off this drive in case the other drive fails:</p>
<blockquote><p># installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0</p></blockquote>
<p>And, of course, we need to re-add the metadevice database replicas for the same reason:</p>
<blockquote><p># metadb -a -c 2 c0t0d0s4<br />
# metadb -i<br />
flags           first blk       block count<br />
a        u         16              4096            /dev/dsk/c0t0d0s4<br />
a        u         4112            4096            /dev/dsk/c0t0d0s4<br />
a m  p  luo        16              4096            /dev/dsk/c0t2d0s4<br />
a    p  luo        4112            4096            /dev/dsk/c0t2d0s4</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Replacing a hard drive with Veritas Volume Manager</title>
		<link>http://www.utahsysadmin.com/2008/09/11/replacing-a-hard-drive-with-veritas-volume-manager/</link>
		<comments>http://www.utahsysadmin.com/2008/09/11/replacing-a-hard-drive-with-veritas-volume-manager/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 05:51:11 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=107</guid>
		<description><![CDATA[On one of my Solaris 9 servers, I lost a hard drive on a large array that had been built with no redundancy.  RAID 0 is a tempting option for some admins trying to get the most space that they can out of the capacity they have, but it is almost always the wrong [...]]]></description>
			<content:encoded><![CDATA[<p>On one of my Solaris 9 servers, I lost a hard drive on a large array that had been built with no redundancy.  RAID 0 is a tempting option for some admins trying to get the most space that they can out of the capacity they have, but it is almost always the wrong choice.  Anyway, a drive died and had to be replaced.  This array had been built using Veritas Volume Manager, so here are the steps I used.  This is all from the command line.  There is also a Veritas Enterprise Administrator GUI (vea) that you can use, but it has problems occasionally.  Anyway, this is what I did - keep in mind that my array was already destroyed, so I didn&#8217;t worry about any data loss.  <strong>If you are trying to keep your data, don&#8217;t follow my steps!</strong> You&#8217;ve been warned.</p>
<p>Legend:  gendg is the disk group, genlv is the logical volume, gengd04 is the bad drive, gengd07 is the good drive, genlv-01 is the failed plex.  You can find most of this information with the vxprint command.</p>
<p>Umount the effected file system</p>
<blockquote><p>/sbin/umount /u0</p></blockquote>
<p>Add Disk 13 (gendg07) to gendg</p>
<blockquote><p>/usr/sbin/vxdg -g gendg adddisk gendg07=Disk_13</p></blockquote>
<p>Replace gendg04 with gendg07</p>
<blockquote><p>/usr/sbin/vxdg -g gendg repldisk gendg04=gendg07</p></blockquote>
<p>Dis-associate the failed plex</p>
<blockquote><p>/usr/sbin/vxplex -g gendg dis genlv-01</p></blockquote>
<p>Re-associate the plex, it will be rebuilt</p>
<blockquote><p>/usr/sbin/vxplex -g gendg att genlv genlv-01</p></blockquote>
<p>Recover the disk group gendg and the logical volume genlv</p>
<blockquote><p>/usr/sbin/vxrecover -b -g gendg -sE genlv</p></blockquote>
<p>Since this was RAID 0, recreate the file system</p>
<blockquote><p>/usr/sbin/mkfs -F vxfs /dev/vx/rdsk/gendg/genlv</p></blockquote>
<p>Check the file system</p>
<blockquote><p>/usr/sbin/fsck -F vxfs /dev/vx/rdsk/gendg/genlv</p></blockquote>
<p>Mount the file system again</p>
<blockquote><p>/sbin/mount /u0</p></blockquote>
<p>I will try to post a similar experience using <a href="http://www.utahsysadmin.com/2008/09/29/replacing-a-hard-drive-with-sun-volume-manager/">Sun&#8217;s Solaris Volume Manager</a> next.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/09/11/replacing-a-hard-drive-with-veritas-volume-manager/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Extract files from an rpm</title>
		<link>http://www.utahsysadmin.com/2008/09/11/extract-files-from-a-rpm/</link>
		<comments>http://www.utahsysadmin.com/2008/09/11/extract-files-from-a-rpm/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 05:29:20 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=105</guid>
		<description><![CDATA[If you want to extract the files from an rpm, it&#8217;s really easy.  I needed to use this recently when I was going to install a printer driver in UNIX.  The manufacturer had a linux rpm available for download, but I didn&#8217;t need the whole thing, just the PPD file.  So, I [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to extract the files from an rpm, it&#8217;s really easy.  I needed to use this recently when I was going to install a printer driver in UNIX.  The manufacturer had a linux rpm available for download, but I didn&#8217;t need the whole thing, just the PPD file.  So, I ran this command and copied out the PPD file that I needed.</p>
<blockquote><p><code> rpm2cpio package.rpm | cpio -dimv</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/09/11/extract-files-from-a-rpm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Find large files in multiple directories</title>
		<link>http://www.utahsysadmin.com/2008/06/15/find-large-files-in-multiple-directories/</link>
		<comments>http://www.utahsysadmin.com/2008/06/15/find-large-files-in-multiple-directories/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 19:37:57 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=104</guid>
		<description><![CDATA[I haven&#8217;t posted for awhile because I have been super busy.  I don&#8217;t think I have had a chance to post anything since it was announced that the company I work for was being bought out in the beginning of May.  That sale has now gone through earlier this week, but the workload [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t posted for awhile because I have been super busy.  I don&#8217;t think I have had a chance to post anything since it was announced that the company I work for was being bought out in the beginning of May.  That sale has now gone through earlier this week, but the workload has not decreased in the slightest.</p>
<p>Anyway, most admins know how to find the largest files inside a single directory:</p>
<blockquote><p>du -sk * | sort -n</p></blockquote>
<p>The other day I needed to find the largest of over 10k+ files spread across hundreds of directories.  So with a little command combo magic, I used this:</p>
<blockquote><p>for i in `find . -type f`; do du -sk $i; done | sort -n</p></blockquote>
<p>Which runs a du -sk on every single file within the current directory and all sub-directories, pipes it to a sort, with the last files being output to the screen being the largest.</p>
<p>Looking at it again today, I guess I probably could have removed the for loop and just done:</p>
<blockquote><p>du -sk `find . -type f` | sort -n</p></blockquote>
<p>Testing it out real quick shows that it works; however, if you have as many files as I had to go through, you would have quickly exhausted du and it would have complained:</p>
<blockquote><p>-bash: /usr/bin/du: Argument list too long</p></blockquote>
<p>So it looks like the for loop was needed after all.  Personally, I love running for loops on the command line.</p>
<p>Happy Father&#8217;s Day to all you fathers out there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/06/15/find-large-files-in-multiple-directories/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Author Highlighting</title>
		<link>http://www.utahsysadmin.com/2008/04/29/author-highlighting/</link>
		<comments>http://www.utahsysadmin.com/2008/04/29/author-highlighting/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 03:27:34 +0000</pubDate>
		<dc:creator>Kevin Pendleton</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=102</guid>
		<description><![CDATA[I read this post by Matt Cutts awhile back (I recommend subscribing to his blog, some useful stuff there) and now that my blog is getting to the point where people are commenting on my posts and I am commenting back, it made sense to implement this on my blog.  Going through his instructions [...]]]></description>
			<content:encoded><![CDATA[<p>I read this <a href="http://www.mattcutts.com/blog/highlight-author-comments-wordpress/" target="_blank">post</a> by Matt Cutts awhile back (I recommend subscribing to his blog, some useful stuff there) and now that my blog is getting to the point where people are commenting on my posts and I am commenting back, it made sense to implement this on my blog.  Going through his instructions I had a couple things to add.  Instead of just adding a new line to your css file with a background color, I would recommend duplicating the .alt section of your css and then changing the color there.  That way all the other formatting sticks with your comment.  For example, all of my comments have rounded corners, if I just added the line he recommends, my comments are square.  Enough said there.</p>
<p>The other section I wonder about but doesn&#8217;t really apply to my blog, is for blogs with multiple authors.  His code says:</p>
<p><code>if (1 == $comment-&gt;user_id)</code></p>
<p>which only highlights the comments of the admin user - who may not even be the original author.  Someday, when I&#8217;m a WordPress hacker, I&#8217;ll tell you what the correct line should be, or some other guru can add it.  But there should be something like:</p>
<p><code>if ($article-&gt;user_id == $comment-&gt;user_id)</code></p>
<p>Again I don&#8217;t know what the right variable for the $article-&gt;user_id would be.  If you take the time to figure it out, let us know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.utahsysadmin.com/2008/04/29/author-highlighting/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
