<?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>Admon Home &#187; System Tuning</title>
	<atom:link href="http://www.admon.org/system-tuning/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.admon.org</link>
	<description>Linux System Administration</description>
	<lastBuildDate>Sat, 11 Feb 2012 03:23:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Resize root partition for a running EBS EC2 Instance</title>
		<link>http://www.admon.org/resize-root-partition-for-a-running-ebs-ec2-instance/</link>
		<comments>http://www.admon.org/resize-root-partition-for-a-running-ebs-ec2-instance/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 02:59:39 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[ext3]]></category>
		<category><![CDATA[xfs]]></category>

		<guid isPermaLink="false">http://www.admon.org/?p=1043</guid>
		<description><![CDATA[As long as you are all right with a little downtime of the EC2 instance (in a few minutes), it is possible to extend the root partition on a running EBS boot EC2 instance, without needing to start a new instance. Before starting playing the trick, you need to have Amzon EC2 API tools installed. [...]]]></description>
			<content:encoded><![CDATA[<p>As long as you are all right with a little downtime of the EC2 instance (in a few minutes), it is possible to extend the root partition on a running EBS boot EC2 instance, without needing to start a new instance. <span id="more-1043"></span></p>
<p>Before starting playing the trick, you need to have <a title="Amazon EC2 API tools" href="http://www.admon.org/setup-amazon-ec2-api-tools-on-macbook/" target="_blank">Amzon EC2 API tools</a> installed.</p>
<p>Then the steps are:</p>
<ol>
<li>Shutdown the instance and detach the volume.</li>
<li>Build a snapshot for the detached volume and create a volume with a larger size based on the snapshot.</li>
<li>Attach the new volume to the instance and start it.</li>
<li>Login the instance and resize the root file system to fill the new EBS volume.</li>
</ol>
<p>Commands for the last step are listed as below:</p>
<pre># ext3 root file system (more common):
sudo resize2fs /dev/sda1

# XFS root file system (less common):
sudo xfs_growfs /</pre>
<p>xfs_growfs is supplied by <a title="XFS" href="http://oss.sgi.com/projects/xfs/" target="_blank">xfsprogs</a>, which can be installed via yum (or apt-get).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/resize-root-partition-for-a-running-ebs-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>vmtouch: File system cache diagnostics and control</title>
		<link>http://www.admon.org/vmtouch-file-system-cache-diagnostics-and-control/</link>
		<comments>http://www.admon.org/vmtouch-file-system-cache-diagnostics-and-control/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 15:45:20 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[fincore]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[vmtouch]]></category>

		<guid isPermaLink="false">http://www.admon.org/?p=1034</guid>
		<description><![CDATA[From the topic above, you may have remembered one of our former post &#8220;what data is cached by operation system&#8220;. This is a similar tool as Fincore, but it&#8217;s more powerful. It&#8217;s written in C and supports UNIX and unix-like systems. The installation is quite simple, you just need to download the source code, and run [...]]]></description>
			<content:encoded><![CDATA[<p>From the topic above, you may have remembered one of our former post &#8220;<a title="what data cached by OS" href="http://www.admon.org/what-data-is-cached-by-operation-system/" target="_blank">what data is cached by operation system</a>&#8220;. This is a similar tool as Fincore, but it&#8217;s more powerful. It&#8217;s written in C and supports UNIX and unix-like systems.<span id="more-1034"></span></p>
<p>The installation is quite simple, you just need to download the <a href="http://hoytech.com/vmtouch/vmtouch.c" target="_blank">source code</a>, and run below command to compile it:</p>
<pre>$ gcc -Wall -O3 -o vmtouch vmtouch.c</pre>
<p>The usage examples can be seen at <a href="http://hoytech.com/vmtouch/" target="_blank">its homepage</a>.</p>
<p>Its key features are:</p>
<ul>
<li>How much data of a file (or a directory) is currently in cache.</li>
<li>Bring a file (or part of a file) into system memory.</li>
<li>Ask the system to <strong>evict</strong> a specified file from memory, making room for other files.</li>
<li><strong>Daemonise</strong> and <strong>lock</strong> specified files into physical memory (Make sense?)</li>
</ul>
<p>Want to have a try? Please click this link: <a href="http://hoytech.com/vmtouch/" target="_blank">http://hoytech.com/vmtouch/</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/vmtouch-file-system-cache-diagnostics-and-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sync two Amazon S3 buckets</title>
		<link>http://www.admon.org/sync-two-amazon-s3-buckets/</link>
		<comments>http://www.admon.org/sync-two-amazon-s3-buckets/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 02:11:35 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[buckets]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[s3cmd]]></category>

		<guid isPermaLink="false">http://www.admon.org/?p=922</guid>
		<description><![CDATA[When using Amazon S3 to store the web files, you may face this question sometimes, How can I keep the files for my productive environment exactly the same as develop environment? (In other words, you want to remove the unused files in dev environment.) If it&#8217;s a normal working environment, rsync is a nice solution [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-797" title="Amazon" src="http://www.admon.org/wp-content/uploads/2010/11/amazon_chart-150x150.gif" alt="Amazon web services" width="150" height="150" />When using <a title="Amazon S3" href="http://aws.amazon.com/s3/" target="_blank">Amazon S3</a> to store the web files, you may face this question sometimes,<br />
How can I keep the files for my productive environment exactly the same as develop environment? (In other words, you want to remove the unused files in dev environment.)<span id="more-922"></span></p>
<p>If it&#8217;s a normal working environment, rsync is a nice solution and its <em>&#8211;delete</em> parameter does what we expect. Then, <strong>on Amazon S3 is there a solution for us to keep two buckets synced smoothly?</strong></p>
<p>Here we&#8217;ll show a working solution with <a title="s3cmd" href="http://www.admon.org/s3cmd-amazon-s3-command-line-interface/" target="_blank">s3cmd</a>. Other <a title="Amazon S3 clients" href="http://www.labnol.org/internet/amazon-s3-clients-roundup/8286/" target="_blank">Amazon S3 clients</a> may have similar features, but we will not explain them here.<br />
By using the bucket sync feature, you need to update to <a title="s3cmd-1.0.0 released" href="http://s3tools.org/s3cmd-100-released" target="_blank">version 1.0.0</a>, prior to this version, bucket syncing is not supported, and you may face this error:</p>
<pre>root@demo:~# s3cmd sync --delete-removed s3://admon/brands s3://admon-dev/
ERROR: Parameter problem: Invalid source/destination: 's3://admon/brands' 's3://admon-dev/'</pre>
<p>When s3cmd updated, the command is as simple as what rsync does:</p>
<pre>s3cmd sync --delete-removed --acl-public s3://admon/brands s3://admon-dev/</pre>
<p>The <em>&#8211;delete-removed</em> option has the same meaning as rsync&#8217;s <em>&#8211;delete</em> parameter, and <em>&#8211;acl-public</em> is an extra parameter which is used to set your files publicly accessible. If you want to keep your pictures private, you can just remove <em>&#8211;acl-public</em>.</p>
<p>Note: If you have a extremly large number of pictures (like more than 100k pictures), this command takes a significate amount of memory. As for my test, it takes 2.7GB resident memory when the bucket contains 500k objects ( pictures and directories).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/sync-two-amazon-s3-buckets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Tips on Amazon S3 hosting optimization</title>
		<link>http://www.admon.org/5-tips-on-amazon-s3-hosting-optimization/</link>
		<comments>http://www.admon.org/5-tips-on-amazon-s3-hosting-optimization/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 03:36:03 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[HTTP Headers]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[s3hub]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=869</guid>
		<description><![CDATA[If you use Amazon S3 (or CloudFront) as a web hosting provider, here are some essential tips that you should know about. These tips are mainly for front-end optimizations, including reduce S3 bandwidth, reduce unnecessary requests to S3, check abnormal requests and optimizations on file transfer. Before moving ahead, you need a S3 file manager. [...]]]></description>
			<content:encoded><![CDATA[<p>If you use <a href="http://aws.amazon.com/s3/" target="_blank">Amazon S3</a> (or CloudFront) as a web hosting provider, here are some essential tips that you should know about. These tips are mainly for front-end optimizations, including reduce S3 bandwidth, reduce unnecessary requests to S3, check abnormal requests and optimizations on file transfer.<span id="more-869"></span></p>
<p>Before moving ahead, you need a S3 file manager. There are a couple of good S3 file managers that can be used to manage S3 files like <a href="http://planet.admon.org/s3cmd-amazon-s3-command-line-interface/" target="_blank">S3Cmd</a>, S3Hub, S3Fox and <a href="http://cloudberrylab.com/?page=cloudberry-explorer-amazon-s3" target="_blank">CloudBerry Explorer</a> (only available on Windows). It&#8217;s suggested to use S3Hub (or Cloudberry Explorer) as it implements the features that we mentioned here.</p>
<p><strong>Tip #1: Are S3 files misused by others? Enable the S3 access logging.</strong></p>
<p>Amazon S3&#8242;s bandwidth rates are inexpensive and you pay for what you use. The problem is that if other websites are linking to your S3 hosted content (like images, MP3s, Flash videos, etc.),  you&#8217;ll also have to pay for bandwidth that used by these sites.</p>
<p>Unlike Apache web servers where you can easily prevent referred links from other websites, Amazon S3 doesn&#8217;t offer such mechanism but what you can do is to enable logging for your S3 buckets. Amazon will log all client requests in logs and you can parse them later. If you noticed a file is heavily referred to by other websites, you may rename the file on S3 or just delete it if you&#8217;re ok with that.</p>
<p> By implementing it, you create a new S3 bucket, then right-click the bucket name, choose &#8220;Logging&#8221; then specify the bucket to store the log files.</p>
<p><strong>Tip #2: Set Expiry Headers for Static Files</strong></p>
<p>The cost for GET requests is small (just 1¢ per 10,000 requests), they can quickly add-up if you have have a popular site or if your website design uses too many images. It is important that you add an an Expires or a Cache-Control HTTP Header for static content on your site like images, css/js files.</p>
<p>The gist is that all web browsers store objects in their cache and this Expires header in the HTTP response tells the browser how long that object should stay in the cache. So if you can set the Expires date sometime in future and client browser won&#8217;t request the object again.</p>
<p>To set an expires header, right click the S3 object properties, choose HTTP headers and add a new header. Call it &#8220;Expires&#8221; and set an expiration date like &#8220;Fri, Apr 23 2021 10:18:36 GMT&#8221;.</p>
<p>Other than saving money, your site will also load relatively faster because the visitor&#8217;s browser will not establish as much connections/queries as it was.</p>
<p>If you are worried about setting Cache headers for JavaScript and CSS files as they may change frequently (especially when you are in the midst of a site re-design), just append a version number after the file name like how commonly rubyonrails application does.</p>
<p><a href="http://bucketname.s3.amazonaws.com/main.png?v=1303523470"></a></p>
<p>When the <em>main.png</em> on S3 updated, you just need to change the version number and visitors browser will make a fresh GET request to Amazon S3 for the latest version of the S3 file.</p>
<p><strong>Tip #3: Use Amazon S3 with a reasonable Domain Name</strong></p>
<p>When a new bucket on Amazon S3 is created, setting the file access to public and Amazon will provide you with a public URL which is something like:</p>
<p>http://bucketname.s3.amazonaws.com/filename</p>
<p>http://s3.amazonaws.com/bucketname/filename</p>
<p>It&#8217;s suggested to use the first URL since you can do the Tip #4 mentioned below.</p>
<p><strong>Tip #4: Block search engine crawlers on your Amazon S3</strong></p>
<p>To prevent robots from indexing files stored in your Amazon S3 buckets, create a robots.txt file in the root directory with the content:</p>
<pre>User-agent: *
Disallow: /</pre>
<p>Make sure that you update the ACL (or access permissions) to public otherwise spiders won&#8217;t find your robots.txt file.</p>
<p><strong>Tip #5: Other Optimizations on File transferring</strong><br />
Torrent Delivery for large files</p>
<p>If you are planning to distribute some large files of the web (like a software installer or some database dump) via Amazon S3, it makes sense to use BitTorrent with S3 so that you don&#8217;t necessarily have to pay for all the download bandwidth. The starting point for a BitTorrent download is a .torrent file and you can quickly create a .torrent file to any S3 object by adding &#8220;?torrent&#8221; to the original web URL like this:</p>
<pre>http://bucketname.s3.amazonaws.com/software-installer.zip?torrent</pre>
<p>Create Time Limited Links</p>
<p>By default all public files in your S3 account are available for download forever until you delete the file or change the permissions. However, if you are running some sort of contest on your site where you are giving away a PDF ebook or some MP3 ringtone to your visitors, it doesn&#8217;t make sense to have those file live on your S3 server beyond the duration of the contest. You should therefore consider creating &#8220;signed URLs&#8221; for such temporary S3 files &#8211; these are time limited URLs that are valid for a specific time period and expire afterwards (or return 404s).</p>
<p>Right click a file in the S3 bucket, choose Web URL and then set a Expiry Time. Click Generate to created a &#8220;signed URL&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/5-tips-on-amazon-s3-hosting-optimization/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Simple way to create Amazon EC2 AMI from running instance</title>
		<link>http://www.admon.org/simple-way-to-create-amazon-ec2-ami-from-running-instance/</link>
		<comments>http://www.admon.org/simple-way-to-create-amazon-ec2-ami-from-running-instance/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 12:08:02 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[AMI]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=835</guid>
		<description><![CDATA[When you have a running EC2 instance, you can build your production environment there, install whatever the packages you need, tweak system-wide configurations to meet your needs&#8230; Then you might wanna build your own AMI image to simplify future deployment. Here we&#8217;ll show a quick example on how to build an EBS-backed AMI. This AMI [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-797" title="Amazon" src="http://planet.admon.org/wp-content/uploads/2010/11/amazon_chart-150x150.gif" alt="Amazon web services" width="150" height="150" /></p>
<p>When you have a running <a href="http://aws.amazon.com/">EC2 instance</a>, you can build your production environment there, install whatever the packages you need, tweak system-wide configurations to meet your needs&#8230; Then you might wanna build your own AMI image to simplify future deployment.<span id="more-835"></span></p>
<p>Here we&#8217;ll show a quick example on how to build an EBS-backed AMI. This AMI is generated from one of your running instance.</p>
<p><strong>First: Create an EBS volume</strong><br />
This volume will be use as the root partition for new instances, and you can specify whatever size you need. It&#8217;s suggested to be at least 3GB. When this volume is created, attach it to the running instance as device <em>/dev/sdc</em>. We assume that the new volume id is <em>vol-8ee49ce6</em>, and the running instance&#8217;s kernel id is <em>aki-6603f70f</em>. We&#8217;ll use these two ID in the final step.<br />
When the new volume attached, you can use these command to build the file-system on it, then mount it as <em>/mnt/ebs</em></p>
<pre># mkfs.ext3 /dev/sdc
# mkdir /mnt/ebs
# mount /dev/sdc /mnt/ebs</pre>
<p><strong>Step 2: Sync the running system to the new volume</strong><br />
If there&#8217;s any service running on the instance, it&#8217;s suggested to shut them down. It’ll save you hassles later. Then, use rsync to copy everything over to the EBS volume:</p>
<pre># rsync -ax --exclude=/mnt/* --delete --progress / /mnt/ebs</pre>
<p>Before copying the system, make sure your instance is tweaked well, like you might need to update <em>/etc/fstab</em> to remove some unused devices.<br />
You may need to create some device files on the new EBS volume. If console, zero or null don’t exist in <em>/mnt/ebs/dev</em>, create them using some or all of these:</p>
<pre># cp -prf /dev/console /mnt/ebs/dev
# cp -prf /dev/zero /mnt/ebs/dev
# cp -prf /dev/null /mnt/ebs/dev</pre>
<p>You can also use <a title="MAKEDEV" href="http://planet.admon.org/tag/MAKEDEV/" target="_blank"><em>MAKEDEV</em></a> to create device, here we use <em>cp</em> for simple.</p>
<p><strong>Step 3: Make your AMI</strong><br />
Now you can make a snapshot of the EBS volume via <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?SettingUp_CommandLine.html">Amazon EC2 command line tools</a>. This is the basis of the AMI you’ll be creating. Whatever you copied to the EBS volume in step 2 will be there &#8212; user accounts, database data, etc.</p>
<pre># ec2-create-snapshot vol-8ee49ce6 -d "Active AMI for Production Server"</pre>
<p>That’ll give you a snapshot-id back. You then need to wait for the snapshot to finish. Keep running <em>ec2-describe-snapshots</em> until it says it’s &#8220;<em>completed</em>&#8220;.<br />
Finally, you can register the snapshot as an AMI:</p>
<pre># ec2-register --snapshot snap-a8f327c4 --description "Active AMI for Production Server" --name "web-server-image" ––kernel aki-6603f70f --architecture x86_64 --root-device-name /dev/sda1 -b /dev/sdb=ephemeral0</pre>
<p>The above command will return an AMI-ID, you can use this AMI-ID to launch an instance and you’ll find it pretty much exactly where you left your original instance. Note that the first time load may take some time like 10 mins and become faster then.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/simple-way-to-create-amazon-ec2-ami-from-running-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to free Linux Cache</title>
		<link>http://www.admon.org/how-to-free-linux-cache/</link>
		<comments>http://www.admon.org/how-to-free-linux-cache/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 08:50:21 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[proc]]></category>

		<guid isPermaLink="false">http://www.admon.org/?p=973</guid>
		<description><![CDATA[In one of our former post, we have a way to check what type of data is cached by our operating system. Is there a way for us to release memory from Linux like what we can do in Windows? The answer is Yes, sure. Since linux-2.6.16, there&#8217;s a tunable file in /proc can be [...]]]></description>
			<content:encoded><![CDATA[<p>In one of our former post, we have a way to check <a href="http://www.admon.org/what-data-is-cached-by-operation-system/" target="_blank">what type of data is cached</a> by our operating system. Is there a way for us to release memory from Linux like what we can do in Windows?<br />
<span id="more-973"></span></p>
<p>The answer is Yes, sure. Since linux-2.6.16, there&#8217;s a tunable file in /proc can be used, it&#8217;s <strong>/proc/sys/vm/drop_caches</strong>.<br />
Writing to this file will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.</p>
<p>To free pagecache:</p>
<pre>echo 1 > /proc/sys/vm/drop_caches</pre>
<p>To free dentries and inodes:</p>
<pre>echo 2 > /proc/sys/vm/drop_caches</pre>
<p>To free pagecache, dentries and inodes:</p>
<pre>echo 3 > /proc/sys/vm/drop_caches</pre>
<p>As this is a non-destructive operation, and dirty objects are not freeable, the user should run &#8220;<strong>sync</strong>&#8221; first in order to make sure all cached objects are freed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/how-to-free-linux-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate random password in Linux Command Line</title>
		<link>http://www.admon.org/generate-random-password-linux-command-line/</link>
		<comments>http://www.admon.org/generate-random-password-linux-command-line/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 05:37:24 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[random password]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=715</guid>
		<description><![CDATA[Password is widely used in a production environment, for example, when we created a system account, we need to set an initial password for it, and When email / database / Subversion / LDAP (..etc.) accounts created, random passwords are needed as well. As the random password is common, there are many ways to generate [...]]]></description>
			<content:encoded><![CDATA[<p>Password is widely used in a production environment, for example, when we created a system account, we need to set an initial password for it, and When email / database / Subversion / LDAP (..etc.) accounts created, random passwords are needed as well.<br />
<span id="more-715"></span>As the random password is common, there are many ways to generate random passwords in Linux/UNIX. We&#8217;ll show some examples here on how to generate a strong password on Linux command line.</p>
<p>Please note that this post does not cover the topics on <a href="http://en.wikipedia.org/wiki/Password_strength" target="_blank">password strength</a>. you can use some <a href="http://www.passwordmeter.com/" target="_blank">online tools</a> to check password strength.</p>
<p style="text-align: center;"><a href="http://planet.admon.org/wp-content/uploads/2010/07/Gmail-PassWord-Strength.png"><img class="aligncenter size-full wp-image-734" title="Gmail-PassWord-Strength" src="http://planet.admon.org/wp-content/uploads/2010/07/Gmail-PassWord-Strength.png" alt="Gmail passWord strength check" width="553" height="288" /></a><em>GMail Password Strength Check</em></p>
<p>You can use the following four commands directly in most of Linux distributions with default install.</p>
<pre>joseph@test:~$ &lt; /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8
3saMDFXB</pre>
<p>I personally prefer to use this command. The other commands work great too, check below:</p>
<pre>cat /dev/urandom | tr -cd 'a-f0-9' | head -c 16
dd if=/dev/random count=10 bs=1 | hexdump  | cut -d   -f 2-| head -n 1 | tr -d " "</pre>
<p>uuencode which is supplied by <a href="http://www.gnu.org/software/sharutils/">sharutils</a> is needed by this command (Sharutils is not installed by default):</p>
<pre>head -c 12 /dev/random | uuencode -m - | tail -n 2 | head -n 1</pre>
<p>By using the following command, you need to get <em>mkpasswd</em> installed. It&#8217;s man page is <a href="http://linux.about.com/library/cmd/blcmdl_mkpasswd.htm">available here</a>. It can be run like this:</p>
<pre>mkpasswd -l 16 -s 0 -C 0|sed 's/[0ol1]/f/g'</pre>
<p>Finally, if you have <a href="http://sourceforge.net/projects/pwgen/" target="_blank">pwgen</a> installed, you can also generate a random password in linux command line like this:</p>
<pre>pwgen -ycn 16 1</pre>
<p>PWGen supports Windows platform as well, you just need to install <a href="http://sourceforge.net/projects/pwgen-win/" target="_blank">pwgen-win</a> instead, it has a nice GUI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/generate-random-password-linux-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Manage Debian auto startup scripts</title>
		<link>http://www.admon.org/manage-debian-auto-startup-scripts/</link>
		<comments>http://www.admon.org/manage-debian-auto-startup-scripts/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 15:24:31 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[init scripts]]></category>
		<category><![CDATA[update-rc.d]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=689</guid>
		<description><![CDATA[Debian uses a Sys-V like init system for executing commands when the system runlevel changes &#8211; for example at bootup and shutdown time. Its startup files are stored in /etc/init.d/ and symbolic linked within the /etc/rcX.d/ directories. Debian Linux comes with different utilities to manage these startup file, here we&#8217;ll show two examples on managing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://planet.admon.org/wp-content/uploads/2010/06/debian.png"><img class="size-thumbnail wp-image-736 alignleft" title="debian" src="http://planet.admon.org/wp-content/uploads/2010/06/debian-150x150.png" alt="Debian Linux" width="150" height="150" /></a>Debian uses a <a href="http://en.wikipedia.org/wiki/UNIX_System_V">Sys-V like</a> init system for executing commands when the system runlevel changes &#8211; for example at bootup and shutdown time. Its startup files are stored in <em>/etc/init.d/</em> and symbolic linked within the <em>/etc/rcX.d/</em> directories. Debian Linux comes with different utilities to manage these startup file<span id="more-689"></span>, here we&#8217;ll show two examples on managing these system init scripts.</p>
<p><strong>1, rcconf </strong>- <a href="http://packages.debian.org/lenny/rcconf">http://packages.debian.org/lenny/rcconf</a></p>
<p>This tool configures system services in connection with system runlevels. It turns on/off services using the scripts in <em>/etc/init.d/</em>. Rcconf works with System-V style runlevel configuration. It is a Text User Interface (TUI) frontend to the update-rc.d command.</p>
<p>To start <strong>rcconf</strong>, login as root and type the command &#8220;<em>rcconf</em>&#8220;, then select the service that you would like to enable or disable, and press Tab to apply a change.</p>
<p>A similar command is <a href="http://packages.debian.org/lenny/sysv-rc-conf">sysv-rc-conf</a>, you can make more specified choices in this TUI based configuration tool.</p>
<p><strong>2, sysv-rc</strong> &#8211; <a href="http://packages.debian.org/lenny/sysv-rc">http://packages.debian.org/lenny/sysv-rc</a></p>
<p>Sysv-rc provides a terminal interface for managing &#8220;<em>/etc/rcX.d/</em>&#8221; symlinks. With the help of update-rc.d, you can allow turning services on or off simply. Actually it&#8217;s much what <a href="http://www.linuxjournal.com/article/4445">chkconfig</a> does in Redhat/CentOS, which means you can edit startup scripts for any runlevel.</p>
<p>By default <strong>sysv-rc</strong> is installed even in a minimal installation. Otherwise you need to run &#8220;apt-get install sysv-rc&#8221; to install it. Here&#8217;re some common usage examples for update-rc.d:</p>
<p>To remove the service SERVICE-NAME:</p>
<pre>update-rc.d -f SERVICE-NAME remove</pre>
<p>To add the service SERVICE-NAME:</p>
<pre>update-rc.d SERVICE-NAME defaults</pre>
<pre>update-rc.d SERVICE-NAME defaults 29</pre>
<p>The argument 29 is optional, which ensures that SERVICE-NAME is called after all scripts whose number is less than 29 have completed, and before all scripts whose number is 30 or greater.</p>
<p>To start the script SERVICE-NAME in runlevels 2345 and stop in 456, run (as root):</p>
<pre>update-rc.d SERVICE-NAME start 2 3 4 5 . stop 0 1 6 .</pre>
<pre>update-rc.d SERVICE-NAME start 30 2 3 4 5 . stop 70 0 1 6 .</pre>
<p>You can find more details of this command by running &#8220;man 8 update-rc.d&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/manage-debian-auto-startup-scripts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flashcache: caching data in SSD disks</title>
		<link>http://www.admon.org/flashcache-caching-data-in-ssd-disks/</link>
		<comments>http://www.admon.org/flashcache-caching-data-in-ssd-disks/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 06:07:31 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[dm-cache]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flashcache]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=600</guid>
		<description><![CDATA[Facebook released a kernel module called Flashcache this wednesday, which is used to speed up MySQL by caching data in faster media like SSD disks.  It&#8217;s only tested for kernel versions 2.6.18 and 2.6.20. As mentioned at Facebook.com: We built Flashcache to help us scale InnoDB/MySQL, but it was designed as a generic caching module [...]]]></description>
			<content:encoded><![CDATA[<p>Facebook released a kernel module called <a href="http://github.com/facebook/flashcache">Flashcache</a> this wednesday, which is used to speed up MySQL by caching data in faster media like SSD disks.  It&#8217;s only tested for kernel versions 2.6.18 and 2.6.20.<span id="more-600"></span></p>
<p>As mentioned at <a href="http://www.facebook.com/">Facebook.com</a>:</p>
<blockquote><p>We built Flashcache to help us scale InnoDB/MySQL, but it was designed as a generic caching module that can be used with any application built on top of any block device. For InnoDB, when the working set does not fit in the InnoDB buffer pool, read latency is significantly improved due to caching more of the working set in faster media, such as SSD&#8217;s. We also improve write performance by first caching writes in SSD&#8217;s and lazily flushing the data back to disk.</p></blockquote>
<p>It looks like its based on the <a href="http://users.cis.fiu.edu/~zhaom/dmcache/index.html">dm-cache</a> work. It&#8217;s nice to see that moving again.</p>
<p>Read more details about Flashcache <a href="http://www.facebook.com/note.php?note_id=388112370932">here at Facebook&#8217;s announcing page</a>, and Flashcache&#8217;s source code is available at <a href="http://github.com/facebook/flashcache">GitHub.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/flashcache-caching-data-in-ssd-disks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using VETH instead of VENET in OpenVZ</title>
		<link>http://www.admon.org/using-veth-instead-of-venet-in-openvz/</link>
		<comments>http://www.admon.org/using-veth-instead-of-venet-in-openvz/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 13:42:52 +0000</pubDate>
		<dc:creator>joseph</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[System Tuning]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[openvz]]></category>
		<category><![CDATA[venet]]></category>
		<category><![CDATA[veth]]></category>
		<category><![CDATA[vlan]]></category>

		<guid isPermaLink="false">http://planet.admon.org/?p=586</guid>
		<description><![CDATA[By default OpenVZ is using VENET as network device. It does packet switching based on IP header, which makes it look like a point-to-point connection between VPS and the physical host. An alternative device is Virtual Ethernet device (a.k.a. VETH). Veth is an Ethernet-like device, unlike venet network device, veth device has a MAC address, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://planet.admon.org/wp-content/uploads/2010/04/openvz.png"><img class="size-full wp-image-743 alignleft" title="openvz" src="http://planet.admon.org/wp-content/uploads/2010/04/openvz.png" alt="" width="135" height="135" /></a>By default <a href="http://wiki.openvz.org/Main_Page">OpenVZ</a> is using VENET as network device. It does packet switching based on IP header, which makes it look like a point-to-point connection between VPS and the physical host. An alternative device is <a href="http://wiki.openvz.org/Virtual_Ethernet_device">Virtual Ethernet device</a> (a.k.a. VETH).<br />
<span id="more-586"></span><br />
Veth is an Ethernet-like device, unlike <a href="http://wiki.openvz.org/Venet">venet</a> network device, veth device has a MAC address, therefore it can be used in configurations. When veth is bridged to ethX or other device, the administrator is able to sets up his networking himself, including IPs, gateways etc.</p>
<p>VENet consists of two Ethernet devices &#8212; the one in physical server and another one in virtualized guest. These devices are connected to each other, so if a packet goes into one device it will come out from the other device.</p>
<p>In this post, we&#8217;ll share some tips on how to enable venet. The content is mainly from OpenVZ&#8217;s <a href="http://wiki.openvz.org/Virtual_Ethernet_device#Adding_veth_to_a_CT">official guide</a>.</p>
<p>The commands that we used are listed below with explanations.</p>
<p>Firstly, assuming that we&#8217;re in the physical server, We need to add a new device named eth0</p>
<pre>vzctl set 150 --netif_add eth0,00:12:34:56:78:9A,veth101.0,00:12:34:56:78:9B --save</pre>
<p>The second MAC address is from the mother side, and the first MAC address is self-generated. Click here if you&#8217;re not sure <a href="http://planet.admon.org/howto/generate-mac-address-by-scripts/">how to generate a MAC address</a>.</p>
<p>Then enable forwarding and ARP proxy, and apply some changes in route table:</p>
<pre># cat veth150.sh
ifconfig veth150.0 0
echo 1 &gt; /proc/sys/net/ipv4/conf/veth150.0/forwarding
echo 1 &gt; /proc/sys/net/ipv4/conf/veth150.0/proxy_arp
echo 1 &gt; /proc/sys/net/ipv4/conf/eth0/forwarding
echo 1 &gt; /proc/sys/net/ipv4/conf/eth0/proxy_arp
ip route add 192.168.201.150 dev veth150.0</pre>
<p>Warning: Before making these changes to your system, you&#8217;re suggested to verify what exactly you&#8217;re doing. For example, proxy_arp is problematic in a mixed network.</p>
<p>Secondly, in the VPS we need to config the new device eth0 like this:</p>
<pre>/sbin/ifconfig venet0:0 0
/sbin/ifconfig eth0 0
/sbin/ip addr add 192.168.201.150 dev eth0
/sbin/ip route add default dev eth0</pre>
<p>The IP address <em>192.168.201.150</em> can be in a different network from the physical side, you just need to make sure they are in the same VLAN.</p>
<p>When it&#8217;s tested OK, don&#8217;t forget to modify your network configuration files in <em>/etc/sysconfig/network-scripts/</em> for a permanent change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.admon.org/using-veth-instead-of-venet-in-openvz/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

