<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_加菲猫窝</title><subtitle type="text">专注于VOD/IPTV/CDN</subtitle><id>http://feed.cnblogs.com/blog/u/31886/rss</id><updated>2011-06-21T16:24:36Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/31886/rss"/><entry><id>http://www.cnblogs.com/peon/archive/2011/06/22/2086470.html</id><title type="text">分析ext2文件系统磁盘分区结构</title><summary type="text">最近看了些kernel fs code, 从实际例子，简单分析一下ext2文件系统的结构, 希望对大家有帮助 本文涉及到一些结构，主要是： 超级块 struct ext2_super_block { } 组描述 struct ext2_group_desc { } 索引节点 struct ext2_inode { } 目录结构 struct ext2_dir_entry_2{ } 1. 准备工作 ...</summary><published>2011-06-21T16:04:00Z</published><updated>2011-06-21T16:04:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/06/22/2086470.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/06/22/2086470.html"/><content type="html">&lt;div &gt;&lt;p&gt;&lt;font size="2"&gt;最近看了些kernel fs code, 从实际例子，简单分析一下ext2文件系统的结构,&amp;nbsp; 希望对大家有帮助&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;img height="256" src="http://images.cnblogs.com/cnblogs_com/peon/201106/201106220004001398.png" width="654" border="0"/&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;本文涉及到一些结构，主要是：&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;超级块 struct ext2_super_block { }&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;组描述&amp;nbsp;&amp;nbsp;&amp;nbsp; struct ext2_group_desc { }&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;索引节点&amp;nbsp;&amp;nbsp;&amp;nbsp; struct ext2_inode { }&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;目录结构&amp;nbsp;&amp;nbsp;&amp;nbsp; struct ext2_dir_entry_2&amp;nbsp;{ }&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="5"&gt;1. 准备工作&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;为了分析，特地格式化了一个100MB左右的ext2文件系统，block size 1024 Bytes&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;可以看一下这个分区的主要信息：&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;debugfs:&amp;nbsp;&amp;nbsp; stats&lt;br/&gt; Filesystem volume name:&amp;nbsp;&amp;nbsp; &amp;lt;none&amp;gt;&lt;br/&gt; Last mounted on:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;not available&amp;gt;&lt;br/&gt; Filesystem UUID:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9c0e702c-f80e-4382-a95d-444fafaab34c&lt;br/&gt; Filesystem magic number:&amp;nbsp; &lt;strong&gt;0xEF53&lt;/strong&gt;&lt;br/&gt; Filesystem revision #:&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 (dynamic)&lt;br/&gt; Filesystem features:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resize_inode filetype sparse_super&lt;br/&gt; Default mount options:&amp;nbsp;&amp;nbsp;&amp;nbsp; (none)&lt;br/&gt; Filesystem state:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not clean&lt;br/&gt; Errors behavior:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Continue&lt;br/&gt; Filesystem OS type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Linux&lt;br/&gt; Inode count:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;26104&lt;/strong&gt;&lt;br/&gt; Block count:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;104296&lt;/strong&gt;&lt;br/&gt; Reserved block count:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5214&lt;br/&gt; Free blocks:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99442&lt;br/&gt; Free inodes:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26091&lt;br/&gt; First block:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br/&gt; Block size:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;1024&lt;/strong&gt;&lt;br/&gt; Fragment size:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1024&lt;br/&gt; Reserved GDT blocks:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 256&lt;br/&gt; Blocks per group:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8192&lt;br/&gt; Fragments per group:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8192&lt;br/&gt; Inodes per group:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008&lt;br/&gt; Inode blocks per group:&amp;nbsp;&amp;nbsp; 251&lt;br/&gt; Filesystem created:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sun Feb 13 22:36:23 2011&lt;br/&gt; Last mount time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mon Feb 14 04:49:41 2011&lt;br/&gt; Last write time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mon Feb 14 04:49:41 2011&lt;br/&gt; Mount count:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;br/&gt; Maximum mount count:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&lt;br/&gt; Last checked:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sun Feb 13 22:36:23 2011&lt;br/&gt; Check interval:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15552000 (6 months)&lt;br/&gt; Next check after:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fri Aug 12 22:36:23 2011&lt;br/&gt; Reserved blocks uid:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 (user root)&lt;br/&gt; Reserved blocks gid:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 (group root)&lt;br/&gt; First inode:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;br/&gt; Inode size:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 128&lt;br/&gt; Default directory hash:&amp;nbsp;&amp;nbsp; tea&lt;br/&gt; Directory Hash Seed:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; de62f19c-eaa2-4cb7-a2c6-84fca69baafd&lt;br/&gt; Directories:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;br/&gt; &lt;strong&gt;Group&amp;nbsp; 0: block bitmap at 259, inode bitmap at 260, inode table at 261&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7665 free blocks, 1995 free inodes, 2 used directories&lt;/strong&gt;&lt;br/&gt; Group&amp;nbsp; 1: block bitmap at 8451, inode bitmap at 8452, inode table at 8453&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 2: block bitmap at 16385, inode bitmap at 16386, inode table at 16387&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 3: block bitmap at 24835, inode bitmap at 24836, inode table at 24837&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 4: block bitmap at 32769, inode bitmap at 32770, inode table at 32771&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 5: block bitmap at 41219, inode bitmap at 41220, inode table at 41221&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 6: block bitmap at 49153, inode bitmap at 49154, inode table at 49155&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 7: block bitmap at 57603, inode bitmap at 57604, inode table at 57605&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 8: block bitmap at 65537, inode bitmap at 65538, inode table at 65539&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group&amp;nbsp; 9: block bitmap at 73987, inode bitmap at 73988, inode table at 73989&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group 10: block bitmap at 81921, inode bitmap at 81922, inode table at 81923&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group 11: block bitmap at 90113, inode bitmap at 90114, inode table at 90115&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7939 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; Group 12: block bitmap at 98305, inode bitmap at 98306, inode table at 98307&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5738 free blocks, 2008 free inodes, 0 used directories&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="5"&gt;&lt;strong&gt;2. 查看 super block&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;先看超级块，因为第一个block(1024字节)是引导块 ，所以我们从 1024 字节 开始&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;inode count 等都可以对得上 (注意是little endian)&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;-------------------------------------------------------------&lt;br/&gt; struct ext2_super_block {&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s_inodes_count;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Inodes count */ //&amp;nbsp;&amp;nbsp; f8 65 00 00&amp;nbsp; = 26140&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s_blocks_count;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Blocks count */&amp;nbsp; //&amp;nbsp;&amp;nbsp; 68 97 01 00 = 104296&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;......&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;s_magic;&amp;nbsp;&amp;nbsp;/* Magic signature */&amp;nbsp; // ef 53&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;......&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;[root@ms3003 ~]# dd if=/dev/hdb1 bs=1 count=1024 skip=1024 | od -t x1 -Ax&lt;br/&gt; 1024+0 records in&lt;br/&gt; 1024+0 records out&lt;br/&gt; 000000 &lt;strong&gt;f8 65 00 00 68 97 01 00&lt;/strong&gt; 5e 14 00 00 72 84 01 00&lt;br/&gt; 000010 eb 65 00 00 01 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000020 00 20 00 00 00 20 00 00 d8 07 00 00 e5 43 58 4d&lt;br/&gt; 000030 e5 43 58 4d 02 00 22 00 &lt;strong&gt;53 ef&lt;/strong&gt; 00 00 01 00 00 00&lt;br/&gt; 000040 67 ec 57 4d 00 4e ed 00 00 00 00 00 01 00 00 00&lt;br/&gt; 000050 00 00 00 00 0b 00 00 00 80 00 00 00 10 00 00 00&lt;br/&gt; 000060 02 00 00 00 01 00 00 00 9c 0e 70 2c f8 0e 43 82&lt;br/&gt; 000070 a9 5d 44 4f af aa b3 4c 00 00 00 00 00 00 00 00&lt;br/&gt; 000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; ......&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="5"&gt;&lt;strong&gt;3. 接下来我们看组描述&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;再看组描述符 ，32个字节一个，我们可以把debugfs的结果和实际的磁盘信息对照一下&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑"&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" color="#0000FF" size="2"&gt;&lt;em&gt;/*&lt;br/&gt; * Structure of a blocks group descriptor&lt;br/&gt; */&lt;br/&gt; struct ext2_group_desc&lt;br/&gt; {&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_block_bitmap;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Blocks bitmap block */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_inode_bitmap;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Inodes bitmap block */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_inode_table;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Inodes table block */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_free_blocks_count;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Free blocks count */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_free_inodes_count;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Free inodes count */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_used_dirs_count;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Directories count */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_pad;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bg_reserved[3];&lt;br/&gt; };&lt;/em&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;&lt;br/&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;Group&amp;nbsp; 0: block bitmap at 259, inode bitmap at 260, inode table at 261&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7665 free blocks, 1995 free inodes, 2 used directories&lt;br/&gt; Group&amp;nbsp; 1: block bitmap at 8451, inode bitmap at 8452, inode table at 8453&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7681 free blocks, 2008 free inodes, 0 used directories&lt;br/&gt; ......&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;观察磁盘上的信息，都可以对得上&lt;/font&gt;&lt;/span&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;br/&gt; &lt;font face="微软雅黑" size="2"&gt;03 01 00 00 = 259&lt;br/&gt; 04 01 00 00 = 260&lt;br/&gt; F1 1D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 7665&lt;br/&gt; cb 07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 1995&lt;br/&gt; 02 00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2&lt;br/&gt; 03 21 00 00 = 8451&lt;br/&gt; 04 21 00 00 = 8452&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;组描述分布在 super block 后面 (所以从2048开始) ，根据block group数量而有多个，32个字节一组(2行一组)，&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;磁盘100MB，每个block gourp 物理8192KB, 所以有有13个block group, 32*13=0x1A0 , 所以1A0 后面就都是0了&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;[root@ms3003 ~]# dd if=/dev/hdb1 bs=1 count=1024 skip=2048 | od -t x1 -Ax&lt;br/&gt; 1024+0 records in&lt;br/&gt; 1024+0 records out&lt;br/&gt; 000000 03 01 00 00 04 01 00 00 05 01 00 00 f1 1d cb 07&lt;br/&gt; 000010 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000020 03 21 00 00 04 21 00 00 05 21 00 00 01 1e d8 07&lt;br/&gt; 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000040 01 40 00 00 02 40 00 00 03 40 00 00 03 1f d8 07&lt;br/&gt; 000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000060 03 61 00 00 04 61 00 00 05 61 00 00 01 1e d8 07&lt;br/&gt; 000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000080 01 80 00 00 02 80 00 00 03 80 00 00 03 1f d8 07&lt;br/&gt; 000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 0000a0 03 a1 00 00 04 a1 00 00 05 a1 00 00 01 1e d8 07&lt;br/&gt; 0000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 0000c0 01 c0 00 00 02 c0 00 00 03 c0 00 00 03 1f d8 07&lt;br/&gt; 0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 0000e0 03 e1 00 00 04 e1 00 00 05 e1 00 00 01 1e d8 07&lt;br/&gt; 0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000100 01 00 01 00 02 00 01 00 03 00 01 00 03 1f d8 07&lt;br/&gt; 000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000120 03 21 01 00 04 21 01 00 05 21 01 00 01 1e d8 07&lt;br/&gt; 000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000140 01 40 01 00 02 40 01 00 03 40 01 00 03 1f d8 07&lt;br/&gt; 000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000160 01 60 01 00 02 60 01 00 03 60 01 00 03 1f d8 07&lt;br/&gt; 000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; 000180 01 80 01 00 02 80 01 00 03 80 01 00 6a 16 d8 07&lt;br/&gt; 000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; *&lt;br/&gt; 000400&lt;br/&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;&lt;strong&gt;&lt;font size="5"&gt;4. 查看根目录的inode&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;ext2 根目录的inode number = 2 ，所以这个inode 在 group 0&amp;nbsp; ， 是第二个inode&lt;br/&gt; &lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font face="微软雅黑" size="2"&gt;Group&amp;nbsp; 0: block bitmap at 259, inode bitmap at 260, inode table at 261&lt;br/&gt; 每个 inode 是一个 struct ext2_inode ， 128 个字节，所以磁盘上的偏移就是 261*1024 + 128 = 267392&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="2"&gt;[root@ms3003 ext2]# dd if=/dev/hdb1 bs=1 count=256 skip=267392 | od -t x1 -Ax&amp;nbsp;&amp;nbsp;&lt;br/&gt; 256+0 records in&lt;br/&gt; 256+0 records out&lt;br/&gt; 000000 ed 41 00 00 00 04 00 00 52 13 5b 4d e1 82 58 4d&lt;br/&gt; 000010 e1 82 58 4d 00 00 00 00 00 00 03 00 02 00 00 00&lt;br/&gt; 000020 00 00 00 00 00 00 00 00&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#EB0073"&gt;&lt;strong&gt;00 02&lt;/strong&gt;&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;00 00 00 00 00 00&lt;br/&gt; 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;&lt;font size="2"&gt;i_mode = 0x41ed = 0040755 (8进制 )&amp;nbsp;， 也就是 目录 + 755 权限(drwxr-xr-x)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;block 索引第一个是 00 02 ，就是512块&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;对照 &lt;font color="#0000FF"&gt;&lt;em&gt;struct ext2_inode ，&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000FF" size="2"&gt;&lt;em&gt;&amp;nbsp;{&lt;br/&gt; &amp;nbsp;__u16&amp;nbsp;i_mode;&amp;nbsp;&amp;nbsp;/* File mode */&lt;br/&gt; &amp;nbsp;__u16&amp;nbsp;i_uid;&amp;nbsp;&amp;nbsp;/* Low 16 bits of Owner Uid */&lt;br/&gt; &amp;nbsp;__u32&amp;nbsp;i_size;&amp;nbsp;&amp;nbsp;/* Size in bytes */&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000FF" size="2"&gt;&lt;em&gt;......&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000FF" size="2"&gt;&lt;em&gt;__u32&amp;nbsp;i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ 从40个字节处开始&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000FF" size="2"&gt;&lt;em&gt;.....&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000FF" size="2"&gt;&lt;em&gt;}&lt;/em&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="5"&gt;&lt;strong&gt;5. 查看根目录的目录结构&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;div&gt;&lt;font size="2"&gt;我们看一下根目录有哪些文件(目录是特殊的文件），和磁盘分区信息对照一下&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font size="2"&gt;注意最左边的数字是inode number&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;br/&gt; &lt;font size="2"&gt;[root@ms3003 ext2]# ll -ia&lt;br/&gt; total 23&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 drwxr-xr-x&amp;nbsp; 3 root root&amp;nbsp; 1024 Feb 14 09:18 .&lt;br/&gt; 812001 drwxr-xr-x&amp;nbsp; 4 root root&amp;nbsp; 4096 Feb 13 22:36 ..&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; 11 drwx------&amp;nbsp; 2 root root 12288 Feb 13 22:36 lost+found&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; 15 -rw-r--r--&amp;nbsp; 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 Feb 14 09:18 test&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; 12 -rw-r--r--&amp;nbsp; 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp; 69 Feb 13 22:45 test2&lt;/font&gt;&lt;/div&gt; &lt;p&gt;&lt;font size="2"&gt;[root@ms3003 ext2]#&amp;nbsp; dd if=/dev/hdb1 bs=1024 count=1 skip=512 | hexdump -C&lt;br/&gt; 1+0 records in&lt;br/&gt; 1+0 records out&lt;br/&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="3"&gt;00000000&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#2D4FC9"&gt;02 00 00 00 0c 00 01 02&amp;nbsp; 2e 00 00 00&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#FF0000"&gt;02 00 00 00&lt;/font&gt;&amp;nbsp; |................|&lt;br/&gt; 00000010&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#FF0000"&gt;0c 00 02 02 2e 2e 00 00&amp;nbsp;&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#328712"&gt;0b 00 00 00 14 00 0a 02&amp;nbsp;&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;|................|&lt;br/&gt; 00000020&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#328712"&gt;6c 6f 73 74 2b 66 6f 75&amp;nbsp; 6e 64 00 00&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#A600C4"&gt;0c 00 00 00&amp;nbsp;&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;|lost+found......|&lt;br/&gt; 00000030&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#8600A4"&gt;10 00 05 01 74 65 73 74&amp;nbsp; 32 2e 73 77&lt;/font&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#C6C500"&gt;0f 00 00 00&lt;/font&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;|....test2.sw....|&lt;br/&gt; &lt;strong&gt;00000040&lt;/strong&gt;&lt;font style="FONT-WEIGHT: bold" color="#C6C500"&gt;&amp;nbsp;&lt;/font&gt;&lt;strong&gt;&lt;font color="#C6C500"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;c4 03 04 01 74 65 73 74&amp;nbsp;&lt;/font&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;74 65 73 74&lt;span&gt;&amp;nbsp;&lt;/span&gt;00 00 00 00&amp;nbsp; |....testtest....|&lt;br/&gt; 00000050&amp;nbsp; b4 03 09 01 2e 74 65 73&amp;nbsp; 74 2e 73 77 70 70 00 00&amp;nbsp; |.....test.swpp..|&lt;br/&gt; 00000060&amp;nbsp; 00 00 00 00 a0 03 05 01&amp;nbsp; 74 65 73 74 7e 2e 73 77&amp;nbsp; |........test~.sw|&lt;br/&gt; 00000070&amp;nbsp; 70 78 78 00 00 00 00 00&amp;nbsp; 00 00 00 00 00 00 00 00&amp;nbsp; |pxx.............|&lt;br/&gt; 00000080&amp;nbsp; 00 00 00 00 00 00 00 00&amp;nbsp; 00 00 00 00 00 00 00 00&amp;nbsp; |................|&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;对照 ext2_dir_entry_2 分析，注意 &lt;strong&gt;这是个可变长度的结构&lt;/strong&gt;，长度为rec_len , 而名字长度为 name_len&lt;br/&gt; &lt;font color="#0000FF"&gt;&lt;em&gt;struct ext2_dir_entry_2 {&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inode;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Inode number */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rec_len;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Directory entry length */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name_len;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Name length */&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __u8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_type;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name[EXT2_NAME_LEN];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* File name */&lt;br/&gt; };&lt;/em&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;蓝色和红色分别是目录&amp;nbsp; .&amp;nbsp; 和 .. inode id = 2&lt;br/&gt; 绿色是 lost+found , inode id = 11 (0b 00 00 00)&lt;br/&gt; 紫色是 test2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , inode id = 12 (0c 00 00 00)&lt;br/&gt; 深黄色 是 test&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , inode id = 15 (0f 00 00 00)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;该块信息和 ext2 根目录文件都可以对应上&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;font size="5"&gt;6.查看普通文件 test 的内容&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;test 文件的 inode 是 15，那么我们计算一下它的inode的位置， 是group 0 的 第15个inode, 磁盘偏移是&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;261*1024 + 128*14 = 269056&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="3"&gt;[root@ms3003 ~]# dd if=/dev/hdb1 bs=1 count=256 skip=269056 | od -t x1 -Ax&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br/&gt; 256+0 records in&lt;br/&gt; 256+0 records out&lt;br/&gt; 000000 &lt;strong&gt;a4 81&lt;/strong&gt; 00 00 48 00 00 00 df 0d 5b 4d e1 82 58 4d&lt;br/&gt; 000010 e1 82 58 4d 00 00 00 00 00 00 01 00 02 00 00 00&lt;br/&gt; 000020 00 00 00 00 00 00 00 00&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;font color="#EB0073"&gt;09 14&lt;/font&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;00 00 00 00 00 00&lt;br/&gt; 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;我们找到这个 inode , imode = 0x81a4 = 00100644 (8进制 )&amp;nbsp;, 也就是普通文件+权限644(-rw-r--r--&amp;nbsp;)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;第一个block号码是 0x 14 09 = 5192&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="2"&gt;&lt;font face="微软雅黑"&gt;那我们查看一下 5192 block 的内容， 和 cat test 的结果是一致的&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="3"&gt;[root@ms3003 ext2]# cat test&lt;br/&gt; apeonaaaaaaaaaaaaaaaaaaab&lt;br/&gt; bbbbbbbbbbbbbbbbbbbb&lt;br/&gt; ccccccccccccccccccc:q!&lt;br/&gt; \&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="WORD-SPACING: 0px; FONT: medium Tahoma; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"&gt;&lt;font size="3"&gt;[root@ms3003 ~]# dd if=/dev/hdb1 bs=1024 count=1 skip=5129 | od -t x1 -aAx&lt;br/&gt; 1+0 records in&lt;br/&gt; 1+0 records out&lt;br/&gt; 000000 61 70 65 6f 6e 61 61 61 61 61 61 61 61 61 61 61&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; p&amp;nbsp;&amp;nbsp; e&amp;nbsp;&amp;nbsp; o&amp;nbsp;&amp;nbsp; n&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&lt;br/&gt; 000010 61 61 61 61 61 61 61 61 62 0a 62 62 62 62 62 62&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp; b&amp;nbsp; nl&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&lt;br/&gt; 000020 62 62 62 62 62 62 62 62 62 62 62 62 62 62 0a 63&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp; b&amp;nbsp; nl&amp;nbsp;&amp;nbsp; c&lt;br/&gt; 000030 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&lt;br/&gt; 000040 63 63 3a 71 21 0a 5c 0a 00 00 00 00 00 00 00 00&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp; q&amp;nbsp;&amp;nbsp; !&amp;nbsp; nl&amp;nbsp;&amp;nbsp; \&amp;nbsp; nl nul nul nul nul nul nul nul nul&lt;br/&gt; 000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/2086470.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/06/22/2086470.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/06/12/2079220.html</id><title type="text">Scaling Redis</title><summary type="text">上佳好文，可惜被墙，怎能不转？ Scaling Redis When a database is limited to running on a single computer, only certain load can be served with acceptable latency. Adding hardware to this single computer will help onl...</summary><published>2011-06-12T14:43:00Z</published><updated>2011-06-12T14:43:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/06/12/2079220.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/06/12/2079220.html"/><content type="html">&lt;div &gt;&lt;p&gt;&lt;strong&gt;上佳好文，可惜被墙，怎能不转？&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;a href="http://petrohi.me/post/6323289515/scaling-redis"&gt;&lt;font color="#111111"&gt;Scaling Redis&lt;/font&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;When a database is limited to running on a single computer, only certain load can be served with acceptable latency. Adding hardware to this single computer will help only so much. Doubling or tripling the load may require significantly more than twice or thrice cost of hardware to scale up. Such approach is expensive to scale and it eventually hits its limit. Ideally, we would start with a single inexpensive computer and as load increases we would keep on adding same inexpensive computers resulting in a near-linear function between load and cost. Such horizontal scaling out is common place in today’s web applications because it provides a more predictable cost model.&amp;nbsp;&lt;/p&gt; &lt;p&gt;Clusters of inexpensive commodity hardware lead to a disruption in the database ecosystem. What further amplifies this disruption in falling prices of RAM and solid state storage. A number NoSQL of databases are truly leveraging this disruption. At &lt;a href="http://www.meshin.com/"&gt;&lt;font color="#555555"&gt;Meshin&lt;/font&gt;&lt;/a&gt;, one of our key requirements is the lightning-fast delivery of query results. Think of &lt;a href="http://www.google.com/instant/"&gt;&lt;font color="#555555"&gt;Google Instant&lt;/font&gt;&lt;/a&gt; search. Showing results with “as you type” latency enables a whole new class of use cases. This lead us to considering various in-memory database engines. &lt;a href="http://redis.io/"&gt;&lt;font color="#555555"&gt;Redis&lt;/font&gt;&lt;/a&gt;, with its simple and elegant data model and very transparent performance characteristics came out on top. For in-memory databases, single-threaded design becomes an obvious choice, essentially removing significant overhead common to traditional database architectures. Another assumption in Meshin design is that if the index is partially or completely lost it can be recovered by re-indexing original data. Sure, this introduces short-term inconsistencies, but on the other hand it allows to relax durability and further simplify the design. Such a trade-off is a perfect fit to the Redis &lt;a href="http://redis.io/topics/persistence"&gt;&lt;font color="#555555"&gt;persistence strategy&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Single-threaded design of Redis brings up another interesting issue. Scaling of a single instance of Redis is not limited just by the computer it runs on, which would amount to RAM size, but is further limited by the single core or hardware thread it will utilize. So if your load exceeds the single hardware thread or size of available RAM, you need a second instance of Redis. This requires some approach to clustering. Effective clustering is all about figuring out the right partitioning scheme. Ideally, you need to split load into identically-sized partitions. If load becomes biased towards one or more partitions you will have a bottleneck. Such a bottleneck will limit your system’s scalability or in other words will make your load-to-cost function non-linear. It is important that partitions are as independent as possible. If an operation spans a group of partitions its scalability will be limited by the number of such groups in the cluster. In extreme cases of spanning all partitions in a cluster, the scalability will be as good as running on a single partition.&amp;nbsp;&lt;/p&gt; &lt;p&gt;Another aspect is differentiating the load by reads and writes. If the Redis hardware thread capacity is exceeded by reads, it is easy to scale out by putting additional read-only replicas of the same data. It is much harder to scale out writes by replication where trading off consistency is often required. Redis again takes simple a approach with its&amp;nbsp;&lt;a href="http://redis.io/topics/replication"&gt;&lt;font color="#555555"&gt;master-slave replication&lt;/font&gt;&lt;/a&gt;. A writable master replica asynchronously updates one or more read-only slave replicas. Right after replying to a write operation the master notifies all replicas. No&amp;nbsp;acknowledgment&amp;nbsp;is required by the master. This means that there is&amp;nbsp;short period of time when slave replicas may return old data. This provides with write-write consistency guarantees that are as strong as without replication. However, the write-read&amp;nbsp;consistency&amp;nbsp;guarantees&amp;nbsp;are now less strong or “eventual”. It is important to note that replication not only helps scalability of reads, but also improves reliability when replicas are placed on different machines. For the Meshin application eventual write-read consistency is acceptable tradeoff for higher reliability.&lt;/p&gt; &lt;p&gt;With the Meshin application, we have a large number of user indexes, each of roughly equal size. Meshin keeps a sliding window index of email, Twitter, Facebook etc. messages to maintain predictable maximum size of index. This provides a great opportunity for partitioning. If a partition handles roughly an equal number of users, we have balanced storage and load requirements and at the same time made the most frequent operations directed at only one partition. One approach is choosing between N partitions is hashing a unique user identifier, for example an email address, such that the hash space is in the [0..N) range. If the quality of the hash function is sufficient, we will get a well-balanced distribution.&lt;/p&gt; &lt;p&gt;&lt;img height="219" alt="hash-fixed" src="http://s3.amazonaws.com/petrohi-blog-static/hash-fixed.png" width="368" align="middle"/&gt;&lt;!-- more --&gt;&lt;/p&gt; &lt;p&gt;Now we can place our Redis instances on M = N / K computer nodes in the cluster. K is number of Redis instances that we can comfortably run on single node. This number is limited by the number of cores or hardware threads. With a large number of hardware threads (8 and up) it makes sense to map each Redis instance to one thread. RAM is then equally divided between these instances. Now, knowing each user’s maximum required RAM, we can calculate how many users our cluster can accommodate. One thing to keep in mind is that if you use Redis snapshotting for persistence — which employs&amp;nbsp;the&amp;nbsp;OS copy-on-write mechanism — it may require as much as twice amount the RAM dedicated to a partition to take a snapshot.&lt;/p&gt; &lt;p&gt;It is important to note that in the case of the Meshin application with regard to specific RAM and thread count per computer the load is “memory-bound”. Meaning that a partition having a full memory pool sill won’t saturate the hardware thread with Redis. It is important to note that for some applications the load may become “thread-bound”. In this case the hardware thread is being saturated before the memory pool is maxed out. Interestingly, with the “memory-bound” case we have underutilized CPUs and with the “thread-bound” case we may have underutilized RAM.&lt;/p&gt; &lt;p&gt;Great so far, but what if we keep on adding users and they start exceeding the capacity of a partition? In the “memory-bound” case they exceed the memory pool allocated for a partition and in the “thread-bound” case they fully saturate the corresponding hardware thread. In our case, the number of partitions is fixed. Also, since partitions are equally populated with same size users they all about to overflow. As we add new nodes to the cluster, we may try to move some partitions from existing ones and rebalance such that our nodes have an equal number of partitions. There are two problems with this approach. In the “thread-bound” case this won’t help at all — we can’t really utilize new cores, since partitions are single threaded! In “memory-bound” case the machines will have fewer number of Redis instances than number of hardware threads. This leaves those threads idle and CPUs even more underutilized! One way to fix this problem is to &lt;a href="http://antirez.com/post/redis-presharding.html"&gt;&lt;font color="#555555"&gt;overprovision partitions initially&lt;/font&gt;&lt;/a&gt;, so that K is a multiple of the number of hardware threads. The&amp;nbsp;multiplier&amp;nbsp;is essentially the number of times we want to grow our cluster by. Other approach is to allow changing number of partitions.&lt;/p&gt; &lt;p&gt;At Meshin we took approach where we are able to add partitions over time. This is accomplished by changing the way initial partitioning is done. Instead of limiting the hash function space to (0..N] we allow it to generate 64-bit unsigned integers. These hashes are mapped to a ring and wrapped from 2^64-1 to 0. We compared several hash functions homogeneity&lt;span&gt;&amp;nbsp;&lt;/span&gt;performance for a large set of email addresses as unique user identifiers. The best homogeneity was achieved by the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/SHA1"&gt;&lt;font color="#555555"&gt;SHA1&lt;/font&gt;&lt;/a&gt; hash reduced to 64 bits by XOR-ing its parts.&lt;/p&gt; &lt;p&gt;&lt;img height="274" alt="hash-ring" src="http://s3.amazonaws.com/petrohi-blog-static/hash-ring.png" width="285" align="middle"/&gt;&lt;/p&gt; &lt;p&gt;Each partition is placed on the ring with equal&amp;nbsp;distances&amp;nbsp;in between. When a user identifier is hashed we get its position on the ring and thus can find the closest partition where user’s index resides by going&amp;nbsp;clockwise.&lt;/p&gt; &lt;p&gt;&lt;img height="439" alt="hash-ring-distance" src="http://s3.amazonaws.com/petrohi-blog-static/hash-ring-distance.png" width="252" align="middle"/&gt;&lt;/p&gt; &lt;p&gt;When new partitions are added they are placed in between existing partitions to maintain equal distances. We also have the flexibility to add partitions in multiple points on the ring if partitions are of variable size to enable more users’ indexes allocated in larger partitions. Now, to lookup an existing user’s index you may hit a newly added partition and miss the old partition where the index was originally allocated. One way to address this problem is to move the corresponding user indexes to new partitions or rebalance the whole hash ring. We decided to employ simple routing instead. If a partition doesn’t have the user index, it proceeds to the next partition in clockwise direction.&lt;/p&gt; &lt;p&gt;&lt;img height="440" alt="hash-ring-old-forward" src="http://s3.amazonaws.com/petrohi-blog-static/hash-ring-old-forward.png" width="281" align="middle"/&gt;&lt;/p&gt; &lt;p&gt;Such routing is fairly scalable. It does not have a single point of contention since each partition participates in routing. We also use a caching layer on the application server to remember partition addresses for recent user identities. As with lookups, it is also possible to route new user index allocations. When a partition is full it will simply forward to next partition clockwise until a partition available for allocation is found. If new partitions’ points are added in between old ones this will keep routing paths short.&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;img height="433" alt="hash-ring-full-forward" src="http://s3.amazonaws.com/petrohi-blog-static/hash-ring-full-forward.png" width="247" align="middle"/&gt;&lt;/p&gt; &lt;p&gt;To add reliability and further scale reads we replicate each partition to a different node in the cluster. Replicas are placed so that each node has an equal number of masters and slaves. All writes are directed at the master replica, while reads are balanced between master and slave replicas. Balancing uses stickiness by user identity to keep CPU caches warm. For example, replicating N partitions twice, K partitions per node, 2 * K replicas per node and M nodes in cluster.&lt;/p&gt; &lt;p&gt;&lt;img height="247" alt="cluster" src="http://s3.amazonaws.com/petrohi-blog-static/cluster.png" width="483" align="middle"/&gt;&lt;/p&gt; &lt;p&gt;Partitioned replicas are taking snapshots asynchronously. We place the snapshots on redundant networked storage. All snapshot traffic goes through a dedicated network. Taking snapshots requires additional memory to be allocated by Redis. The amount of this memory depends on write activity on a partition and&amp;nbsp;I/O&amp;nbsp;latency of snapshot operation. To minimize snapshotting overhead on a specific node in the cluster we run only one snapshotting operation at the time. A dedicated agent calls the&amp;nbsp;&lt;a href="http://redis.io/commands/save"&gt;&lt;font color="#555555"&gt;SAVE&lt;/font&gt;&lt;/a&gt; command for each partition on a node in a round-robin fashion. The SAVE command initiates snapshotting and returns when it is completed. The period of full cycle of&amp;nbsp;snapshotting&amp;nbsp;defines the maximum time slice of changes that could be lost if cluster a node fails.&lt;/p&gt; &lt;p&gt;Cluster configuration, including partition IP addresses and ports, positions on hash ring and health check status are stored in dedicated Redis instances. We call this dedicated instance the “directory”. The directory is replicated as well with the master doing the writes, which are quite rare. The directory reads are served by the master and one or more slave replicas in round-robin manner. When the application fails to access a certain partition replica, it marks it as offline in the directory. This means other instances will stop trying to access it since it’s been removed from the list of available replicas for a partition. If a failed replica was in slave role the cluster will remain fully functional, just with less redundancy for failed partition. We call this partial outage. In turn, if the replica was in master role, the partition will switch to read-only outage mode. Read-only outage mode still allows the partition to handle read queries. If all replicas in a partition have failed cluster is in full outage. Full outage is a rare event since it requires two nodes to fail simultaneously. A special agent monitors partitions for outages by polling the directory. If there is master-less partition it will elect one of the slave replicas to become master, reconfigure the rest of the replicas and adjust the directory to clear the read-only outage. While we attempt to recover from read-only outages automatically, partial outages and full outages must be addressed manually. At some point in scaling this will not work and we realize the need for a fully-automated recovery system down the road.&lt;/p&gt; &lt;p&gt;Currently the cluster runs on 14 nodes each with 96GB of RAM — this amounts a total of 1.3TB. The nodes have 16 hardware threads each. We deployed 160 partitions each replicated twice. Separate computers handle the directory and networked storage for snapshotting.&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/2079220.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/06/12/2079220.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/06/07/2074671.html</id><title type="text">[ZT] Linuxfs Readinglist</title><summary type="text">Linux文件系统阅读清单，里面包含了大量以文件系统为主题的文章, 可以完善对文件系统的了解。http://linuxfs.pbworks.com/w/page/17647516/ReadingList (该地址已被墙)This page lists useful reading for people interested in Linux file systems development. Please include a description with each link and keep things organized. Ext2/Ext3improvementproject is </summary><published>2011-06-07T14:30:00Z</published><updated>2011-06-07T14:30:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/06/07/2074671.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/06/07/2074671.html"/><content type="html">&lt;div id="wikipage-inner" sizcache="2" sizset="14"&gt;&#xD;
&lt;p&gt;Linux&lt;a href="http://linuxfs.pbwiki.com/ReadingList"&gt;&lt;font color="#996699"&gt;文件系统阅读清单&lt;/font&gt;&lt;/a&gt;，里面包含了大量以文件系统为主题的文章, 可以完善对文件系统的了解。&#xD;
&lt;p&gt;&lt;a href="http://linuxfs.pbworks.com/w/page/17647516/ReadingList"&gt;http://linuxfs.pbworks.com/w/page/17647516/ReadingList&lt;/a&gt;&amp;nbsp; (该地址已被墙)&#xD;
&lt;p&gt;This page lists useful reading for people interested in Linux file systems development. Please include a description with each link and keep things organized. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="14"&gt;&lt;a href="http://www.bullopensource.org/ext4"&gt;Ext2/Ext3&amp;nbsp;improvement&amp;nbsp;project&lt;/a&gt; is dealing with 64 bitness &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="15"&gt;&lt;a href="http://www.eecs.harvard.edu/~vino/fs-perf"&gt;File&amp;nbsp;and&amp;nbsp;Storage&amp;nbsp;System&amp;nbsp;Design&amp;nbsp;at&amp;nbsp;Harvard&lt;/a&gt; has some publication links. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="16"&gt;&lt;a href="http://lwn.net/Articles/190222/"&gt;The&amp;nbsp;2006&amp;nbsp;Linux&amp;nbsp;File&amp;nbsp;Systems&amp;nbsp;Workshop&amp;nbsp;Summary&lt;/a&gt; at &lt;a href="http://lwn.net/"&gt;Linux&amp;nbsp;Weekly&amp;nbsp;News&lt;/a&gt; is a good summary of the problems Linux file systems will be facing in the next 5 years, and the ideas people have for tackling them. Includes information on chunkfs, doublefs, and more. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="18"&gt;Here is a &lt;a href="http://www.fenrus.org/chunkfs.txt"&gt;description&amp;nbsp;of&amp;nbsp;chunkfs&lt;/a&gt;, an idea for splitting up file systems into small, individually fsck-able chunks, which results in many advantages in both performance and repairability. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="19"&gt;Some documentation on how to write a Linux filesystem includes this &lt;a href="http://us1.samba.org/samba/ftp/cifs-cvs/ols2006-fs-tutorial-smf.odp"&gt;OLS&amp;nbsp;Tutorial&lt;/a&gt; and &lt;a href="http://www.geocities.com/ravikiran_uvs/articles/rkfs.html"&gt;a&amp;nbsp;paper&amp;nbsp;describing&amp;nbsp;a&amp;nbsp;simple&amp;nbsp;Linux&amp;nbsp;fs&lt;/a&gt;. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="21"&gt;The &lt;a href="http://www.kernel.org/pub/linux/kernel/people/suparna/OLS2006-fs-adapt.pdf"&gt;adaptable&amp;nbsp;filesystems&amp;nbsp;framework&amp;nbsp;paper&lt;/a&gt; explores the possibility of easing the problem of switching formats by supporting on-disk layout flexibility at a per-element level. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="22"&gt;&lt;a href="http://oss.sgi.com/projects/xfs/papers/ols2006/ols-2006-paper.pdf"&gt;Exploring&amp;nbsp;High&amp;nbsp;Bandwidth&amp;nbsp;Filesystems&amp;nbsp;on&amp;nbsp;Large&amp;nbsp;Systems&lt;/a&gt; - some testing of filesystem throughput by SGI. Focuses on XFS, of course, but there's some comparison with other common Linux filesystems. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="23"&gt;&lt;a href="http://www.nobius.org/~dbg/practical-file-system-design.pdf"&gt;Practical&amp;nbsp;File&amp;nbsp;System&amp;nbsp;Design&amp;nbsp;with&amp;nbsp;the&amp;nbsp;Be&amp;nbsp;File&amp;nbsp;System&lt;/a&gt; - A book (now out of print) on how to design your own filesystem, which is illustrated with examples from the &lt;a href="http://www.nobius.org/~dbg/"&gt;author's&lt;/a&gt; own experience designing BeOS's BFS. The author also &lt;a href="http://www.nobius.org/~dbg/fs-kit-0.4.tgz"&gt;provides&lt;/a&gt; the filesystem construction kit mentioned in the book (a userspace test harness for experimenting with on-disk layout). &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="26"&gt;&lt;a href="http://www.complang.tuwien.ac.at/papers/czezatke&amp;amp;ertl00/"&gt;LinLogFS&amp;nbsp;-&amp;nbsp;A&amp;nbsp;Log-Structured&amp;nbsp;Filesystem&amp;nbsp;For&amp;nbsp;Linux&lt;/a&gt; gives an overview and discusses some implementation issues of &lt;a href="http://www.complang.tuwien.ac.at/czezatke/lfs.html"&gt;LinLogFS&lt;/a&gt;. The lessons learned led to new, but yet unimplemented &lt;a href="http://www.complang.tuwien.ac.at/anton/lfs/"&gt;ideas&amp;nbsp;for&amp;nbsp;a&amp;nbsp;log-structured/copy-on-write&amp;nbsp;file&amp;nbsp;system&lt;/a&gt;. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="29"&gt;&lt;a href="http://aiya.ms.mff.cuni.cz/lfs/"&gt;Log-structured&amp;nbsp;file&amp;nbsp;system&amp;nbsp;for&amp;nbsp;Linux&amp;nbsp;2.6&lt;/a&gt; has fairly extensive documentation covering an implementation of a log-structured file system for Linux which has a working garbage collector. The site also contains the file system source code and results of a number of measurements that nicely show how it performs, often compared to ext3. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="30"&gt;&lt;a href="http://en.wikipedia.org/wiki/WinFS"&gt;WinFS&lt;/a&gt; - WinFS was a data storage and management system based on relational databases, developed by Microsoft from 2003 to 2006 for use as an advanced storage subsystem for the Microsoft Windows operating system. It has since been cancelled as a separate product, and some of its technologies will be moved into future versions of ADO.NET and Microsoft SQL Server. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="31"&gt;&lt;a href="http://wh.fh-wedel.de/~joern/logfs.pdf"&gt;LogFS&lt;/a&gt; - LogFS is the next generation file system for flash media and a replacement for jffs2. It provides support for large partitions and has good scalability to the size of the file system, while keeping all the good stuff from jffs2, like wear levelling, compression, and robustness. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="32"&gt;&lt;a href="http://www.free-it.de/archiv/talks_2005/paper-11254/paper-11254.pdf"&gt;Union&amp;nbsp;Mounts&lt;/a&gt; - VFS based union mounts let you mount multiple file systems to a single mount point and see the files on each of them simultaneously. This approach adds a much cleaner abstraction than UnionFS, which has similar goals but is implemented as a stacked file system. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Abstractions&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="33"&gt;&lt;a href="http://plan9.escet.urjc.es/who/nemo/export/2kblocks/index.html"&gt;The&amp;nbsp;Box:&amp;nbsp;A&amp;nbsp;Replacement&amp;nbsp;for&amp;nbsp;Files&lt;/a&gt; - &lt;em&gt;The file is a well-understood and very simple abstraction, which has been successfully used in both centralized and distributed systems. However, files are not expressive enough to capture high-level data semantics and relationships, including sharing and data dependencies. How many times has your operating system translated a JPEG figure into postscript, automatically when needed? How do files help applications to deal with heterogeneity? Moreover, optimization opportunities are lost due to the low-level nature of read and write; e.g. in NFS data is sent twice through the network when copying a remote file within the same file server. We feel that a better abstraction is needed and propose an alternate abstraction, the "box", to solve the problems mentioned above. Boxes, while being as simple as files, are more expressive. We intend to use boxes as a central abstraction for a distributed adaptable operating system we are building. &lt;/em&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;High level&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="34"&gt;&lt;a href="http://www.w3.org/DesignIssues/"&gt;Design&amp;nbsp;Issues:&amp;nbsp;Architectural&amp;nbsp;and&amp;nbsp;philosophical&amp;nbsp;points&lt;/a&gt; - &lt;em&gt;These statements of architectural principle explain the thinking behind the specifications. These are personal notes by Tim Berners-Lee: they are not endorsed by W3C. They are aimed at the technical community, to explain reasons, provide a framework to provide consistency for for future developments, and avoid repetition of discussions once resolved.&lt;/em&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="35"&gt;&lt;a href="http://www.namesys.com/whitepaper.html"&gt;The&amp;nbsp;Naming&amp;nbsp;System&amp;nbsp;Venture&lt;/a&gt; - &lt;em&gt;The utility of an operating system is more proportional to the number of connections possible between its components than it is to the number of those components. Namespace fragmentation is the most important determinant of that number of possible connections between OS components. Unix at its beginning increased the integration of I/O by putting devices into the file system name space. This is a winning strategy, let's take the file system name space, and one-by-one eliminate the reasons why the filesystem is inadequate for what other name spaces are used for, one missing feature at a time. Only once we have done so will the hobbles be removed from OS architects, or even OS conspiracies.&lt;/em&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;HCI focused writings&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;em&gt;This may be too far off topic for this page. Edit it out if it's the case. But concider that HCI concideration should have an impact on FS design&lt;/em&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="36"&gt;&lt;a href="http://cla.tc.se/mui.html"&gt;Exploring&amp;nbsp;the&amp;nbsp;Mnemonic&amp;nbsp;user&amp;nbsp;interface&lt;/a&gt; - &lt;em&gt;This article is an offspring of personal reflections over too much time being spent traversing file structures and organizing windows in the user interfaces of today&amp;#8217;s modern operating systems.&lt;/em&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="37"&gt;&lt;a href="http://arstechnica.com/reviews/os/macosx-10.4.ars/11"&gt;File&amp;nbsp;types&amp;nbsp;revisited&lt;/a&gt; - An analyais of Apples "Uniform Type Identifiers" (kind of a replacement for file extensions and mime-types) &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="38"&gt;&lt;a href="http://www.gnome.org/~seth/storage/"&gt;GNOME&amp;nbsp;Storage&lt;/a&gt; - &lt;em&gt;Storage is an exciting project to replace the traditional filesystem with a new document store. Storage is part of a larger design for a new desktop environment&lt;/em&gt;. &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;Workshop Notes&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p sizcache="2" sizset="39"&gt;&lt;a href="http://linuxfs.pbworks.com/LSF07%20Workshop%20Notes"&gt;LSF07 Workshop Notes&lt;/a&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img  src="http://www.catb.org/hacker-emblem/glider.png"  alt="" /&gt; &#xD;
&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/2074671.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/06/07/2074671.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/06/06/2073593.html</id><title type="text">wma/mp3等格式转换为apple有声电子书格式(m4b) 以及itunes导入码率设置</title><summary type="text">有声读物相比普通mp3有不少优点，比如速度控制，自动从上次播放点开始等，有声读物有网上有很多转换方法和工具，其实就用 iTunes 就可以了。颇为简单方便 在音乐上点击鼠标右键 -&amp;gt; &amp;quot;显示简介&amp;quot; -&amp;gt; 选项 -&amp;gt; 媒体种类选择&amp;quot;有声读物&amp;quot;即可，这个是可以批量操作的。 对于wma等格式，直接导入然后转换即可(转为AAC格式)，然后设置媒体种类就好了，码率的设置在菜单&amp;quot;编辑&amp;quot;-&amp;gt;&amp;quot;偏好设置&amp;quot;-&amp;gt;&amp;quot;常...</summary><published>2011-06-06T04:32:00Z</published><updated>2011-06-06T04:32:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/06/06/2073593.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/06/06/2073593.html"/><content type="html">&lt;div &gt;&lt;p&gt;有声读物相比普通mp3有不少优点，比如速度控制，自动从上次播放点开始等，有声读物有网上有很多转换方法和工具，其实就用 iTunes 就可以了。颇为简单方便&lt;/p&gt; &lt;p&gt;在音乐上点击鼠标右键 -&amp;gt; "显示简介" -&amp;gt; 选项 -&amp;gt; 媒体种类选择"有声读物"即可，这个是可以批量操作的。&lt;/p&gt; &lt;p&gt;&lt;img height="492" src="http://images.cnblogs.com/cnblogs_com/peon/201106/201106061232013983.png" width="533" border="0"/&gt;&lt;/p&gt; &lt;p&gt;对于wma等格式，直接导入然后转换即可(转为AAC格式)，然后设置媒体种类就好了，码率的设置在菜单"编辑"-&amp;gt;"偏好设置"-&amp;gt;"常规"选项卡-&amp;gt;"插入CD"旁边的"导入设置"&lt;/p&gt; &lt;p&gt;&lt;img height="574" src="http://images.cnblogs.com/cnblogs_com/peon/201106/201106061232022489.png" width="578" border="0"/&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/2073593.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/06/06/2073593.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/03/04/1970648.html</id><title type="text">Progressive-download 对于文件格式的要求</title><summary type="text">最近在做渐进下载播放，把这个规范要求copy到blog，省的老是找 《Transparent end-to-end packet switched streaming service (PSS);3GPP file format (3GP)(Release 7)》 5.4.5 Progressive-download profile The 3GP Progressive-download pro...</summary><published>2011-03-04T02:40:00Z</published><updated>2011-03-04T02:40:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/03/04/1970648.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/03/04/1970648.html"/><content type="html">&lt;div &gt;&lt;p&gt;最近在做渐进下载播放，把这个规范要求copy到blog，省的老是找&lt;/p&gt; &lt;p&gt;《Transparent end-to-end packet switched streaming service (PSS);3GPP file format (3GP)(Release 7)》&lt;/p&gt; &lt;p&gt;5.4.5 Progressive-download profile&lt;br/&gt; The 3GP Progressive-download profile is branded ‘3gr7’. It is used to label 3GP files that are suitable for progressive download, i.e. a scenario where a file may be played during download (with some delay).&lt;/p&gt; &lt;p&gt;&lt;br/&gt; The following constraints shall apply to 3GP files conforming to Progressive-download profile:&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; - the ‘moov’ box shall be placed right after the ‘ftyp’ box in the beginning of the file;&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; - all media tracks (if more than one) shall be interleaved with an interleaving depth of one second or less.&lt;br/&gt;&lt;/p&gt; &lt;p&gt;NOTE 1: This profile functions as an aid and not a requirement for progressive download, which has been an inherent feature of the 3GPP file format since the first version in Release 4. By parsing a 3GP file, a client can always determine whether a file can be progressively downloaded, and then calculate the interleaving depth from the meta-data in the ‘moov’ box.&lt;br/&gt;&lt;/p&gt; &lt;p&gt;NOTE 2: The ‘interleaving depth of one second or less’ means that:&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp; Each chunk contains one or more samples, with the total duration of the samples being either: no greater than 1 second, or the duration of a single sample if that sample’s duration is greater than 1 second;&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp; Within a track, chunks must be in decoding time order within the media-data box ‘mdat’;&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp; It is recommended that, in ‘mdat’, regardless of media type, the chunks for all tracks are stored in ascending order by decoding time.&amp;nbsp; However, this order may be perturbed so that, when two chunks from different tracks overlap in time, the chunk of one track (e.g. audio) is stored before the chunk of the other track (e.g. video), even if the first sample in the second track has a slightly earlier timestamp than the first sample in the first track.&lt;/p&gt; &lt;p&gt;-----------------------------------------&lt;/p&gt; &lt;p&gt;《ISMA2.0》&lt;/p&gt; &lt;p&gt;Progressive Download Guidelines:&lt;br/&gt; To enable progressive download, session information should always be put at the beginning of the file and the media tracks should be interleaved within the file. The following guidelines should be followed during the creation of ISMA 2.0 files for progressive download:&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp; The Movie box (‘moov’) SHOULD be placed at the start of the file, right after the File Type box (‘ftyp’).&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp; All media data SHOULD be present within the file (the data source of every Data Reference box should be ‘self-contained’);&amp;nbsp;&lt;br/&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp; The media tracks SHOULD be interleaved inside the file. The typical interleaving depth is 1 second.&lt;/p&gt; &lt;p&gt;The meaning of interleaving depth is given as follows: Each chunk contains one or more samples, with the total duration of the samples being either: no greater than 1 second, or the duration of a single sample if that sample’s duration is greater than 1 second. Within a track, chunks must be in decoding time order within the Media Data box (‘mdat’).&lt;br/&gt; A client that does not support progressive download can always play the file once it has been completely downloaded. A progressive download client can start playing a ISMA 2.0 file that has been created along the progressive download guidelines once it has received a first chunk of all media in the session.&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1970648.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/03/04/1970648.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/02/19/1958418.html</id><title type="text">CDN  Origin Pull</title><summary type="text">Origin Pull 这个技术其实说起来也不算什么新鲜玩意，大致就是 PULL from Original Server 的意思。 内容自动的从源站点传输到CDN之中，这个和手工的上传内容相对应。 比如一个域名： www.duba.net， 它的CNAME是 www.duba.net.cachecn.com， 我们访问页面，其中有首页的图标, 浏览器请求logo图片 http://www.dub...</summary><published>2011-02-19T03:22:00Z</published><updated>2011-02-19T03:22:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/02/19/1958418.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/02/19/1958418.html"/><content type="html">&lt;div &gt;&lt;p&gt;Origin Pull 这个技术其实说起来也不算什么新鲜玩意，大致就是 PULL from Original Server 的意思。 内容自动的从源站点传输到CDN之中，这个和手工的上传内容相对应。&lt;/p&gt; &lt;p&gt;比如一个域名： &lt;a href="http://www.duba.net/"&gt;www.duba.net&lt;/a&gt;&amp;nbsp;， 它的CNAME是 &lt;a href="http://www.duba.net.cachecn.com/"&gt;www.duba.net.cachecn.com&lt;/a&gt;&amp;nbsp;， 我们访问页面，其中有首页的图标, 浏览器请求logo图片 &lt;a href="http://www.duba.net/v5/images/logo.jpg"&gt;http://www.duba.net/v5/images/logo.jpg&lt;/a&gt;&amp;nbsp;，&lt;/p&gt; &lt;p&gt;CNAME 的 解析 IP 指向一个CDN缓存服务器， CDN检查该 &lt;u&gt;&lt;font color="#0000FF"&gt;v5/images/logo.jpg&lt;/font&gt;&lt;/u&gt;&amp;nbsp;是否存在于CDN, 和内容的Fresh情况， 假如内容不存在或者过期,&amp;nbsp; 就从CNAME关联的源服务器(CDN系统配置的)自动获取内容，这里可能是&amp;nbsp; http://&lt;a href="http://www.duba.net/"&gt;www.duba.net&lt;/a&gt;&amp;nbsp;, 或者是 image.duba.net/logoimage ( 比如 &lt;a href="http://image.duba.net/logoimage/"&gt;http://image.duba.net/logoimage/&lt;/a&gt;&lt;u&gt;&lt;font color="#0000FF"&gt;v5/images/logo.jpg&lt;/font&gt;&lt;/u&gt;&amp;nbsp;)也说不定.&lt;/p&gt; &lt;p&gt;这个和常见的反向代理cache差不多。&lt;/p&gt; &lt;p&gt;源服务器要适当的设置 HTTP 的 cache 头,&amp;nbsp; 用来供CDN控制刷新时间。没有的话，CDN会有缺省配置。&lt;/p&gt; &lt;p&gt;一般来说，CDN也允许手工设置刷新时间。&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1958418.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/02/19/1958418.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/02/09/1950049.html</id><title type="text">牛项目 Harvest</title><summary type="text">昨晚看《A Hierarchical Internet Object Cache》的时候，看到paper里面吹Harvest是如何的牛，就google了一下，还真的很牛:  Harvest 后来发展成了大名鼎鼎的 Squid Netcache 产品也是 based on Harvest (netcache 曾经是如雷贯耳的 netapp 产品，，后来卖给了 blue coat ) Harvest ...</summary><published>2011-02-09T00:29:00Z</published><updated>2011-02-09T00:29:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/02/09/1950049.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/02/09/1950049.html"/><content type="html">&lt;div &gt;&lt;p&gt;昨晚看《A Hierarchical Internet Object Cache》的时候，看到paper里面吹Harvest是如何的牛，就google了一下，还真的很牛:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Harvest 后来发展成了大名鼎鼎的 Squid&lt;/li&gt; &lt;li&gt;Netcache 产品也是 based on Harvest (netcache 曾经是如雷贯耳的 netapp 产品，，后来卖给了 blue coat )&lt;/li&gt; &lt;li&gt;Harvest 的作者之一(也是paper作者之一)， Chunk Neerdaels ， 目前在Akamai做VP&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;基本上算是 Caching / CDN 产业的源头项目(还是加个"之一"吧)了啊！&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1950049.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/02/09/1950049.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/02/06/1949506.html</id><title type="text">CDN设计：[笔记]Analysis of Enterprise Media Server Workloads</title><summary type="text">这里主要是对paper的笔记，和一些将访问模式应用到实际video CDN系统设计的考虑 【Key new observations】  with 77-79%of media sessions being less than 10 min long, 7-12% of the sessions being 10-30 min, and 6-13% ofsessions continued for...</summary><published>2011-02-06T10:30:00Z</published><updated>2011-02-06T10:30:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/02/06/1949506.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/02/06/1949506.html"/><content type="html">&lt;div &gt;&lt;p&gt;这里主要是对paper的笔记，和一些将访问模式应用到实际video CDN系统设计的考虑&lt;/p&gt; &lt;p&gt;【Key new observations】&lt;/p&gt; &lt;ul&gt; &lt;li&gt;with 77-79%of media sessions being less than 10 min long, 7-12% of the sessions being 10-30 min, and 6-13% ofsessions continued for more than 30 min.&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;对于对象的cache有两种选择：全部缓存，和部分缓存。部分缓存比完整对象复杂得多，但是看看它能够带来的好处: 有不少的session都是很短的，这里10分钟以下的session达到了77%以上,这样，对于影片之类的大对象的部分缓存，就意味着更加的节省cache资源，而且使用有限的空间，可以得到更高的命中率&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Most of the incomplete sessions (i.e. terminated by clients before the video was fnished) are accessing the initial segments of media file.&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;缓存影片头部比缓存整个片子更加划得来，特别是对于冷片，访问头部的session会更多(看了开头就不想看了)&lt;/p&gt; &lt;ul&gt; &lt;li&gt;high locality of accesses: 14-30% of the files accessed on the server account for 90% of the media sessions&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;这里都是常识了，常见的20/80规律，不过有些人居然把20/80一个定性的东西当成一个定量的指标就比较杯具了&lt;/p&gt; &lt;ul&gt; &lt;li&gt;there is a significant number of files that are rarely accessed (16% to 19% of the files are accessed only once)&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;对于这些影片如何优化cache，是一个可以提高的地方，关键是这部分影片的比例有多少。&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Zipf Like distribution&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;这个我也统计过，参见这里(&lt;a href="http://blog.lmtw.com/b/peon/archives/2006/39703.html"&gt;http://blog.lmtw.com/b/peon/archives/2006/39703.html&lt;/a&gt;)&lt;/p&gt; &lt;p&gt;IPTV几个site都是a=0.6左右，比paper的a值低很多。这种情况下，20的内容只能覆盖50的sessions&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Accesses to the new files constitute most of the accesses in any given month&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;paper里面的enterprise环境会加剧这个倾向，毕竟一些企业的多媒体对象实时性很强，和新闻差不多。但是对于IPTV影视，这个也是成立的。可惜我这里没有更好的数据。一些site会缺省的把新片做一个PUSH，这是值得提倡的&lt;/p&gt; &lt;ul&gt; &lt;li&gt;For both workloads, 51-52% of accesses to media files occur during the first week of their introduction.&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;说明大部分新片也会很快变冷，这个充分说明了我2002做的时间加权算法的优越性了，否则统计一个时间窗或者是累计点击次数，都是对于影片的冷热变化趋势不够敏感的&lt;/p&gt; &lt;p&gt;------------------------------------------------------------------------------------&lt;/p&gt; &lt;ul&gt; &lt;li&gt;访问时长&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;&lt;img height="257" src="http://images.cnblogs.com/cnblogs_com/peon/201102/201102061829398401.jpg" width="407" border="0"/&gt;&lt;/p&gt; &lt;p&gt;&lt;img height="220" src="http://images.cnblogs.com/cnblogs_com/peon/201102/201102061829401041.jpg" width="407" border="0"/&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Zipf统计图&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;&lt;img height="549" src="http://images.cnblogs.com/cnblogs_com/peon/201102/201102061829447359.jpg" width="871" border="0"/&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;New Files 访问占一个月访问的比例&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;&lt;img height="267" src="http://images.cnblogs.com/cnblogs_com/peon/201102/20110206182945490.jpg" width="284" border="0"/&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1949506.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/02/06/1949506.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/02/01/1948564.html</id><title type="text">CDN设计 - 层级化的cache_A</title><summary type="text">本节主要来自 web caching 的 Chapter 7. Cache Hierarchies ， 这节主要就是笔记。 cache层级化主要是为了提高命中率，cache无论是容量还是性能都是有限的，假如cache miss了，从neighbor cache获取内容一般来讲比从origin server好: 可以节约延迟和WAN的带宽。 层级化意味着多个cache，cache之间常见的关系是两种...</summary><published>2011-02-01T03:02:00Z</published><updated>2011-02-01T03:02:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/02/01/1948564.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/02/01/1948564.html"/><content type="html">&lt;div &gt;&lt;p&gt;本节主要来自 web caching 的 Chapter 7. Cache Hierarchies ， 这节主要就是笔记。&lt;/p&gt; &lt;p&gt;cache层级化主要是为了提高命中率，cache无论是容量还是性能都是有限的，假如cache miss了，从neighbor cache获取内容一般来讲比从origin server好:&amp;nbsp; 可以节约延迟和WAN的带宽。&lt;/p&gt; &lt;p&gt;层级化意味着多个cache，cache之间常见的关系是两种：parent-child, sibling-sibling ， neighbor 和 peers的意义比较自由，可以包含这两种含义。&lt;/p&gt; &lt;ul&gt; &lt;li&gt;child cache 会将请求转到它的 parent , parent 会从自身cache，或者origin server, 或者其它cache来满足该请求。&lt;/li&gt; &lt;li&gt;sibling 的请求应该都是命中的，而sibling假如peer的请求没有命中，也不应该去试图获取该内容，它会返回一个表示出错的消息，sibling之间使用一些intercache协议来交互，来知道哪个peer有指定内容&lt;/li&gt; &lt;li&gt;parent-child, sibling-sibling 关系并非固定，一个cache可以作为某些cache的parent，同时是另外的cache的sibling；或者对于特定域的请求是parent，其它的是sibling&lt;/li&gt; &lt;li&gt;peers关系不一定对称，A可以发request给B，但是B不一定能够发request给A，一般来讲，parent-child关系都非对称，sibling关系常常是对称的&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;最后组成了 hierarchical topology ,&lt;/p&gt; &lt;p&gt;&lt;img height="211" alt="figs/WebC_0701.gif" src="mk:@MSITStore:D:/BOOK/CDN_BOOK/Web%20Caching-OReilly.chm::/FILES/WebC_0701.gif" width="280" border="0"/&gt;&lt;/p&gt; &lt;p&gt;下面这个就不是hierarchical topology ， 而是 mesh topology .&lt;/p&gt; &lt;p&gt;&lt;img height="291" alt="figs/WebC_0702.gif" src="http://images.cnblogs.com/cnblogs_com/peon/201102/201102011105431640.png" width="327" border="0"/&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;7.2.1 Performance&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;要获得性能提升，需要一些条件(必须全部满足)：&lt;/p&gt; &lt;ul&gt; &lt;li&gt;一些本地没有得内容可以从peer得到&lt;/li&gt; &lt;li&gt;从peer得到的cache hit比从origin server块&lt;/li&gt; &lt;li&gt;parent cache,的cache miss不会明显比origin server慢&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;假如parent cache 负载很重，或者neighbor cache 比较远，都会使性能受到影响，而且这些可能随着时间或者其他条件而不同，所以需要一些minitor tool来监控情况。&lt;/p&gt; &lt;p&gt;7.2.2 Nondefault Routing&lt;/p&gt; &lt;p&gt;Parent caches are useful when you need to force web traffic along a specific route in your network。 比如防火墙。一些机构还使用多个parent，因为一些链路可能便宜但是拥塞，而昂贵的链路比较快速，所以可以根据优先级来选择链路。&lt;/p&gt; &lt;p&gt;附言：我目前从事 Video CDN 的设计开发，也做Streaming Server cluster，折腾了8年了。CDN这个行业说新不新，说老不老，和CDN相关的文章有很多，但是说"大"概念的很多，人云亦云的很多，我想想把我这些年的经验东西写成一个系列，记录一些东西，有我实现过的，也有一些没有没有实现过的想法，有看书或者paper的得到的一些知识，还有业界的某些做法。&lt;/p&gt; &lt;p&gt;最近的工作的重心转移了，做技术研究的时间也越来越少，感觉这两年的文章越写越少，质量也低了，先把写系列的话放出来，可以避免自己食言:&amp;gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;div  style="margin-top:15px;margin-bottom:10px"&gt;&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;&lt;img src="http://image.webstory.my/WebStoryLogo24.png" alt="菊子曰" style="border:0;" /&gt;&lt;/a&gt;&amp;nbsp;本文用&lt;a target="_blank" href="http://sns.juziyue.com/webinvite.php?u=4894"&gt;菊子曰&lt;/a&gt;发布&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1948564.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/02/01/1948564.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/peon/archive/2011/01/08/1930534.html</id><title type="text">Apple http live streaming 不支持windows?</title><summary type="text">了解过 apple 的 http live streaming 以后，也测试了一下，用的是 http://iphone.akamai.com/ 。安装quicktime以后视频出来了，因为用了XX代理所以没有抓包，当时就告一段落。 最近想彻底了解一下，结果发现在windows下，不管我用IE / firefox / Safari / chrome 还是quicktime/vlc , 都无法观看，抓...</summary><published>2011-01-08T03:21:00Z</published><updated>2011-01-08T03:21:00Z</updated><author><name>加菲猫</name><uri>http://www.cnblogs.com/peon/</uri></author><link rel="alternate" href="http://www.cnblogs.com/peon/archive/2011/01/08/1930534.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/peon/archive/2011/01/08/1930534.html"/><content type="html">&lt;div &gt;&lt;p&gt;了解过 apple 的 http live streaming 以后，也测试了一下，用的是 &lt;a href="http://iphone.akamai.com/"&gt;http://iphone.akamai.com/&lt;/a&gt;&amp;nbsp; 。安装quicktime以后视频出来了，因为用了XX代理所以没有抓包，当时就告一段落。&lt;/p&gt; &lt;p&gt;最近想彻底了解一下，结果发现在windows下，不管我用IE / firefox / Safari / chrome 还是quicktime/vlc , 都无法观看，抓包发现到 m3u8 文件以后，播放器或者浏览器就停下来了，看来不支持啊！上网找了一下，结果竟然 windows/linux不支持，都提交标准了，居然windows不支持，乔布斯真有你的！&lt;/p&gt; &lt;p&gt;原来那个测试，看了下，原来是老式的 http progressive download, 哎！&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/peon/aggbug/1930534.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/peon/archive/2011/01/08/1930534.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry></feed>
