<?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>Lâmôlabs</title>
	<atom:link href="http://www.lamolabs.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lamolabs.org/blog</link>
	<description>Lame Oh Labs .... Linux &#38; Tech! Is there anything else?</description>
	<lastBuildDate>Fri, 12 Mar 2010 16:10:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[one-liner]: Analyzing a System&#8217;s BIOS from the Command Line under Fedora, CentOS, or RHEL</title>
		<link>http://www.lamolabs.org/blog/2616/one-liner-analyzing-a-systems-bios-from-the-command-line-under-fedora-centos-rhel/</link>
		<comments>http://www.lamolabs.org/blog/2616/one-liner-analyzing-a-systems-bios-from-the-command-line-under-fedora-centos-rhel/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:10:26 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2616</guid>
		<description><![CDATA[Background

<p>A system&#8217;s BIOS is a treasure trove of a lot of useful info about the capabilities of a computer. BIOS, which stands for Basic Input/Output System, contains information such as:</p>

<p> * motherboard manufacturer
 * system&#8217;s serial number
 * amount of RAM installed
 * the CPUs speed &#38; signature</p>

<p>Normally the BIOS is accessible by pressing the [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>

<p>A system&#8217;s <span class="caps">BIOS </span>is a treasure trove of a lot of useful info about the capabilities of a computer. <span class="caps">BIOS, </span>which stands for Basic Input/Output System, contains information such as:</p>

<p> * motherboard manufacturer<br />
 * system&#8217;s serial number<br />
 * amount of <span class="caps">RAM </span>installed<br />
 * the <span class="caps">CPU</span>s speed &amp; signature</p>

<p>Normally the <span class="caps">BIOS </span>is accessible by pressing the <strong>delete</strong> key or the <strong>F1</strong> key.</p>

<h3>Problem</h3>

<p>Occasionally I&#8217;ve wanted to check out the <span class="caps">BIOS </span>settings of a system without having to go through the hassle of rebooting. With the help of this nifty command line tool, <strong>dmidecode</strong>, <span class="caps">BIOS </span>info can be had, without having to reboot.</p>

<h3>Solution</h3>

<blockquote><p>dmidecode  is  a tool for dumping a computer&#8217;s <span class="caps">DMI </span>(some say <span class="caps">SMBIOS</span>) table contents in a human-readable format. This table contains a description of the system&#8217;s hardware components, as well as other useful pieces of information such as serial numbers and <span class="caps">BIOS </span>revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware.  While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.</p>

<p>The  <span class="caps">DMI  </span>table  doesn&#8217;t  only describe what the system is currently made of, it also can report the possible evolutions (such as the fastest supported <span class="caps">CPU </span>or the maximal amount of memory supported).</p>

<p><span class="caps">SMBIOS </span>stands for System Management <span class="caps">BIOS, </span>while <span class="caps">DMI </span>stands for Desktop Management Interface. Both standards are tightly related and developed by the <span class="caps">DMTF </span>(Desktop Manage- ment Task Force).</p></blockquote>

<h4>Example output from a Thinkpad <span class="caps">T42 </span>laptop</h4>

<p>When you first run the <strong>dmidecode</strong> command it tells you a summary of how many structures are present within your system&#8217;s <span class="caps">BIOS.</span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p261611"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2616code11"><pre class="text" style="font-family:monospace;">% dmidecode 
# dmidecode 2.9
SMBIOS 2.33 present.
61 structures occupying 2126 bytes.
Table at 0x000E0010.</pre></td></tr></table></div>




<p>Each structure is represented by a <strong>handle ID</strong> which is a <strong>hex value</strong> of the form 0&#215;001F, followed by it&#8217;s type and it&#8217;s size.</p>

<h5>System Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261612"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre></td><td class="code" id="p2616code12"><pre class="text" style="font-family:monospace;">...
&nbsp;
Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
	Vendor: IBM
	Version: 1RETDPWW (3.21 )
	Release Date: 06/02/2006
	Address: 0xDC000
	Runtime Size: 144 kB
	ROM Size: 1024 kB
	Characteristics:
		PCI is supported
		PC Card (PCMCIA) is supported
		PNP is supported
		APM is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		ESCD support is available
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		3.5&quot;/720 KB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		USB legacy is supported
		AGP is supported
		BIOS boot specification is supported
&nbsp;
Handle 0x0001, DMI type 1, 25 bytes
System Information
	Manufacturer: IBM
	Product Name: 2373B09
	Version: ThinkPad T42
	Serial Number: 99N4BVC
	UUID: 205A7001-46D4-22CB-B51D-FDE5F7FCD3CD
	Wake-up Type: Power Switch
&nbsp;
Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
	Manufacturer: IBM
	Product Name: 2373B09
	Version: Not Available
	Serial Number: J1ZTY5031AP
&nbsp;
Handle 0x0003, DMI type 3, 17 bytes
Chassis Information
	Manufacturer: IBM
	Type: Notebook
	Lock: Not Present
	Version: Not Available
	Serial Number: Not Available
	Asset Tag: No Asset Information
	Boot-up State: Unknown
	Power Supply State: Unknown
	Thermal State: Unknown
	Security Status: Unknown
	OEM Information: 0x00000000</pre></td></tr></table></div>




<h5><span class="caps">CPU</span> Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261613"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre></td><td class="code" id="p2616code13"><pre class="text" style="font-family:monospace;">...
&nbsp;
Handle 0x0006, DMI type 4, 35 bytes
Processor Information
	Socket Designation: None
	Type: Central Processor
	Family: Pentium M
	Manufacturer: GenuineIntel
	ID: D6 06 00 00 BF B3 A3 AF
	Signature: Type 0, Family 6, Model 13, Stepping 6
	Flags:
		FPU (Floating-point unit on-chip)
		VME (Virtual mode extension)
		DE (Debugging extension)
		PSE (Page size extension)
		TSC (Time stamp counter)
		MSR (Model specific registers)
		MCE (Machine check exception)
		CX8 (CMPXCHG8 instruction supported)
		SEP (Fast system call)
		MTRR (Memory type range registers)
		PGE (Page global enable)
		MCA (Machine check architecture)
		CMOV (Conditional move instruction supported)
		PAT (Page attribute table)
		CLFSH (CLFLUSH instruction supported)
		DS (Debug store)
		ACPI (ACPI supported)
		MMX (MMX technology supported)
		FXSR (Fast floating-point save and restore)
		SSE (Streaming SIMD extensions)
		SSE2 (Streaming SIMD extensions 2)
		SS (Self-snoop)
		TM (Thermal monitor supported)
		PBE (Pending break enabled)
	Version: Intel(R) Pentium(R) M processor
	Voltage: 1.3 V
	External Clock: 400 MHz
	Max Speed: 1600 MHz
	Current Speed: 1600 MHz
	Status: Populated, Enabled
	Upgrade: None
	L1 Cache Handle: 0x000A
	L2 Cache Handle: 0x000B
	L3 Cache Handle: Not Provided
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified
...</pre></td></tr></table></div>




<h5><span class="caps">RAM</span> Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261614"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code" id="p2616code14"><pre class="text" style="font-family:monospace;">...
Handle 0x0007, DMI type 5, 20 bytes
Memory Controller Information
	Error Detecting Method: None
	Error Correcting Capabilities:
		None
	Supported Interleave: One-way Interleave
	Current Interleave: One-way Interleave
	Maximum Memory Module Size: 1024 MB
	Maximum Total Memory Size: 2048 MB
	Supported Speeds:
		Other
	Supported Memory Types:
		DIMM
		SDRAM
	Memory Module Voltage: 2.9 V
	Associated Memory Slots: 2
		0x0008
		0x0009
	Enabled Error Correcting Capabilities:
		None
&nbsp;
Handle 0x0008, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM Slot 1
	Bank Connections: 0 1
	Current Speed: Unknown
	Type: DIMM SDRAM
	Installed Size: 1024 MB (Double-bank Connection)
	Enabled Size: 1024 MB (Double-bank Connection)
	Error Status: OK
&nbsp;
Handle 0x0009, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM Slot 2
	Bank Connections: 2 3
	Current Speed: Unknown
	Type: DIMM SDRAM
	Installed Size: 1024 MB (Double-bank Connection)
	Enabled Size: 1024 MB (Double-bank Connection)
	Error Status: OK
...</pre></td></tr></table></div>




<h5>Cache Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261615"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p2616code15"><pre class="text" style="font-family:monospace;">...
Handle 0x000A, DMI type 7, 19 bytes
Cache Information
	Socket Designation: Internal L1 Cache
	Configuration: Enabled, Socketed, Level 1
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 32 KB
	Maximum Size: 32 KB
	Supported SRAM Types:
		Synchronous
	Installed SRAM Type: Synchronous
	Speed: Unknown
	Error Correction Type: Unknown
	System Type: Other
	Associativity: 8-way Set-associative
&nbsp;
Handle 0x000B, DMI type 7, 19 bytes
Cache Information
	Socket Designation: Internal L2 Cache
	Configuration: Enabled, Socketed, Level 2
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 2048 KB
	Maximum Size: 2048 KB
	Supported SRAM Types:
		Burst
	Installed SRAM Type: Burst
	Speed: Unknown
	Error Correction Type: Multi-bit ECC
	System Type: Unified
	Associativity: 8-way Set-associative
...</pre></td></tr></table></div>




<h5>Port Info (USB, Infrared, Parallel, etc.)</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261616"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
</pre></td><td class="code" id="p2616code16"><pre class="text" style="font-family:monospace;">...
Handle 0x000D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Infrared
	External Connector Type: Infrared
	Port Type: Other
&nbsp;
Handle 0x000E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Parallel
	External Connector Type: DB-25 female
	Port Type: Parallel Port ECP/EPP
&nbsp;
Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: External Monitor
	External Connector Type: DB-15 female
	Port Type: Video Port
&nbsp;
Handle 0x0015, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Microphone Jack
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port
&nbsp;
Handle 0x0016, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Headphone Jack
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port
&nbsp;
Handle 0x0017, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: S-Video-Out
	External Connector Type: Other
	Port Type: Video Port
&nbsp;
Handle 0x0019, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Modem
	External Connector Type: RJ-11
	Port Type: Modem Port
&nbsp;
Handle 0x001A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Ethernet
	External Connector Type: RJ-45
	Port Type: Network Port
&nbsp;
Handle 0x001B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: USB 1
	External Connector Type: Access Bus (USB)
	Port Type: USB
&nbsp;
Handle 0x001C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: USB 2
	External Connector Type: Access Bus (USB)
	Port Type: USB
...</pre></td></tr></table></div>




<h5>CardBus Slot Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261617"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code" id="p2616code17"><pre class="text" style="font-family:monospace;">...
Handle 0x0022, DMI type 9, 13 bytes
System Slot Information
	Designation: CardBus Slot 1
	Type: 32-bit PC Card (PCMCIA)
	Current Usage: Available
	Length: Other
	ID: Adapter 0, Socket 0
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PC Card-16 is supported
		Cardbus is supported
		Zoom Video is supported
		Modem ring resume is supported
		PME signal is supported
		Hot-plug devices are supported
&nbsp;
Handle 0x0023, DMI type 9, 13 bytes
System Slot Information
	Designation: CardBus Slot 2
	Type: 32-bit PC Card (PCMCIA)
	Current Usage: Available
	Length: Other
	ID: Adapter 1, Socket 0
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PC Card-16 is supported
		Cardbus is supported
		Zoom Video is supported
		Modem ring resume is supported
		PME signal is supported
		Hot-plug devices are supported
...</pre></td></tr></table></div>




<h5><span class="caps">RAM</span> Modules Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261618"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
</pre></td><td class="code" id="p2616code18"><pre class="text" style="font-family:monospace;">...
Handle 0x002C, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: None
	Maximum Capacity: 1 GB
	Error Information Handle: Not Provided
	Number Of Devices: 2
&nbsp;
Handle 0x002D, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x002C
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 1024 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM 1
	Bank Locator: Bank 0/1
	Type: DDR
	Type Detail: Synchronous
	Speed: Unknown
	Manufacturer: Not Specified
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified
&nbsp;
Handle 0x002E, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x002C
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 1024 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM 2
	Bank Locator: Bank 2/3
	Type: DDR
	Type Detail: Synchronous
	Speed: Unknown
	Manufacturer: Not Specified
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified
&nbsp;
Handle 0x002F, DMI type 18, 23 bytes
32-bit Memory Error Information
	Type: OK
	Granularity: Unknown
	Operation: Unknown
	Vendor Syndrome: Unknown
	Memory Array Address: Unknown
	Device Address: Unknown
	Resolution: Unknown
&nbsp;
Handle 0x0030, DMI type 19, 15 bytes
Memory Array Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x0007FFFFFFF
	Range Size: 2 GB
	Physical Array Handle: 0x002C
	Partition Width: 0
&nbsp;
Handle 0x0031, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x0003FFFFFFF
	Range Size: 1 GB
	Physical Device Handle: 0x002D
	Memory Array Mapped Address Handle: 0x0030
	Partition Row Position: 1
&nbsp;
Handle 0x0032, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00040000000
	Ending Address: 0x0007FFFFFFF
	Range Size: 1 GB
	Physical Device Handle: 0x002E
	Memory Array Mapped Address Handle: 0x0030
	Partition Row Position: 1
...</pre></td></tr></table></div>




<h5>Pointing Device Info</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261619"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p2616code19"><pre class="text" style="font-family:monospace;">...
Handle 0x0033, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Track Point
	Interface: PS/2
	Buttons: 3
&nbsp;
Handle 0x0034, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Touch Pad
	Interface: PS/2
	Buttons: 0
...</pre></td></tr></table></div>




<h5>The End</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p261620"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2616code20"><pre class="text" style="font-family:monospace;">...
End Of Table</pre></td></tr></table></div>




<p>There are some additional <strong>handles</strong> related to system logging, hardware security, and <span class="caps">OEM </span>information that I ommited to keep this post from just becoming a complete dump of the output but needless to say <strong>dmidecode</strong> is a pretty exhaustive and sweet command.</p>

<p>Check out the <a href="http://www.nongnu.org/dmidecode/">dmidecode website</a> or the man page for more information.</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2616/one-liner-analyzing-a-systems-bios-from-the-command-line-under-fedora-centos-rhel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Broken Arrow Keys during an Ubuntu 9.04 install on Vmware Server 1.X</title>
		<link>http://www.lamolabs.org/blog/3132/broken-arrow-keys-during-an-ubuntu-9-04-install-on-vmware-server-1-x/</link>
		<comments>http://www.lamolabs.org/blog/3132/broken-arrow-keys-during-an-ubuntu-9-04-install-on-vmware-server-1-x/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 01:34:16 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=3132</guid>
		<description><![CDATA[Background

<p>Recently I was trying to create a Ubuntu 9.04 vmware image using Vmware Server 1.08, but I was doing it remotely from my Fedora 10 laptop which was running Vmware Server 1.06. This can normally be done by using Vmware Server&#8217;s ability to remotely connect to other Vmware Servers.</p>

<p class="wp-caption-text">VMware Server Console</p>

<p>Here&#8217;s my work flow. [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>

<p>Recently I was trying to create a Ubuntu 9.04 vmware image using Vmware Server 1.08, but I was doing it remotely from my Fedora 10 laptop which was running Vmware Server 1.06. This can normally be done by using Vmware Server&#8217;s ability to remotely connect to other Vmware Servers.</p>

<div id="attachment_3194" class="wp-caption aligncenter" style="width: 418px"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2010/01/ss_vmware_server_console_dialog1.png" alt="" title="ss_vmware_server_console_dialog" width="408" height="306" class="size-full wp-image-3194" /><p class="wp-caption-text">VMware Server Console</p></div>

<p>Here&#8217;s my work flow. <strong><span class="caps">NOTE</span>:</strong> Ubuntu 9.04 will be running on the vmware server on CentOS 5.4.</p>

<div id="attachment_3201" class="wp-caption aligncenter" style="width: 479px"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2010/01/vmware_workflow3.png" alt="" title="vmware_workflow" width="469" height="305" class="size-full wp-image-3201" /><p class="wp-caption-text">VMware Workflow</p></div>

<h3>Problem</h3>

<p>While going through the setup I encountered a problem I hadn&#8217;t seen before where the arrow keys didn&#8217;t appear to be working within <span class="caps">GRUB </span>while I was installing Ubuntu 9.04. </p>

<div id="attachment_3138" class="wp-caption aligncenter" style="width: 604px"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2010/01/ss_grub_ubuntu_9.04_1.png" alt="" title="ss_grub_ubuntu_9.04_1" width="594" height="398" class="size-full wp-image-3138" /><p class="wp-caption-text">broken arrow keys</p></div>

<h4>Solution</h4>

<p>Turns out there is an option you can enable (i.e. set to <span class="caps">TRUE</span>) in the <strong>$HOME/.vmware/preferences</strong> file which fixes this.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p313222"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p3132code22"><pre class="conf" style="font-family:monospace;">xkeymap.nokeycodeMap = &quot;TRUE&quot;</pre></td></tr></table></div>




<p><strong><span class="caps">NOTE</span>:</strong> This change was made to the Vmware Server that was running on the Fedora 10 box.</p>

<p><span id="more-3132"></span></p>

<p>I did not need to restart the vmware service, <strong>/etc/init.d/vmware</strong>, for this change to get picked up, however I did need to restart the vmware server <span class="caps">GUI </span>that was running on Fedora 10.</p>

<div id="attachment_3139" class="wp-caption aligncenter" style="width: 605px"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2010/01/ss_grub_ubuntu_9.04_2.png" alt="" title="ss_grub_ubuntu_9.04_2" width="595" height="376" class="size-full wp-image-3139" /><p class="wp-caption-text">working arrow keys</p></div>

<p>This <a href="http://communities.vmware.com/message/1290908#1290908">link</a> on the vmware communities forum proved helpful in figuring out this workaround.</p><div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.lamolabs.org/blog/3126/delicious-bookmarks-for-january-26th-from-1446-to-2128/" rel="bookmark" class="wherego_title">Delicious Bookmarks for January 26th from 14:46 to 21:28</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/3132/broken-arrow-keys-during-an-ubuntu-9-04-install-on-vmware-server-1-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[one-liner]: Previewing a Pretty Printed Text File using enscript &amp; ps2pdf</title>
		<link>http://www.lamolabs.org/blog/2842/one-liner-previewing-a-pretty-printed-text-file-using-enscript-ps2pdf/</link>
		<comments>http://www.lamolabs.org/blog/2842/one-liner-previewing-a-pretty-printed-text-file-using-enscript-ps2pdf/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 15:45:07 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2842</guid>
		<description><![CDATA[Background

<p>Before my wife and I had kids we thought it would be nice to collect the United States quarters that were released during 1999 through 2008 to commemorate each of the 50 states. Seemed like something simple to do and would be a nice gift for the kids when they got older. So we bought [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>

<p>Before my wife and I had kids we thought it would be nice to collect the <a href="http://www.usmint.gov/mint_Programs/50sq_program/">United States quarters</a> that were released during <strong>1999</strong> through <strong>2008</strong> to commemorate each of the <strong>50 states</strong>. Seemed like something simple to do and would be a nice gift for the kids when they got older. So we bought a couple of the blue books which you can fill up with quarters as you find them. Each book contains 100 slots, 2 for each state. One slot is for the Philadelphia minted version of the quarter, and the other slot is for the Denver mint.</p>

<h3>Problem</h3>

<p>Well we ended up having 3 kids so we have to collect 300 quarters. The task of finding the quarters has been more of a dad task so when I have a chance, I&#8217;ll put a $5 dollar bill in various soda machines at work and go quarter fishing. This approach has been working fairly well and we&#8217;ve collected ~130 of the 300 quarters thus far.</p>

<p>However I&#8217;ve started getting to the point where I&#8217;m netting a lot of duplicates and the job of having to bring them home to weed through them is starting to get old. Having a list of which quarters we already have would sure be nice, so I could quickly nix any duplicates.</p>

<h3>Solution</h3>

<p>Of course I wanted a low tech solution, i.e. a piece of paper in my wallet would do the job, but how to do it?</p>

<p>The answer? A text file that I could maintain would suffice. No need for a bloated spreadsheet or some fancy handheld app. So I created a file, <strong>quarters.txt</strong>, like so:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p284225"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p2842code25"><pre class="text" style="font-family:monospace;">State           Year  Cnt (P/D)
=====           ====  =========
Alabama         2003  2/1
Alaska          2008  3/1
Arizona         2008  3/0
Arkansas        2003  3/0
California      2005  3/0
Colorado        2006  3/0
Connecticut     1999  3/2
Delaware        1999  0/0
Florida         2004  2/0
Georgia         1999  2/1
Hawaii          2008  3/0
...</pre></td></tr></table></div>




<p>It&#8217;s about as simple a text file as you can get. 3 columns, <strong>State</strong>, <strong>Year</strong>, and <strong>Counts</strong>. The 3rd column shows how many <strong>P</strong> and <strong>D</strong> quarters I have for a given state. So for example, for Alabama, I&#8217;ve got 2 Philadelphia minted quarters, and 1 Denver minted.</p>

<p>So you&#8217;re probably wondering, &#8220;why the hell is this guy writing up this in a blog post?&#8221; </p>

<p>We&#8217;ll the interesting bit to this low tech solution is how I print this list out. For this task I make use of a pretty powerful <span class="caps">UNIX </span>command called <strong>enscript</strong>, which lets you do all kinds of nifty things to a text file to augment how it looks when it gets printed.</p>

<p>About the only thing enscript doesn&#8217;t do for you, is give you the ability to preview your text file prior to printing. To accomplish this bit, I made use of another powerful <span class="caps">UNIX </span>command called <strong>ps2pdf</strong>. This command will take a postscript file (ps) and convert it to a pdf file.</p>

<p>So putting all the pieces together I came up with the following command:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p284226"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2842code26"><pre class="bash" style="font-family:monospace;">enscript <span style="color: #660033;">--fancy-header</span> <span style="color: #660033;">-U</span> 4 quarters.txt <span style="color: #660033;">-o</span> - <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ps2pdf</span> - quarters_sm.pdf</pre></td></tr></table></div>




<p>The first part of this command, will call enscript instructing it to convert the file <strong>quarters.txt</strong>, and print it to standard out <strong>-o -</strong>. The printout will include some <strong>fancy headers</strong> and enscript will print the text file out in what is called <strong>4 UP</strong>. This means that 4 pages will be printed on a single piece of paper. You could also print the page out in 2 <span class="caps">UP,</span> 8 <span class="caps">UP, </span>etc. It only needs to be a power of 2. <span class="caps">BTW,</span> 2 and 4 are the most commonly used, 8 is pretty hard to read.</p>

<p>The second part of this command passes the postscript generated by enscript through a <span class="caps">UNIX </span>pipe which gets picked up by ps2pdf, and converts it into a <span class="caps">PDF </span>file, quarters_sm.pdf.</p>

<p>From here you can check what the page would look like using your favorite <span class="caps">PDF </span>viewer, such as <strong>evince</strong> or <strong>xpdf</strong>. Once you&#8217;re comfortable with the page you can actually print it out from the <span class="caps">PDF </span>reader, or via the command-line.</p>

<p><span id="more-2842"></span></p>

<p>Here&#8217;s what the resulting <span class="caps">PDF </span>file looks like:</p>

<div id="attachment_2844" class="wp-caption aligncenter" style="width: 424px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/11/ss_quarters_pdf.png" rel="lightbox[2842]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/11/ss_quarters_pdf.png" alt="PDF file" title="ss_quarters_pdf" width="414" height="532" class="size-full wp-image-2844" /></a><p class="wp-caption-text">PDF file</p></div>

<p>Here&#8217;s a portion of the <span class="caps">PDF </span>file at a 150% of it&#8217;s original size:</p>

<div id="attachment_2845" class="wp-caption aligncenter" style="width: 597px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/11/ss_quarters_pdf_150pct.png" rel="lightbox[2842]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/11/ss_quarters_pdf_150pct.png" alt="screenshot of quarters_sm.pdf at 150%" title="ss_quarters_pdf_150pct" width="587" height="638" class="size-full wp-image-2845" /></a><p class="wp-caption-text">screenshot of quarters_sm.pdf at 150%</p></div>

<h3>Useful Links</h3>


<ul>
<li><a href="https://www.cs.utk.edu/help/doku.php?id=printing%3Alinux_printing_guide">enscript printing guide</a></li>
</ul>



<p><strong><span class="caps">NOTE</span>:</strong> For further details regarding my <strong>one-liner</strong> blog posts, check out my <a href="http://www.lamolabs.org/blog/2147/intro-blogs-one-liner-code-block-style-guides/">one-liner style guide primer</a>.</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2842/one-liner-previewing-a-pretty-printed-text-file-using-enscript-ps2pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[one-liner]: Copying &amp; Moving Files efficiently with xargs</title>
		<link>http://www.lamolabs.org/blog/2745/one-liner-copying-moving-files-efficiently-with-xargs/</link>
		<comments>http://www.lamolabs.org/blog/2745/one-liner-copying-moving-files-efficiently-with-xargs/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 14:13:24 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2745</guid>
		<description><![CDATA[Background

<p>From time to time I need to move and/or copy a subset of files from one directory to another. I typically would use something like one of these to do the task:</p>


1
2
3
4
5
#-- COPY
find . -type f -ctime -1 &#124; xargs -I &#123;&#125; cp &#123;&#125; /some/other/directory
&#160;
#-- MOVE
find . -type f -ctime -1 &#124; xargs -I &#123;&#125; [...]]]></description>
			<content:encoded><![CDATA[<h4>Background</h4>

<p>From time to time I need to move and/or copy a subset of files from one directory to another. I typically would use something like one of these to do the task:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p274530"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2745code30"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#-- COPY</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-I</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory
&nbsp;
<span style="color: #666666; font-style: italic;">#-- MOVE</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-I</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory</pre></td></tr></table></div>




<p><strong><span class="caps">NOTE</span>:</strong> The <strong>1st command</strong> finds all the files in the current directory that are <em>less than 24 hours old</em>, and <strong>copies</strong> them to <em>/some/other/directory</em>. The <strong>2nd command</strong> finds all the files in the current directory that are <em>less than 24 hours old</em>, and <strong>moves</strong> them to <em>/some/other/directory</em>.</p>

<p>But then I realized that by using xargs&#8217; <strong>&ndash;I switch</strong> I was basically limiting <strong>xargs</strong> to doing a single file at a time. According to xargs&#8217; man page, when you use the <strong>&ndash;I switch</strong> you&#8217;re implying the <strong>&ndash;x switch</strong> <span class="caps">AND </span>the <strong>&ndash;L 1 switch</strong>. The <strong>L switch</strong> is what tells <strong>xargs</strong> how many lines of input to process at a time, so we&#8217;re basically telling it to only handle one file at a time. This made no sense. I was unintentially limiting xargs&#8217; ability to optimize the command-line. So I found a better way.</p>

<h4>New Approach</h4>

<p>By utilizing 2 little used switches (&ndash;t | &ndash;&ndash;target-directory) on <strong>cp</strong> and <strong>mv</strong> I could un-tie <strong>xargs&#8217;</strong> hands.</p>

<h5>copy</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p274531"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2745code31"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># long form</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">--target-directory</span>=<span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory
&nbsp;
<span style="color: #666666; font-style: italic;"># short form</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-t</span> <span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory</pre></td></tr></table></div>




<h5>move</h5>


<div class="wp_codebox"><table width="100%" ><tr id="p274532"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2745code32"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># long form</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">--target-directory</span>=<span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory
&nbsp;
<span style="color: #666666; font-style: italic;"># short form</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-ctime</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">-t</span> <span style="color: #000000; font-weight: bold;">/</span>some<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>directory</pre></td></tr></table></div>




<p><strong><span class="caps">NOTE</span>:</strong> For further details regarding my <strong>one-liner</strong> blog posts, check out my <a href="http://www.lamolabs.org/blog/2147/intro-blogs-one-liner-code-block-style-guides/">one-liner style guide primer</a>.</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2745/one-liner-copying-moving-files-efficiently-with-xargs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[one-liner]: Getting Remote Desktop Sharing &amp; Compiz to play nice under Ubuntu 9.04 with GNOME</title>
		<link>http://www.lamolabs.org/blog/2708/one-liner-getting-remote-desktop-sharing-compiz-to-play-nice-under-ubuntu-9-04-with-gnome/</link>
		<comments>http://www.lamolabs.org/blog/2708/one-liner-getting-remote-desktop-sharing-compiz-to-play-nice-under-ubuntu-9-04-with-gnome/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 14:12:13 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[VNC]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2708</guid>
		<description><![CDATA[Background

<p>This one threw me for a bit but I finally realized that when I had Compiz enabled on an Ubuntu 9.04 system, I couldn&#8217;t use VNC to connect via Remote Desktop Sharing in GNOME (aka. Vino, aka. VNC Server). Apparently this has been an issue going back since 2007 8-(, when Compiz is enabled. Since [...]]]></description>
			<content:encoded><![CDATA[<h4>Background</h4>

<p>This one threw me for a bit but I finally realized that when I had <strong>Compiz</strong> enabled on an <strong>Ubuntu 9.04</strong> system, I couldn&#8217;t use <strong><span class="caps">VNC</span></strong> to connect via <strong>Remote Desktop Sharing</strong> in <strong><span class="caps">GNOME</span></strong> (aka. Vino, aka. <span class="caps">VNC</span> Server). Apparently this has been an issue going back since 2007 8-(, when Compiz is enabled. Since this is the first system that I actually bothered to enable Compiz I&#8217;m dealing with it for the first time.</p>

<p>The problem shows up when you try and connect remotely to a system that has Remote Desktop Sharing enabled &ndash;AND&ndash; Compiz. This <a href="https://bugs.launchpad.net/ubuntu/+source/vnc/+bug/77442">thread on launchpad</a> was helpful in showing the lineage of the problem, and the only real workaround to get Remote Desktop Sharing to work.</p>

<h4>Solution</h4>

<p>The workaround? If you&#8217;re coming at it remotely, and are too lazy to walk over to the remote system &#8230; ssh into the remote system and run these commands to effectively disable Compiz, and enable (re-enable?) the window manager Metacity.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p270835"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2708code35"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #000000; font-weight: bold;">&lt;</span>remote system<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DISPLAY</span>=:0
<span style="color: #c20cb9; font-weight: bold;">nohup</span> metacity <span style="color: #660033;">--replace</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span></pre></td></tr></table></div>




<p><strong><span class="caps">NOTE</span>:</strong> I&#8217;m wrapping a <strong>&#8220;nohup &#8230; &gt; /dev/null &amp;&#8221;</strong> around the <strong>&#8220;metacity &#8211;replace&#8221;</strong> so that when/if I close the ssh connection, the metacity running in there doesn&#8217;t get inexplicably killed off. Additionally, this version of <strong>nohup</strong> (/usr/bin/nohup), likes to leave a <strong>nohup.out</strong> file lying around, which is just <strong>cruft</strong> in our case, so by sending <strong>all</strong> the <strong>output</strong> to <strong>/dev/null</strong> we are effectively <strong>disabling</strong> the creation of the <strong>nohup.out</strong> file.</p>

<p>Now you can do your work remotely with Compiz turned off. But now what to do when you&#8217;re all done and you want to turn Compiz back on? Easy. Do this:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p270836"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2708code36"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #000000; font-weight: bold;">&lt;</span>remote system<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DISPLAY</span>=:0
<span style="color: #c20cb9; font-weight: bold;">nohup</span> compiz <span style="color: #660033;">--replace</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span></pre></td></tr></table></div>




<h4>Useful Links</h4>


<ul>
<li><a href="https://bugs.launchpad.net/ubuntu/+source/vnc/+bug/77442">launchpad bug #77442: compiz / vnc screen updates with nVidia restricted</a></li>
<li><a href="http://ubuntuforums.org/showthread.php?t=964856">forum thread on how to restart compiz</a></li>
</ul>



<p><strong><span class="caps">NOTE</span>:</strong> For further details regarding my <strong>one-liner</strong> blog posts, check out my <a href="http://www.lamolabs.org/blog/2147/intro-blogs-one-liner-code-block-style-guides/">one-liner style guide primer</a>.</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2708/one-liner-getting-remote-desktop-sharing-compiz-to-play-nice-under-ubuntu-9-04-with-gnome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[one-liner]: How to Use the Bash Shell&#8217;s export Command</title>
		<link>http://www.lamolabs.org/blog/2681/one-liner-how-to-use-the-bash-shells-export-command/</link>
		<comments>http://www.lamolabs.org/blog/2681/one-liner-how-to-use-the-bash-shells-export-command/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:35:12 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2681</guid>
		<description><![CDATA[Problem

<p>Recently at my day job I&#8217;ve been having to go through some pretty old Bash scripts that I&#8217;ve basically inherited. As I&#8217;ve been going through them I&#8217;ve been seeing a lot of confusion as to the proper use of Bash&#8217;s export command. The major offense? Not really understand whether a particular variables needs to be [...]]]></description>
			<content:encoded><![CDATA[<h4>Problem</h4>

<p>Recently at my day job I&#8217;ve been having to go through some pretty old Bash scripts that I&#8217;ve basically inherited. As I&#8217;ve been going through them I&#8217;ve been seeing a lot of confusion as to the proper use of Bash&#8217;s <strong>export command</strong>. The major offense? Not really understand whether a particular variables needs to be exported, or not. So I thought I&#8217;d take a moment just to clarify when and when not to use export.</p>

<p>The <strong>export command</strong> has really only one true purpose. To <strong>mark and/or unmark variables</strong> (and functions) that you want to have automatically exported to environments of <strong>subsequently executed commands</strong>. So if you create a script that calls other commands, and you want to push variables into the environment of these commands, then you&#8217;ll want to use <strong>export</strong>.</p>

<h4>Example #1 (without export)</h4>

<p>For example, let&#8217;s say we have the following 2 scripts:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p268149"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2681code49"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #1: parent.bash</span>
&nbsp;
<span style="color: #007800;">var1</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell script&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>child.bash</pre></td></tr></table></div>





<div class="wp_codebox"><table width="100%" ><tr id="p268150"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2681code50"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #2: child.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span></pre></td></tr></table></div>




<p>And when I run the script <strong>parent.bash</strong> I get this output:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p268151"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2681code51"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># output from parent.bash &amp; child.bash (without export)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> .<span style="color: #000000; font-weight: bold;">/</span>parent.bash
inside .<span style="color: #000000; font-weight: bold;">/</span>parent.bash script: this was <span style="color: #000000; font-weight: bold;">set</span> by the parent shell script
inside .<span style="color: #000000; font-weight: bold;">/</span>child.bash script:</pre></td></tr></table></div>




<p>Notice how the variable <strong>$var1</strong>, which was set in the <strong>parent.bash</strong> script, didn&#8217;t get displayed by the <strong>child.bash</strong> script? Now watch this example with the variable <strong>$var1</strong> exported in the <strong>parent.bash</strong> script.</p>

<h4>Example #2 (with export)</h4>


<div class="wp_codebox"><table width="100%" ><tr id="p268152"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2681code52"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #1: parent.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">var1</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell script&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>child.bash</pre></td></tr></table></div>





<div class="wp_codebox"><table width="100%" ><tr id="p268153"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2681code53"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #2: child.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span></pre></td></tr></table></div>




<p>And when we run <strong>parent.bash</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p268154"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2681code54"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># output from parent.bash &amp; child.bash (with export)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> .<span style="color: #000000; font-weight: bold;">/</span>parent.bash
inside .<span style="color: #000000; font-weight: bold;">/</span>parent.bash script: this was <span style="color: #000000; font-weight: bold;">set</span> my the parent shell script
inside .<span style="color: #000000; font-weight: bold;">/</span>child.bash script: this was <span style="color: #000000; font-weight: bold;">set</span> my the parent shell script</pre></td></tr></table></div>




<h4>Example #3 (un-exporting)</h4>

<p>Export isn&#8217;t just a one trick pony. It can also unmark a previously exported variable.</p>

<p><span id="more-2681"></span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p268155"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2681code55"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #1: parent.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">var1</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell script&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>child.bash
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #660033;">-n</span> var1
.<span style="color: #000000; font-weight: bold;">/</span>child.bash</pre></td></tr></table></div>





<div class="wp_codebox"><table width="100%" ><tr id="p268156"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2681code56"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #2: child.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span></pre></td></tr></table></div>





<div class="wp_codebox"><table width="100%" ><tr id="p268157"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2681code57"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># output from parent.bash &amp; child.bash (with a before/after export)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> .<span style="color: #000000; font-weight: bold;">/</span>parent.bash
inside .<span style="color: #000000; font-weight: bold;">/</span>parent.bash script: this was <span style="color: #000000; font-weight: bold;">set</span> by the parent shell script
inside .<span style="color: #000000; font-weight: bold;">/</span>child.bash script: this was <span style="color: #000000; font-weight: bold;">set</span> by the parent shell script
inside .<span style="color: #000000; font-weight: bold;">/</span>child.bash script:</pre></td></tr></table></div>




<p>Here we see the effects of the <strong>export -n</strong> on <strong>child.bash</strong> the <strong>2nd time</strong> it&#8217;s called.</p>

<h4>Which Variables are Flagged for Export?</h4>

<p>You can use the command <strong>export -p</strong> to get a list of all the variables marked for export, like this:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p268158"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p2681code58"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #660033;">-p</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">CCACHE_DIR</span>=<span style="color: #ff0000;">&quot;/var/cache/ccache&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">CCACHE_UMASK</span>=<span style="color: #ff0000;">&quot;002&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">COLORTERM</span>=<span style="color: #ff0000;">&quot;gnome-terminal&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">CVS_RSH</span>=<span style="color: #ff0000;">&quot;ssh&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">DESKTOP_SESSION</span>=<span style="color: #ff0000;">&quot;gnome&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">DISPLAY</span>=<span style="color: #ff0000;">&quot;:0.0&quot;</span>
...
...
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">SHELL</span>=<span style="color: #ff0000;">&quot;/bin/bash&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">SHLVL</span>=<span style="color: #ff0000;">&quot;4&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">TERM</span>=<span style="color: #ff0000;">&quot;xterm&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">USER</span>=<span style="color: #ff0000;">&quot;root&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">WINDOWID</span>=<span style="color: #ff0000;">&quot;77021004&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">XMODIFIERS</span>=<span style="color: #ff0000;">&quot;@im=imsettings&quot;</span>
<span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">var1</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell script&quot;</span></pre></td></tr></table></div>




<h4>What else?</h4>

<p>There is one additional trick related to exporting variables, but it doesn&#8217;t make use of the export command. It uses Bash&#8217;s <strong>set</strong> command. This command allows you to automatically export <span class="caps">ALL </span>the variables that have been modified or created to the environment of subsequent commands. </p>

<p>Here&#8217;s a quick example:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p268159"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p2681code59"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #1: parent.bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># automatically export EVERYTHING</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-a</span>
&nbsp;
<span style="color: #007800;">var1</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell script&quot;</span>
<span style="color: #007800;">var2</span>=<span style="color: #ff0000;">&quot;this was set by the parent shell too&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var2</span>&quot;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>child.bash</pre></td></tr></table></div>





<div class="wp_codebox"><table width="100%" ><tr id="p268160"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2681code60"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># script #2: child.bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var1</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;inside $0 script: <span style="color: #007800;">$var2</span>&quot;</span></pre></td></tr></table></div>




<h4>Useful links</h4>


<ul>
<li><a href="http://www.ibm.com/developerworks/library/l-bash.html">Daniel Robbin&#8217;s 3 part Bash tutorial</a></li>
<li><a href="http://www.gnu.org/software/bash/bash.html">Bash Reference Manual</a></li>
</ul>

<div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2681/one-liner-how-to-use-the-bash-shells-export-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Ruby Support in Vim on Fedora 10, 11, and CentOS 5 &amp; Installing the Vim Textile plugin</title>
		<link>http://www.lamolabs.org/blog/2662/fixing-ruby-support-in-vim-on-fedora-10-11-and-centos-5-installing-the-vim-textile-plugin/</link>
		<comments>http://www.lamolabs.org/blog/2662/fixing-ruby-support-in-vim-on-fedora-10-11-and-centos-5-installing-the-vim-textile-plugin/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 15:00:09 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[textile]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2662</guid>
		<description><![CDATA[Background

<p>A while back I was trying to get the vim textile plugin installed and ran into a problem. Apparently the vim that&#8217;s included with Fedora 10, 11, and CentOS 5 doesn&#8217;t include ruby support. This bug report explains what&#8217;s wrong with vim and how it&#8217;s missing ruby support. The problem is visible with this command:</p>


1
2
3
4
% [...]]]></description>
			<content:encoded><![CDATA[<h4>Background</h4>

<p>A while back I was trying to get the <a href="http://www.vim.org/scripts/script.php?script_id=2305">vim textile plugin</a> installed and ran into a problem. Apparently the vim that&#8217;s included with Fedora 10, 11, and CentOS 5 doesn&#8217;t include ruby support. This <a href="https://bugzilla.redhat.com/show_bug.cgi?id=503872">bug report</a> explains what&#8217;s wrong with vim and how it&#8217;s missing ruby support. The problem is visible with this command:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p266270"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2662code70"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #660033;">--version</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> ruby
+printer +profile +python +quickfix +reltime +rightleft <span style="color: #660033;">-ruby</span> +scrollbind 
...
...</pre></td></tr></table></div>




<p>The <strong>&ndash;ruby</strong> tells us that ruby support isn&#8217;t enabled. The only solution I&#8217;ve seen thus far is to rebuild vim. Not really a huge deal but it&#8217;s work non the less 8-).</p>

<h4>Rebuilding vim with ruby support</h4>

<p>Here&#8217;s how I fixed it.</p>

<p><strong>download vim Source <span class="caps">RPM </span>(SRPM)</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266271"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2662code71"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.xmission.com<span style="color: #000000; font-weight: bold;">/</span>fedora<span style="color: #000000; font-weight: bold;">/</span>updates<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span><span style="color: #000000; font-weight: bold;">/</span>SRPMS<span style="color: #000000; font-weight: bold;">/</span>vim-7.2.148-1.fc10.src.rpm</pre></td></tr></table></div>




<p><strong>confirm that ruby is installed</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266272"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2662code72"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> yum list installed ruby<span style="color: #000000; font-weight: bold;">*|</span>column -t<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> ruby
ruby.i386        1.8.6.287-2.fc10  installed
ruby-devel.i386  1.8.6.287-2.fc10  installed
ruby-irb.i386    1.8.6.287-2.fc10  installed
ruby-libs.i386   1.8.6.287-2.fc10  installed
ruby-rdoc.i386   1.8.6.287-2.fc10  installed</pre></td></tr></table></div>




<p><strong>make sure you have your own rpmbuild directory</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266273"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2662code73"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>rpmbuild<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>BUILD,RPMS,SOURCES,SPECS,SRPMS<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># caution with this second command if you already have your own .rpmmacros, this will overwrite!</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'%_topdir %(echo $HOME)/rpmbuild'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.rpmmacros</pre></td></tr></table></div>




<p><strong>rebuild vim / re-install vim</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266274"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2662code74"><pre class="bash" style="font-family:monospace;">rpmbuild <span style="color: #660033;">--rebuild</span> vim-7.2.148-1.fc10.src.rpm
rpm <span style="color: #660033;">--force</span> <span style="color: #660033;">-Uvh</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>rpmbuild<span style="color: #000000; font-weight: bold;">/</span>RPMS<span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>vim-<span style="color: #7a0874; font-weight: bold;">&#123;</span>c,e,m,X<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">*</span></pre></td></tr></table></div>




<p><strong>check that vim now has ruby support</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266275"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2662code75"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #660033;">--version</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> ruby
+printer +profile +python +quickfix +reltime +rightleft +ruby +scrollbind 
...
...</pre></td></tr></table></div>




<p>Ahh. a <strong>+ruby</strong> means it worked.</p>

<h4>Textile Plugin for vim</h4>

<p>Now onto installing the vim textile plugin. </p>

<p><strong>First things first, we need to install rubygems</strong></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266276"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2662code76"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> yum <span style="color: #c20cb9; font-weight: bold;">install</span> rubygems</pre></td></tr></table></div>




<p><strong>Next we need to install the</strong> <a href="http://redcloth.org/">RedCloth</a> <strong>gem, it&#8217;s required by the</strong> <a href="http://www.vim.org/scripts/script.php?script_id=2305">textile plugin</a></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266277"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2662code77"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> RedCloth
Building native extensions.  This could take a while...
Successfully installed RedCloth-4.2.2
1 gem installed
Installing ri documentation <span style="color: #000000; font-weight: bold;">for</span> RedCloth-4.2.2...
Installing RDoc documentation <span style="color: #000000; font-weight: bold;">for</span> RedCloth-4.2.2...</pre></td></tr></table></div>




<p><strong>Finally, install the textile plugin</strong></p>

<p>Downloading the textile plugin from <a href="http://www.vim.org/scripts/script.php?script_id=2305">here</a>,</p>

<p><span id="more-2662"></span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p266278"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code" id="p2662code78"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># unpack the zip</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">unzip</span> textile-0.3.zip
   creating: textile<span style="color: #000000; font-weight: bold;">/</span>
   creating: textile<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>
  inflating: textile<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>textile.txt  
   creating: textile<span style="color: #000000; font-weight: bold;">/</span>ftplugin<span style="color: #000000; font-weight: bold;">/</span>
  inflating: textile<span style="color: #000000; font-weight: bold;">/</span>ftplugin<span style="color: #000000; font-weight: bold;">/</span>textile.vim  
   creating: textile<span style="color: #000000; font-weight: bold;">/</span>plugin<span style="color: #000000; font-weight: bold;">/</span>
  inflating: textile<span style="color: #000000; font-weight: bold;">/</span>plugin<span style="color: #000000; font-weight: bold;">/</span>textile.vim  
   creating: textile<span style="color: #000000; font-weight: bold;">/</span>syntax<span style="color: #000000; font-weight: bold;">/</span>
  inflating: textile<span style="color: #000000; font-weight: bold;">/</span>syntax<span style="color: #000000; font-weight: bold;">/</span>textile.vim  
&nbsp;
<span style="color: #666666; font-style: italic;"># cd into the textile dir</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">cd</span> textile
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">tree</span> .
.
<span style="color: #000000; font-weight: bold;">|</span>-- doc
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- textile.txt
<span style="color: #000000; font-weight: bold;">|</span>-- ftplugin
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- textile.vim
<span style="color: #000000; font-weight: bold;">|</span>-- plugin
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- textile.vim
<span style="color: #000000; font-weight: bold;">`</span>-- syntax
    <span style="color: #000000; font-weight: bold;">`</span>-- textile.vim
&nbsp;
<span style="color: #000000;">4</span> directories, <span style="color: #000000;">4</span> files
&nbsp;
<span style="color: #666666; font-style: italic;"># install the plugin</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">*</span> ~<span style="color: #000000; font-weight: bold;">/</span>.vim<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>




<p><strong>screenshot of textile plugin in action</strong></p>

<div id="attachment_2670" class="wp-caption aligncenter" style="width: 643px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_textile_plugin.png" rel="lightbox[2662]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_textile_plugin.png" alt="vim&amp;#039;s textile plugin" title="ss_vim_textile_plugin" width="633" height="362" class="size-full wp-image-2670" /></a><p class="wp-caption-text">vim's textile plugin</p></div><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2662/fixing-ruby-support-in-vim-on-fedora-10-11-and-centos-5-installing-the-vim-textile-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping CentOS 5 OpenVZ images up to Date with Yum</title>
		<link>http://www.lamolabs.org/blog/1114/keeping-centos-5-openvz-images-up-to-date-with-yum/</link>
		<comments>http://www.lamolabs.org/blog/1114/keeping-centos-5-openvz-images-up-to-date-with-yum/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 07:17:14 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[openvz]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=1114</guid>
		<description><![CDATA[<p>Now that I&#8217;ve been using OpenVZ for several months I&#8217;d gotten to the point where I wanted/needed to &#8220;yum update&#8221; all my VEs. I currently have 11 images running on my OpenVZ Server. I thought I could just vzctl exec &#8230; yum -y update all the VEs, but quickly ran into some issues with this [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;ve been using OpenVZ for several months I&#8217;d gotten to the point where I wanted/needed to &#8220;yum update&#8221; all my VEs. I currently have 11 images running on my OpenVZ Server. I thought I could just <strong>vzctl exec &#8230; yum -y update</strong> all the VEs, but quickly ran into some issues with this brute force approach. Doing the yum -y update broke several of my VEs so I opted to restore the unrecoverable ones from backups.</p>

<p>For my second attempt, I opted to do each VE independently, to get a better understanding of what the best approach would be for doing mass upgrades like this now, and in the future. The first hurdle to overcome had to do with some of the VEs running out of memory (RAM) during the upgrade process. </p>

<p><span class="caps">NOTE</span>: A VE = Virtual Environment (aka. a virtual host), while HN = Host Node</p>

<h4>Issue #1, not enough <span class="caps">RAM </span>for yum to run</h4>


<div class="wp_codebox"><table width="100%" ><tr id="p111484"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p1114code84"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># RAM budgets for VEs</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># NOTE: values are in # of pages (1 pg. = 4K)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;vm feature held maxheld barrier limit failcnt<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>; <span style="color: #c20cb9; font-weight: bold;">grep</span> privvm <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span>1<span style="color: #000000; font-weight: bold;">*/</span>resources<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">|</span>column <span style="color: #660033;">-t</span>
vm                       feature      held    maxheld  barrier  limit   failcnt
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">101</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">31904</span>   <span style="color: #000000;">82215</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">69632</span>   <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">102</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">119803</span>  <span style="color: #000000;">196620</span>   <span style="color: #000000;">166400</span>   <span style="color: #000000;">179200</span>  <span style="color: #000000;">9517</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">103</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">27125</span>   <span style="color: #000000;">35974</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">69632</span>   <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">104</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">56251</span>   <span style="color: #000000;">107250</span>   <span style="color: #000000;">104960</span>   <span style="color: #000000;">115200</span>  <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">105</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">73559</span>   <span style="color: #000000;">82926</span>    <span style="color: #000000;">98304</span>    <span style="color: #000000;">103304</span>  <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">106</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">30219</span>   <span style="color: #000000;">68097</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">69632</span>   <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">108</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">30081</span>   <span style="color: #000000;">84291</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">69632</span>   <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">109</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">32790</span>   <span style="color: #000000;">74199</span>    <span style="color: #000000;">98304</span>    <span style="color: #000000;">103304</span>  <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">110</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">40497</span>   <span style="color: #000000;">69408</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">69632</span>   <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">111</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">26990</span>   <span style="color: #000000;">35371</span>    <span style="color: #000000;">65536</span>    <span style="color: #000000;">67840</span>   <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># NOTE: converted the columns to megabytes (MB), it's just easier to read</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;vm feature held maxheld barrier limit failcnt<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>; <span style="color: #c20cb9; font-weight: bold;">grep</span> privvm <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span>1<span style="color: #000000; font-weight: bold;">*/</span>resources<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{sub($3,$3*4096/2^20) sub($4,$4*4096/2^20) sub($5,$5*4096/2^20) sub($6,$6*4096/2^20)}1'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">|</span>column <span style="color: #660033;">-t</span>
vm                       feature      held     maxheld  barrier  limit    failcnt
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">101</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">124.625</span>  <span style="color: #000000;">321.152</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">272</span>      <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">102</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">467.98</span>   <span style="color: #000000;">768.047</span>  <span style="color: #000000;">650</span>      <span style="color: #000000;">700</span>      <span style="color: #000000;">9517</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">103</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">105.957</span>  <span style="color: #000000;">140.523</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">272</span>      <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">104</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">219.73</span>   <span style="color: #000000;">418.945</span>  <span style="color: #000000;">410</span>      <span style="color: #000000;">450</span>      <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">105</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">287.34</span>   <span style="color: #000000;">323.93</span>   <span style="color: #000000;">384</span>      <span style="color: #000000;">403.531</span>  <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">106</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">118.043</span>  <span style="color: #000000;">266.004</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">272</span>      <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">108</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">117.504</span>  <span style="color: #000000;">329.262</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">272</span>      <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">109</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">128.086</span>  <span style="color: #000000;">289.84</span>   <span style="color: #000000;">384</span>      <span style="color: #000000;">403.531</span>  <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">110</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">158.191</span>  <span style="color: #000000;">271.125</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">272</span>      <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">111</span><span style="color: #000000; font-weight: bold;">/</span>resources:  privvmpages  <span style="color: #000000;">105.43</span>   <span style="color: #000000;">138.168</span>  <span style="color: #000000;">256</span>      <span style="color: #000000;">265</span>      <span style="color: #000000;">0</span></pre></td></tr></table></div>




<p>According to this data 4 of the 11 images had gone over their allocation of <span class="caps">RAM.</span> So I tried restarting these and re-running yum update within the problem VEs. Again the update failed and so I needed to increase their allocation of memory. I didn&#8217;t want to devote more memory permanently, just a enough temporarily to do the upgrade. So I used this trick to temporarily bump up a VEs allocated memory.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p111485"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p1114code85"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># increase the RAM by 100MB</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 101 <span style="color: #660033;">--privvmpages</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>256+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m:$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>272+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m <span style="color: #660033;">--save</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ...</span>
<span style="color: #666666; font-style: italic;"># do the upgrade (yum update)</span>
<span style="color: #666666; font-style: italic;"># ...</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># decrease the RAM back to the original value</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 101 <span style="color: #660033;">--privvmpages</span> 256m:272m <span style="color: #660033;">--save</span></pre></td></tr></table></div>




<p>For the remaining 3 VEs that needed additional memory I used these commands to increase their allocations of <span class="caps">RAM</span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p111486"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p1114code86"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cmds. to increase RAM by 100MB</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 102 <span style="color: #660033;">--privvmpages</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>650+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m:$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>700+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 108 <span style="color: #660033;">--privvmpages</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>256+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m:$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>272+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 110 <span style="color: #660033;">--privvmpages</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>256+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m:$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>272+100<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>m <span style="color: #660033;">--save</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># cmds. to decrease</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 102 <span style="color: #660033;">--privvmpages</span> 650m:700m <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 108 <span style="color: #660033;">--privvmpages</span> 256m:272m <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 110 <span style="color: #660033;">--privvmpages</span> 256m:272m <span style="color: #660033;">--save</span></pre></td></tr></table></div>





<h4>Issue #2, not enough diskspace for yum to run</h4>

<p>The next snag I ran into had to do with a couple of the VEs running out of diskspace.  And here&#8217;s the commands I used to reconfigure more diskspace.</p>

<p><span id="more-1114"></span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p111487"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p1114code87"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># reconfigure with 2GB of diskspace</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 101 <span style="color: #660033;">--diskspace</span> 2048M:2252M <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 102 <span style="color: #660033;">--diskspace</span> 2048M:2252M <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> 103 <span style="color: #660033;">--diskspace</span> 2048M:2252M <span style="color: #660033;">--save</span></pre></td></tr></table></div>




<p>At this point I was able to yum update all my images, and work through any packages that had been updated.</p>

<h4>Issue #3, unfinished yum transactions</h4>

<p>One final snag that I didn&#8217;t really pick up on until probably the 2nd or 3rd time I went through this &#8220;process&#8221; was that some of the VEs would report during yum update that there were <strong>incomplete transactions</strong>, and that I really should run the <strong>yum-complete-transaction</strong> command. I&#8217;d never heard of this command, so I went looking and apparently if yum fails to complete a transaction, it remains queued up, causing you to get warnings during subsequent yum updates. So to get <strong>yum-complete-transaction</strong> command you need to install a package called <strong>yum-utils</strong>.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p111488"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p1114code88"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> yum-utils</pre></td></tr></table></div>




<p>Then you&#8217;ll want to run <strong>yum-complete-transaction</strong>. Pay special attention to how many unfinished transactions this command finds. Multiple yum transactions can get queued up so you may need to run <strong>yum-complete-transaction</strong> multiple times. If you do need to run it more than once, it runs the last unfinished transaction first, and then the 2nd to last, and so on until they&#8217;re all completed. Don&#8217;t be alarmed if it says it&#8217;s removing what appear to be critical packages such as bash. This occured on several of my systems and it turned out that there was multiple bashes installed (at least according to the <span class="caps">RPM </span>database) and the unfinished transaction was merely trying to uninstall the previous version, leaving the latest version intact.</p>

<p>A bonus to running <strong>yum-complete-transaction</strong>, is that it helps reduce the memory footprint that yum needs when it has unfinished transactions vs. when it doesn&#8217;t. I was seeing yum using 50-100MB in some cases due to all the unfinished transactions, so fixing this issue helped with minimizing future problems that I may see related to issue #1, not enough <span class="caps">RAM.</span></p>

<h4>Final Thoughts</h4>

<p>My original plan was that I would create a single OpenVZ image that included everything that I needed as far as packages go, and then selectively turn on and off apps that I didn&#8217;t need, like apache, for example. Going forward I&#8217;m going to try a completely different approach, and thin out each image to only include the bare minimum, to perform it&#8217;s job, i.e. mail server, samba server, etc. This should help out with a lot of redundant updating to all the VEs with packages that only 1 or 2 will actually need. The downside with this approach, and reason I avoided it to begin with, was that it seemed to be more work in maintaining many different images, but in practice this may not be as bad as having a single monolithic image multiplied many times across many VEs. </p>

<p>OpenVZ is still a tremendous tool here. Many times when I ran into a problem, I simply restored an image from backup and then resumed, so this isn&#8217;t a slam on it, and more a workflow issue and what&#8217;s the best way to manage many instances of machines. Really what I want is a way to manage roles of machines. Perhaps it&#8217;s time to revisit using something like <a href="http://reductivelabs.com/trac/puppet/wiki/AboutPuppet">puppet</a>?</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/1114/keeping-centos-5-openvz-images-up-to-date-with-yum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[one-liner]: Determining a Hard Drive&#8217;s Manufaturer Under Fedora 10 &amp; CentOS 5</title>
		<link>http://www.lamolabs.org/blog/2602/one-liner-determining-a-hard-drives-manufaturer-under-fedora-10-centos-5/</link>
		<comments>http://www.lamolabs.org/blog/2602/one-liner-determining-a-hard-drives-manufaturer-under-fedora-10-centos-5/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 14:13:51 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2602</guid>
		<description><![CDATA[Background

<p>I recently saw a post over on Linux Journal that discussed how to glean information about a system&#8217;s hard drive, such as its serial number, without having to actually open up the case and physically check it. So I thought I&#8217;d take the opportunity to write up a blog post with the specifics of how [...]]]></description>
			<content:encoded><![CDATA[<h4>Background</h4>

<p>I recently saw a <a href="http://www.linuxjournal.com/content/tech-tip-retrieve-disk-info-command-line">post</a> over on <a href="http://www.linuxjournal.com/">Linux Journal</a> that discussed how to glean information about a system&#8217;s hard drive, such as its serial number, without having to actually open up the case and physically check it. So I thought I&#8217;d take the opportunity to write up a blog post with the specifics of how to do this under Fedora &amp; CentOS, just so I&#8217;d have this info handy for future use.</p>

<p><span class="caps">BTW,</span> I was able to accomplish this task several different ways, so this post will cover all the different ways that I could get this info.</p>

<h4>Command #1: lshw</h4>

<p>This is probably the best tool for getting at a system&#8217;s internals. First make sure it&#8217;s installed.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p260298"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2602code98"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> lshw</pre></td></tr></table></div>




<p>For our example you would run the command <strong>lshw -class disk</strong>:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p260299"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p2602code99"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> lshw <span style="color: #660033;">-class</span> disk
  <span style="color: #000000; font-weight: bold;">*</span>-disk                  
       description: ATA Disk
       product: HTS726060M9AT00
       vendor: Hitachi
       physical <span style="color: #c20cb9; font-weight: bold;">id</span>: 0
       bus info: scsi<span style="color: #000000; font-weight: bold;">@</span>0:0.0.0
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda
       version: MH4O
       serial: MRH403M4GS551Y
       <span style="color: #c20cb9; font-weight: bold;">size</span>: 55GiB <span style="color: #7a0874; font-weight: bold;">&#40;</span>60GB<span style="color: #7a0874; font-weight: bold;">&#41;</span>
       capabilities: partitioned partitioned:dos
       configuration: <span style="color: #007800;">ansiversion</span>=5 <span style="color: #007800;">signature</span>=cccdcccd
  <span style="color: #000000; font-weight: bold;">*</span>-cdrom
       description: DVD reader
       product: UJDA755yDVD<span style="color: #000000; font-weight: bold;">/</span>CDRW
       vendor: MATSHITA
       physical <span style="color: #c20cb9; font-weight: bold;">id</span>: 1
       bus info: scsi<span style="color: #000000; font-weight: bold;">@</span>1:0.0.0
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>cdrom
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>cdrw
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>dvd
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>scd0
       logical name: <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sr0
       version: 1.71
       capabilities: removable audio cd-r cd-rw dvd
       configuration: <span style="color: #007800;">ansiversion</span>=5 <span style="color: #007800;">status</span>=nodisc</pre></td></tr></table></div>




<p>The first section that&#8217;s returned is called <strong>-disk</strong>. Here&#8217;s you&#8217;ll see the vendor: Hitachi, the product number, <span class="caps">HTS726060M9AT00, </span>and my serial number: <span class="caps">MRH403M4GS551Y.</span></p>

<h4>Command #2: smartctl</h4>

<p>The next tool that would give this type of info is called <strong>smartctl</strong>. It&#8217;s a tool that&#8217;s part of the smartmontool package. You may be familiar with the acronym <a href="http://en.wikipedia.org/wiki/S.M.A.R.T"><span class="caps">S.M.A.R.T.</span></a>. The acronym stands for: <strong>Self-Monitoring, Analysis, and Reporting Technology</strong>. This is a standard that most modern disks have in which vital statistics about a disk drive are provided through a standard <span class="caps">API.</span> Here&#8217;s how to install it.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602100"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2602code100"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> smartmontools</pre></td></tr></table></div>




<p>&#8230;and once installed you can use the bundled in tool <strong>smartctl</strong> like so:</p>

<p><span id="more-2602"></span></p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602101"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p2602code101"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># smartctl example</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> smartctl <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda
smartctl version 5.38 <span style="color: #7a0874; font-weight: bold;">&#91;</span>i386-redhat-linux-gnu<span style="color: #7a0874; font-weight: bold;">&#93;</span> Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span> 2002-8 Bruce Allen
Home page is http:<span style="color: #000000; font-weight: bold;">//</span>smartmontools.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
=== START OF INFORMATION SECTION ===
Model Family:     Hitachi Travelstar 7K60
Device Model:     HTS726060M9AT00
Serial Number:    MRH403M4GS551Y
Firmware Version: MH4OA6BA
User Capacity:    60,011,642,880 bytes
Device is:        In smartctl database <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">for</span> details use: <span style="color: #660033;">-P</span> show<span style="color: #7a0874; font-weight: bold;">&#93;</span>
ATA Version is:   <span style="color: #000000;">6</span>
ATA Standard is:  ATA<span style="color: #000000; font-weight: bold;">/</span>ATAPI-<span style="color: #000000;">6</span> T13 1410D revision 3a
Local Time is:    Mon Sep <span style="color: #000000;">21</span> 00:03:<span style="color: #000000;">50</span> <span style="color: #000000;">2009</span> EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled</pre></td></tr></table></div>




<h4>Command #3: hdparm</h4>

<p>Another way that I&#8217;ve used to get at hard drive meta data is with the command <strong>hdparm</strong>. This is probably the oldest way, at least that I&#8217;m familiar with, for getting at hard drive meta data. To install it:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602102"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2602code102"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> hdparm</pre></td></tr></table></div>




<p>Using it is simply:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602103"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code" id="p2602code103"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># hdparm example</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> hdparm <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda:
&nbsp;
 <span style="color: #007800;">Model</span>=HTS726060M9AT00                         , <span style="color: #007800;">FwRev</span>=MH4OA6BA, <span style="color: #007800;">SerialNo</span>=      MRH403M4GS551Y
 <span style="color: #007800;">Config</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span> HardSect NotMFM HdSw<span style="color: #000000; font-weight: bold;">&gt;</span>15uSec Fixed DTR<span style="color: #000000; font-weight: bold;">&gt;</span>10Mbs <span style="color: #7a0874; font-weight: bold;">&#125;</span>
 <span style="color: #007800;">RawCHS</span>=16383<span style="color: #000000; font-weight: bold;">/</span>16<span style="color: #000000; font-weight: bold;">/</span>63, <span style="color: #007800;">TrkSize</span>=0, <span style="color: #007800;">SectSize</span>=0, <span style="color: #007800;">ECCbytes</span>=4
 <span style="color: #007800;">BuffType</span>=DualPortCache, <span style="color: #007800;">BuffSize</span>=7877kB, <span style="color: #007800;">MaxMultSect</span>=16, <span style="color: #007800;">MultSect</span>=?0?
 <span style="color: #007800;">CurCHS</span>=16383<span style="color: #000000; font-weight: bold;">/</span>16<span style="color: #000000; font-weight: bold;">/</span>63, <span style="color: #007800;">CurSects</span>=16514064, <span style="color: #007800;">LBA</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>, <span style="color: #007800;">LBAsects</span>=117210240
 <span style="color: #007800;">IORDY</span>=on<span style="color: #000000; font-weight: bold;">/</span>off, <span style="color: #007800;">tPIO</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span>min:240,w<span style="color: #000000; font-weight: bold;">/</span>IORDY:120<span style="color: #7a0874; font-weight: bold;">&#125;</span>, <span style="color: #007800;">tDMA</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span>min:120,rec:120<span style="color: #7a0874; font-weight: bold;">&#125;</span>
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 <span style="color: #000000; font-weight: bold;">*</span>udma5 
 <span style="color: #007800;">AdvancedPM</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>: <span style="color: #007800;">mode</span>=0xC0 <span style="color: #7a0874; font-weight: bold;">&#40;</span>192<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">WriteCache</span>=enabled
 Drive conforms to: ATA<span style="color: #000000; font-weight: bold;">/</span>ATAPI-<span style="color: #000000;">6</span> T13 1410D revision 3a:  ATA<span style="color: #000000; font-weight: bold;">/</span>ATAPI-<span style="color: #000000;">2</span>,<span style="color: #000000;">3</span>,<span style="color: #000000;">4</span>,<span style="color: #000000;">5</span>,<span style="color: #000000;">6</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">*</span> signifies the current active mode</pre></td></tr></table></div>




<h4>Command #4: lsscsi</h4>

<p>Here&#8217;s another tool, <strong>lsscsi</strong>, that I&#8217;ve used off and on to get at hard drive meta data. It&#8217;s probably the least known of all the tools mentioned here. Installation is the same as the others:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602104"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2602code104"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> lsscsi</pre></td></tr></table></div>




<p>It&#8217;s usage is pretty much in-line with the other commands too:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602105"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code" id="p2602code105"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># lsscsi example</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> lsscsi <span style="color: #660033;">-lll</span> <span style="color: #660033;">-vvv</span>
 sysfsroot: <span style="color: #000000; font-weight: bold;">/</span>sys
<span style="color: #7a0874; font-weight: bold;">&#91;</span>0:0:0:0<span style="color: #7a0874; font-weight: bold;">&#93;</span>    disk    ATA      HTS726060M9AT00  MH4O  <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda
  <span style="color: #007800;">device_blocked</span>=0
  <span style="color: #007800;">iocounterbits</span>=32
  <span style="color: #007800;">iodone_cnt</span>=0x92983
  <span style="color: #007800;">ioerr_cnt</span>=0x4f
  <span style="color: #007800;">iorequest_cnt</span>=0x92983
  <span style="color: #007800;">queue_depth</span>=1
  <span style="color: #007800;">queue_type</span>=none
  <span style="color: #007800;">scsi_level</span>=6
  <span style="color: #007800;">state</span>=running
  <span style="color: #007800;">timeout</span>=60
  <span style="color: #7a0874; font-weight: bold;">type</span>=0
  <span style="color: #c20cb9; font-weight: bold;">dir</span>: <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>bus<span style="color: #000000; font-weight: bold;">/</span>scsi<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span>0:0:0:0  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span>pci0000:00<span style="color: #000000; font-weight: bold;">/</span>0000:00:1f.1<span style="color: #000000; font-weight: bold;">/</span>host0<span style="color: #000000; font-weight: bold;">/</span>target0:0:0<span style="color: #000000; font-weight: bold;">/</span>0:0:0:0<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>1:0:0:0<span style="color: #7a0874; font-weight: bold;">&#93;</span>    cd<span style="color: #000000; font-weight: bold;">/</span>dvd  MATSHITA UJDA755yDVD<span style="color: #000000; font-weight: bold;">/</span>CDRW 1.71  <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sr0
  <span style="color: #007800;">device_blocked</span>=0
  <span style="color: #007800;">iocounterbits</span>=32
  <span style="color: #007800;">iodone_cnt</span>=0xa0f7
  <span style="color: #007800;">ioerr_cnt</span>=0x0
  <span style="color: #007800;">iorequest_cnt</span>=0x283a7
  <span style="color: #007800;">queue_depth</span>=1
  <span style="color: #007800;">queue_type</span>=none
  <span style="color: #007800;">scsi_level</span>=6
  <span style="color: #007800;">state</span>=running
  <span style="color: #007800;">timeout</span>=0
  <span style="color: #7a0874; font-weight: bold;">type</span>=5
  <span style="color: #c20cb9; font-weight: bold;">dir</span>: <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>bus<span style="color: #000000; font-weight: bold;">/</span>scsi<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span>pci0000:00<span style="color: #000000; font-weight: bold;">/</span>0000:00:1f.1<span style="color: #000000; font-weight: bold;">/</span>host1<span style="color: #000000; font-weight: bold;">/</span>target1:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div>




<h4>Command #4: /dev/disk/by-id directory</h4>

<p>Finally you can get the manufacturer&#8217;s product number &amp; serial number can be had by going directly to the /dev directory, specifically here: <strong>/dev/disk/by-id</strong>. In the resulting output you&#8217;ll see 2 important substrings. The first, <span class="caps">HTS726060M9AT00, </span>is he product number while the second, <span class="caps">MRH403M4GS551Y, </span>is the serial number.</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2602106"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2602code106"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /dev/disk/by-id example</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk<span style="color: #000000; font-weight: bold;">/</span>by-id
ata-HTS726060M9AT00_MRH403M4GS551Y
ata-HTS726060M9AT00_MRH403M4GS551Y-part1
ata-HTS726060M9AT00_MRH403M4GS551Y-part2
scsi-SATA_HTS726060M9AT00_MRH403M4GS551Y
scsi-SATA_HTS726060M9AT00_MRH403M4GS551Y-part1
scsi-SATA_HTS726060M9AT00_MRH403M4GS551Y-part2</pre></td></tr></table></div>




<p><strong><span class="caps">NOTE</span>:</strong> For further details regarding my <strong>one-liner</strong> blog posts, check out my <a href="http://www.lamolabs.org/blog/2147/intro-blogs-one-liner-code-block-style-guides/">one-liner style guide primer</a>.</p><div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2602/one-liner-determining-a-hard-drives-manufaturer-under-fedora-10-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing WordPress Posts with vim</title>
		<link>http://www.lamolabs.org/blog/2083/managing-wordpress-posts-with-vim/</link>
		<comments>http://www.lamolabs.org/blog/2083/managing-wordpress-posts-with-vim/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:27:25 +0000</pubDate>
		<dc:creator>slmingol</dc:creator>
				<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.lamolabs.org/blog/?p=2083</guid>
		<description><![CDATA[
   .aligncenter,div.aligncenter { margin-left: 14%; margin-right: auto; display: block;}









<p>I&#8217;m a vim guy through and through. Always have been. But I&#8217;m no zealot. I say you use the tool that does the job. So for example, I&#8217;ve used xemacs on occasion, and it definitely has its strengths. But for day to day I&#8217;ve always [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">
   .aligncenter,div.aligncenter { margin-left: 14%; margin-right: auto; display: block;}
</style>








<p>I&#8217;m a <a href="http://www.vim.org/">vim</a> guy through and through. Always have been. But I&#8217;m no zealot. I say you use the tool that does the job. So for example, I&#8217;ve used <a href="http://www.xemacs.org/">xemacs</a> on occasion, and it definitely has its strengths. But for day to day I&#8217;ve always come back to using vim. So when I setup this blog, I knew early on that if I was going to post at any sort of meaningful frequency, I would have to figure out how to do it through vim. Additionally I&#8217;ve grown accustom to mark up languages such as <a href="http://en.wikipedia.org/wiki/Markdown">markdown</a> &amp; <a href="http://en.wikipedia.org/wiki/Textile_%28markup_language%29">textile</a>, so I knew I&#8217;d want to mix this capability in to both my blog &amp; vim, as well. </p>

<p><strong><span class="caps">NOTE</span>:</strong> refer to these <a href="http://www.wikipedia.org/">Wikipedia</a> pages if you&#8217;re unfamiliar with <a href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29">vim</a>, <a href="http://en.wikipedia.org/wiki/Xemacs">xemacs</a>, <a href="http://en.wikipedia.org/wiki/Markdown">markdown</a> or <a href="http://en.wikipedia.org/wiki/Textile_%28markup_language%29">textile</a>.</p>

<h4>Preliminary Step</h4>

<p>Before we get started, make sure that your blog is configured to accept <strong><span class="caps">XML</span>-RPC</strong>. This is a <strong>remote procedure call mechanism</strong> that allows <strong>external tools</strong> to submit posts to your blog. The option is underneath the <strong>site admin section</strong> of Wordpress. You can get to the option under <strong>Settings &#8211;&gt; Writing</strong>. The option looks like this:</p>

<div id="attachment_2532" class="wp-caption aligncenter" style="width: 660px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_enable_xmlrpc.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_enable_xmlrpc-650x246.png" alt="XML-RPC Option" title="ss_enable_xmlrpc" width="650" height="246" class="size-medium wp-image-2532" /></a><p class="wp-caption-text">XML-RPC Option</p></div>

<h4>Getting Started</h4>




<p>After googling a bit I came across a <strong>plugin for vim</strong> called <a href="http://symlink.me/wiki/blogit">Blogit</a>. The main developers page for <a href="http://symlink.me/wiki/blogit">Blogit is here</a>, while the primary <a href="http://www.vim.org/scripts/script.php?script_id=2582">vim.org plugin page is here</a>. The latest version at the time of this article was <a href="http://symlink.me/attachments/download/16/blogit-1.3.tar.bz2">1.3</a>. Installation couldn&#8217;t have been simpler.</p>

<h4>Installation</h4>


<div class="wp_codebox"><table width="100%" ><tr id="p2083109"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p2083code109"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># get into vim's dot directory</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.vim
&nbsp;
<span style="color: #666666; font-style: italic;"># download Blogit</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>symlink.me<span style="color: #000000; font-weight: bold;">/</span>attachments<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span><span style="color: #000000; font-weight: bold;">/</span>blogit-1.3.tar.bz2
&nbsp;
<span style="color: #666666; font-style: italic;"># install blogit</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> jxvf blogit-1.3.tar.bz2
&nbsp;
<span style="color: #666666; font-style: italic;"># ~/.vim directory should look similar to this</span>
<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">tree</span> <span style="color: #660033;">-A</span> 
.
└── plugin
    ├── blogit.vim
    └── mock_vim.py
&nbsp;
<span style="color: #000000;">1</span> directory, <span style="color: #000000;">2</span> files</pre></td></tr></table></div>




<h4>Configuration</h4>

<p>The only other thing you need to do to setup the Blogit plugin is to create the following file: <strong>~/.vim/plugin/passwords.vim</strong>. In it you&#8217;ll need to add 3 pieces of information about your blog. A <strong>username</strong> &amp; <strong>password</strong> along with the <strong><span class="caps">URL </span>to your blog&#8217;s xmlrpc.php file</strong>. Here&#8217;s an example:</p>


<div class="wp_codebox"><table width="100%" ><tr id="p2083110"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2083code110"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot; login credentials for blog</span>
<span style="color: #804040;">let</span> blogit_username=<span style="color: #C5A22D;">'user1'</span>
<span style="color: #804040;">let</span> blogit_password=<span style="color: #C5A22D;">'password1'</span>
<span style="color: #804040;">let</span> blogit_url=<span style="color: #C5A22D;">'http://www.lamolabs.org/blog/xmlrpc.php'</span></pre></td></tr></table></div>




<h4>Blogit&#8217;s Interface</h4>

<p><span id="more-2083"></span></p>

<p>After firing up vim, you can get a list of all the Blogit commands with the vim command <strong>Blogit help</strong>, like so:<br />
<div id="attachment_2502" class="wp-caption aligncenter" style="width: 645px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_01.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_01.png" alt="blogit help" title="ss_vim_blogit_01" width="635" height="60" class="size-full wp-image-2502" /></a><p class="wp-caption-text">blogit help</p></div></p>

<p>You should get a split window in vim with the list of Blogit&#8217;s commands. <span class="caps">BTW, </span>most of these commands should be pretty self explanatory.<br />
<div id="attachment_2503" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_02.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_02.png" alt="blogit commands" title="ss_vim_blogit_02" width="636" height="255" class="size-full wp-image-2503" /></a><p class="wp-caption-text">blogit commands</p></div></p>

<p>To get a list of all the posts available, run the command <strong>&#8220;Blogit ls&#8221;</strong>.<br />
<div id="attachment_2504" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_03.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_03.png" alt="list of posts" title="ss_vim_blogit_03" width="636" height="64" class="size-full wp-image-2504" /></a><p class="wp-caption-text">list posts command</p></div></p>

<p>Again you&#8217;ll be presented with a list of all your blog posts, in a split window inside of vim.<br />
<div id="attachment_2505" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_04.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_04.png" alt="list of posts" title="ss_vim_blogit_04" width="636" height="295" class="size-full wp-image-2505" /></a><p class="wp-caption-text">list of posts</p></div></p>

<p>You can use your arrow keys to move the cursor up and down through the list of posts. Additionally you can open posts up by placing the cursor on one, and pressing the enter key. In the example below, I&#8217;ve selected <strong>post#: 2362</strong>. Hitting return results in this particular post being opened up in vim&#8217;s primary window.<br />
<div id="attachment_2506" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_05.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_05.png" alt="scrollable window" title="ss_vim_blogit_05" width="636" height="259" class="size-full wp-image-2506" /></a><p class="wp-caption-text">scrollable window</p></div></p>

<p>Here&#8217;s the results of <strong>post#: 2362</strong> being opened.<br />
<div id="attachment_2507" class="wp-caption aligncenter" style="width: 646px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_06.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_06.png" alt="view selected post" title="ss_vim_blogit_06" width="636" height="365" class="size-full wp-image-2507" /></a><p class="wp-caption-text">view selected post</p></div></p>

<p>Running the command <strong>&#8220;Blogit ls&#8221;</strong> again brings up the list of all the existing posts.<br />
<div id="attachment_2508" class="wp-caption aligncenter" style="width: 645px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_07.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_vim_blogit_07.png" alt="scroll another post" title="ss_vim_blogit_07" width="635" height="365" class="size-full wp-image-2508" /></a><p class="wp-caption-text">scroll another post</p></div></p>

<h4>Mark Up Languages</h4>




<p>As I mentioned previously I&#8217;m a big fan of mark up languages such as <a href="http://en.wikipedia.org/wiki/Markdown">markdown</a> &amp; <a href="http://en.wikipedia.org/wiki/Textile_%28markup_language%29">textile</a>. For no other reason, than I just prefer it, I chose to use Textile. To enable Textile support within Wordpress I installed the plugin <a href="http://wordpress.org/extend/plugins/textile-2">Textile2</a>. If you check out the <a href="http://wordpress.org/extend/plugins/">Wordpress Plugins Directory</a> there appears to be a number of <a href="http://wordpress.org/extend/plugins/search.php?q=textile">suitable textile plugins</a>. Even though this particular plugin hadn&#8217;t been updated for sometime it has worked flawlessly for 8+ months under the latest versions of Wordpress (i.e. 2.7 up to 2.8.4+). </p>

<p>Here&#8217;s a screenshot of Textile2&#8217;s configuration pane in Wordpress:</p>

<div id="attachment_2533" class="wp-caption aligncenter" style="width: 506px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_config_textile2.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_config_textile2.png" alt="Textile2 Config" title="ss_config_textile2" width="496" height="425" class="size-full wp-image-2533" /></a><p class="wp-caption-text">Textile2 Config</p></div>


<p>Also to close one final loop, I installed the Wordpress plugin <a href="http://wordpress.org/extend/plugins/wp-markitup/">WP markItUp!</a>, on the off chance that I might actually use the <strong>web based editor</strong> for tweaking a post here or there. Installing this plugin basically switches the default Wordpress editor out for one that can handle an assortment of mark up languages, Textile being one of them. Here&#8217;s a screenshot of <strong>post#: 2362</strong>.</p>

<div id="attachment_2534" class="wp-caption aligncenter" style="width: 660px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_markitup_editor.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_markitup_editor-650x514.png" alt="WP markItUp! Editor Example" title="ss_markitup_editor" width="650" height="514" class="size-medium wp-image-2534" /></a><p class="wp-caption-text">WP markItUp! Editor Example</p></div>

<p>Here&#8217;s how I configured the <strong>WP markItUp! plugin</strong>:</p>

<div id="attachment_2535" class="wp-caption aligncenter" style="width: 367px"><a href="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_config_markitup.png" rel="lightbox[2083]"><img src="http://www.lamolabs.org/blog/wp-content/uploads/2009/09/ss_config_markitup.png" alt="WP markItUp! Config" title="ss_config_markitup" width="357" height="290" class="size-full wp-image-2535" /></a><p class="wp-caption-text">WP markItUp! Config</p></div>

<h4>Conclusions</h4>

<p>I&#8217;ve been using this setup for several months and it has just worked. I highly suggest you check it out if you maintain your own blog in Wordpress and you too prefer working in vim.</p>

<p><strong><span class="caps">NOTE</span>:</strong> For further details regarding my <strong>one-liner</strong> blog posts, check out my <a href="http://www.lamolabs.org/blog/2147/intro-blogs-one-liner-code-block-style-guides/">one-liner style guide primer</a>.</p><div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.lamolabs.org/blog/2662/fixing-ruby-support-in-vim-on-fedora-10-11-and-centos-5-installing-the-vim-textile-plugin/" rel="bookmark" class="wherego_title">Fixing Ruby Support in Vim on Fedora 10, 11, and CentOS 5 &#038; Installing the Vim Textile plugin</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.lamolabs.org/blog/2083/managing-wordpress-posts-with-vim/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
