feisky

云计算、虚拟化与Linux技术笔记
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 66 下一页

2012年5月31日

摘要: 在linux中,对于img文件(例如,虚拟机的img文件),有时候需要将其挂载,以便修改其中的内容。能不能将它像iso文件一样挂载呢?其实方法很简单,只需要两步:#kpartx -av xxx.img得到如下信息:add map loop0p1 ...此时只需要mount loop0p1即可#mount /dev/mapper/loop0p1 /mntOK,这样就可以进入mnt对img文件的内容进行修改了要卸载也很简单,同样是两步:umount /mntkpartx -d xxx.img转自:http://netessays.blogbus.com/logs/149269677.html 阅读全文

posted @ 2012-05-31 10:15 feisky 阅读(3650) 评论(0) 推荐(0)

2012年4月27日

摘要: 前不久因项目需要写了开机启动其他程序的shell脚本,因工作忙,调试完给了技术支持人员,也没去注意过。到后来,有几台服务器突然被重启了,这时候领导问,怎么开机启动的脚本没起作用,还被批了一顿,哎,做事虎头蛇尾,活该!然后去查,一直没查到原因,手动执行都是正确的,在排除了权限原因和脚本问题后,很郁闷,怎么放到开机启动项目中就无法执行了呢。于是去查linux开机启动过程信息。google下,看了下关于一些开机启动启的资料,发现了开机启动程序的级别为3.果断顺藤莫瓜,找到了这个目录 /etc/rc.d/rc3.d,进去一看恍然大悟。我的rc.local文件是在 /etc/rc.local中(网上都是 阅读全文

posted @ 2012-04-27 12:39 feisky 阅读(843) 评论(0) 推荐(0)

摘要: 先以time为例:解决time命令输出信息的重定向问题time命令的输出信息是打印在标准错误输出上的,我们通过一个简单的尝试来验证一下。[root@web186 root]#time find . -name "mysql.sh" >1.txtreal 0m0.081suser 0m0.060ssys 0m0.020s[root@web186 root]#time find . -name "mysql.sh" 2>2.txt./work186/sms/bin/mysql.sh./work186/sms/src/scripts/mysql.s 阅读全文

posted @ 2012-04-27 11:20 feisky 阅读(3402) 评论(0) 推荐(0)

2012年4月24日

摘要: 一个诡异的bash问题今天写的一个bash脚本运行发现:test.sh: 1: #!/bin/bash: not found本以为是由于在windows下编辑导致的问题,执行dos2unix之后问题依旧。后来想到用file命令查看,文件居然是UTF-8 Unicode (with BOM) text格式# file test.sh test.sh: UTF-8 Unicode (with BOM) text而正常的bash脚本格式应该为 Bourne-Again shell script text executable用vim -b test.sh删除开头的<feff>即可。 阅读全文

posted @ 2012-04-24 14:44 feisky 阅读(570) 评论(0) 推荐(0)

2012年4月16日

摘要: 作为长期的电脑使用者,肯定会有误删文件的经历,在 Mac OS X 和 Windows 上删除的文件都会默认进 “回收站”。在 Linux 上如果事先没有用别名(alias)修改默认的 rm 功能,rm 后文件就会丢失,幸运的是,在一般的删除文件操作中,Linux 并不会立即清空存储该文件的 block 内容,而只会释放该文件所占用的 inode 和 data block,Linux 上 rm 的过程其实就是将 inode bitmap 和 data block bitmap 中的相应标识设为空闲状态的过程,并不涉及到真正的数据,这也是为什么在 Linux 下删除大文件这么快速的原因,因为大文 阅读全文

posted @ 2012-04-16 10:54 feisky 阅读(578) 评论(0) 推荐(0)

2012年4月14日

摘要: 背景由于Linux缓存机制的设计,系统对缓存的使用是非常狠的,所以经常会看到某些环境内存只剩几十兆了,而应用只用了不到一半。所以在计算可用内存的时候,一定要算上缓存的部分。通常方法,就是通过free命令首行free+cached+buffers计算,或者直接使用第二行的free字段。但这个方法有时仍然会造成比较大的误差,导致性能监控等方面的问题。比如系统中使用了大量的共享内存会造成多计算可用内存;再比如对大量的文件做了查询(find / ?!!!),会导致少计算可用内存。对于这点我在《说说free命令》中有详细的说明。这里就不再赘述了。SUSE11 SP1基于2.6.32内核,内核暴露了更多的 阅读全文

posted @ 2012-04-14 20:11 feisky 阅读(4489) 评论(0) 推荐(0)

摘要: One of the questions we always get asked at meet-ups and conversations with other engineers is, “what’s your stack?” We thought it would be fun to give a sense of all the systems that power Instagram, at a high-level; you can look forward to more in-depth descriptions of some of these systems in the 阅读全文

posted @ 2012-04-14 19:46 feisky 阅读(765) 评论(0) 推荐(0)

2012年4月13日

摘要: xm list和xl list显示内存不一致的问题 在xen4.1.2上一台windows虚机碰到这个问题: # xm list test6 Name ID Mem VCPUs State Time(s) test6 16 512 2 -b---- 158.0 # xl list test6 Name ID Mem VCPUs State Time(s) test6 16 2048 2 -b---- 158.6 同一台虚机,用两个不同的工具查看,内存居然差了将近2GB。 由于xm和xl的实现机制不同,所以从源码分析开始,分别查看xm list和xl list的源码 xm list: 前文(h. 阅读全文

posted @ 2012-04-13 17:16 feisky 阅读(1439) 评论(0) 推荐(0)

2012年4月11日

摘要: Xen 4.2 will contain two new scheduling parameters for the credit1 scheduler which significantly increase its confurability and performance for cloud-based workloads:timeslice_msandratelimit_us. This blog post describes what they do, and how to configure them for best performance.TimesliceThe timesl 阅读全文

posted @ 2012-04-11 13:01 feisky 阅读(1036) 评论(0) 推荐(0)

2012年4月10日

摘要: python epoll用法import socket, selectEOL1 = b'\n\n'EOL2 = b'\n\r\n'response = b'HTTP/1.0 200 OK\r\nDate: Mon, 1 Jan 1996 01:01:01 GMT\r\n'response += b'Content-Type: text/plain\r\nContent-Length: 13\r\n\r\n'response += b'Hello, world!'serversocket = socket.socke 阅读全文

posted @ 2012-04-10 21:28 feisky 阅读(1169) 评论(0) 推荐(0)

摘要: xen-4.1.2+Linux-3.1.2源码编译安装以下所有命令均在CentOS6.2系统上操作。下载xen源码wget http://bits.xensource.com/oss-xen/release/4.1.2/xen-4.1.2.tar.gz安装必备软件包yum groupinstall "Development Libraries"yum groupinstall "Development Tools"yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fs 阅读全文

posted @ 2012-04-10 21:10 feisky 阅读(3081) 评论(0) 推荐(0)

摘要: 在xen4.1之前,通过设置/etc/xen/xend-config.sxp中的(network-script network-bridge)可以让xend来自动设置网桥。但是xen4.1之后不建议这么做:When using thexltoolstack the host networking configuration is not configured by the toolstack but rather administrators are required to setup an appropriate network configuration using the tools p 阅读全文

posted @ 2012-04-10 21:01 feisky 阅读(1253) 评论(1) 推荐(0)

摘要: You should always dedicate fixed amount of RAM for Xen dom0.This can be done by specifying "dom0_mem=512M" option for Xen hypervisor (usually xen.gz) in grub.conf/menu.lst. This makes sure the initial size of memory allocated for dom0 is 512 MB (replace with the amount of memory you want), 阅读全文

posted @ 2012-04-10 21:00 feisky 阅读(605) 评论(0) 推荐(0)

摘要: 如何从centos6.0升级到centos6.2首先替换默认源为163源:mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupwget http://mirrors.163.com/.help/CentOS6-Base-163.repomv CentOS6-Base-163.repo /etc/yum.repos.d/升级系统:yum makecacheyum update升级过程中报了一个key相关的错误,具体记不清了,重新执行yum update确定导入key即可。重启,确认更新成功:[r 阅读全文

posted @ 2012-04-10 20:59 feisky 阅读(442) 评论(0) 推荐(0)

2012年4月9日

摘要: What is the difference between urllib and urllib2 modules of Python?You might be intrigued by the existence of two separate URL modules in Python -urllibandurllib2. Even more intriguing: they are not alternatives for each other. So what is the difference betweenurllibandurllib2, and do we need them 阅读全文

posted @ 2012-04-09 18:20 feisky 阅读(518) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 66 下一页
无觅相关文章插件,快速提升流量