How to mount a xen image ?
- First you need to find out the partitions and the startsector of partitions: [root@xen rruban]# file rheltest.img rheltest.img: x86 boot sector, GRand Unified Bootloader (0.94); partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, starthead 0, startsector 208845, 3871665 sectors, code offset 0x48 There are 3 partitions inside the image file. The startsector of each partition is also listed. Boot partition will have start sector 63.
- Now you need to get the sector size: [root@xen]fdisk -lu rheltest.img
Disk rheltest.img: 0 MB, 0 bytes 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System rheltest.img1 * 63 208844 104391 83 Linux rheltest.img2 208845 4080509 1935832+ 8e Linux LVM The above shows the sector byte size is 512 byte.
- To calculating the offset: offset = startsector x sectorbyte_size. The startsector is 63 for the first partition, therefore the first partition offset is: 63x512=32256
- Finally, to mount the xen image, use: mount -o loop,offset=32256 test.img /foldername
文章分类
标签云
Gray,
Public,
灰度发布,
灰度放量,
ABTest,
AB测试,
分流发布
CentOS,
Linux,
Shell
Mac,
Shell,
Vim
Linux
SSH
Mac
Mail
MacOSX
命令
MySQL,
调优
Apache,
HTTP,
ngnix
MySQL
gif,
jpeg,
png
Markdown
CentOS
PHP,
WordPress,
Blog
AsciiDoc,
mod_deflat
sudo
Leopard,
Snow
Leopard
Apache
Nginx,
木马
hostname,
upload
md5,
md5sum,
DNS
版本
Cookie,
PHP
Chrome
DooPHP,
CSS
Filter
IT
Java,
Maven,
Thrift
Git
Memcache
MongoDB
Node
Node.js
npm
HTML
Nginx
JDK,
Sublime
Timestamp
Lua,
Redis,
MacOSX,
Class,
Function
Sublime,
Snippets
ObjC
Cobar,
Bash
Brew,
Homebrew
AsciiDoc
Error
Yii
MacOSX,Hadoop,MapReduce
memcache,
Markdown,
Jekyll
VIM
Go,
Golang,
Redis
MacTeX,
CJK,
Tex
Tex,
LaTex
R,
Brew
Android,
Java
EC
Mou
GoAgentX,
GoAgent
Python
HBase
Markdown,Slide
Jenv
kerberos
Junit
Maven
虚拟化
LXC
Docker
bridge
AngularJS
PHPUnit
Android
composer
Golang
ReactNative,
项目管理
MAMP,
Memcache,
SecureCRT,
Zoc,
Mail,
GPG
Docker,
Supervisor
Test
Retail
Pay