Linux qemu-nbd mount qemu disk image

deepin@deepin:~$
deepin@deepin:~$ qemu-nbd --help
Usage: qemu-nbd [OPTIONS] FILE
QEMU Disk Network Block Device Server -h, --help display this help and exit
-V, --version output version information and exit Connection properties:
-p, --port=PORT port to listen on (default `')
-b, --bind=IFACE interface to bind to (default `0.0.0.0')
-k, --socket=PATH path to the unix socket
(default '/var/lock/qemu-nbd-DEVICE')
-e, --shared=NUM device can be shared by NUM clients (default '')
-t, --persistent don't exit on the last connection
-v, --verbose display extra debugging information
-x, --export-name=NAME expose export by name
-D, --description=TEXT with -x, also export a human-readable description Exposing part of the image:
-o, --offset=OFFSET offset into the image
-P, --partition=NUM only expose partition NUM General purpose options:
--object type,id=ID,... define an object such as 'secret' for providing
passwords and/or encryption keys
-T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]
specify tracing options
--fork fork off the server process and exit the parent
once the server is running
Kernel NBD client support:
-c, --connect=DEV connect FILE to the local NBD device DEV
-d, --disconnect disconnect the specified device Block device options:
-f, --format=FORMAT set image format (raw, qcow2, ...)
-r, --read-only export read-only
-s, --snapshot use FILE as an external snapshot, create a temporary
file with backing_file=FILE, redirect the write to
the temporary one
-l, --load-snapshot=SNAPSHOT_PARAM
load an internal snapshot inside FILE and export it
as an read-only device, SNAPSHOT_PARAM format is
'snapshot.id=[ID],snapshot.name=[NAME]', or
'[ID_OR_NAME]'
-n, --nocache disable host cache
--cache=MODE set cache mode (none, writeback, ...)
--aio=MODE set AIO mode (native or threads)
--discard=MODE set discard mode (ignore, unmap)
--detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)
--image-opts treat FILE as a full set of image options See <http://qemu.org/contribute/report-a-bug> for how to report bugs.
More information on the QEMU project at <http://qemu.org>.
deepin@deepin:~$
deepin@deepin:~$
deepin@deepin:~$ grep NBD /boot/config-4.4.102-deepin-server
CONFIG_BLK_DEV_NBD=m
deepin@deepin:~$
deepin@deepin:~$ modinfo nbd
filename: /lib/modules/4.4.-deepin-server/kernel/drivers/block/nbd.ko
license: GPL
description: Network Block Device
depends:
intree: Y
vermagic: 4.4.-deepin-server SMP mod_unload modversions aarch64
parm: nbds_max:number of network block devices to initialize (default: ) (int)
parm: max_part:number of partitions per device (default: ) (int)
deepin@deepin:~$
deepin@deepin:~$ sudo modprobe nbd max_part=16
deepin@deepin:~$
deepin@deepin:~$ sudo ls -al /dev/nbd*
brw-rw---- root disk , 2月 : /dev/nbd0
brw-rw---- root disk , 2月 : /dev/nbd1
brw-rw---- root disk , 2月 : /dev/nbd10
brw-rw---- root disk , 2月 : /dev/nbd11
brw-rw---- root disk , 2月 : /dev/nbd12
brw-rw---- root disk , 2月 : /dev/nbd13
brw-rw---- root disk , 2月 : /dev/nbd14
brw-rw---- root disk , 2月 : /dev/nbd15
brw-rw---- root disk , 2月 : /dev/nbd2
brw-rw---- root disk , 2月 : /dev/nbd3
brw-rw---- root disk , 2月 : /dev/nbd4
brw-rw---- root disk , 2月 : /dev/nbd5
brw-rw---- root disk , 2月 : /dev/nbd6
brw-rw---- root disk , 2月 : /dev/nbd7
brw-rw---- root disk , 2月 : /dev/nbd8
brw-rw---- root disk , 2月 : /dev/nbd9
deepin@deepin:~$
deepin@deepin:~$ sudo qemu-nbd --connect=/dev/nbd0 ./vans-kvm.qcow2 --nocache
deepin@deepin:~$ sudo fdisk -l /dev/nbd0
deepin@deepin:~$ sudo ls -l /dev/nbd0*
deepin@deepin:~$
deepin@deepin:~$ sudo mkdir -p /mnt/bsd_system
deepin@deepin:~$ sudo chmod 777 /mnt/bsd_system
deepin@deepin:~$ sudo mount -t ufs -o ro,ufstype=44bsd /dev/nbd0p5 /mnt/bsd_system
deepin@deepin:~$
deepin@deepin:~$ sudo mkdir -p /mnt/bsd_data
deepin@deepin:~$ sudo chmod 777 /mnt/bsd_data
deepin@deepin:~$ sudo mount -t ufs -o ro,ufstype=44bsd /dev/nbd0p7 /mnt/bsd_data
deepin@deepin:~$
deepin@deepin:~$ sudo mkdir -p /mnt/fat_dos
deepin@deepin:~$ sudo chmod 777 /mnt/fat_dos
deepin@deepin:~$ sudo mount -t vfat -o ro,umask=000,noatime,async,codepage=936,iocharset=gb2312 /dev/nbd0p2 /mnt/fat_dos
deepin@deepin:~$
deepin@deepin:~$ sudo umount /mnt/bsd_system
deepin@deepin:~$ sudo umount /mnt/bsd_data
deepin@deepin:~$ sudo umount /mnt/fat_dos
deepin@deepin:~$ sudo qemu-nbd --disconnect /dev/nbd0
deepin@deepin:~$

============ End

Linux qemu-nbd mount qemu disk image的更多相关文章

  1. Linux下编译安装qemu和libvirt

    目录 [hide] 1 安装qemu 1.1 qemu介绍 1.2 下载源文件 1.3 编译安装 2 安装libvirt 2.1 libvirt介绍 2.2 下载libvirt 2.3 编译安装 3  ...

  2. Linux mount BSD disk partition

    Linux mount BSD disk partition 来源 https://www.cnblogs.com/jhcelue/p/6858159.html 假设须要从第二块硬盘复制文件.该硬盘格 ...

  3. Linux下编译安装qemu和libvirt【转】

    转自:http://www.cnblogs.com/findumars/p/5679742.html 目录 [hide] 1 安装qemu 1.1 qemu介绍 1.2 下载源文件 1.3 编译安装 ...

  4. 编译aarch64 Linux内核并基于qemu运行

    核心流程 首先,本文主要讲述如何编译Linux内核并在qemu虚拟机上运行.这里针对的架构是aarch64. 本文的实验平台是Ubuntu 16.04. 为了达成目标,我们需要有qemu.buildr ...

  5. Redhat linux 挂载命令mount

    命令格式: mount [-t vfstype] [-o options] device dir 其中: 1.-t vfstype 指定文件系统的类型,通常不必指定.mount 会自动选择正确的类型. ...

  6. linux下的mount命令的用法详解

    挂接命令(mount) 首先,介绍一下挂接(mount)命令的使用方法,mount命令参数非常多,这里主要讲一下今天我们要用到的. 命令格式:mount [-t vfstype] [-o option ...

  7. MOUNT MACBOOK DISK (OSX / HFS+) ON UBUNTU 12.04 LTS WITH READ/WRITE

    MOUNT MACBOOK DISK (OSX / HFS+) ON UBUNTU 12.04 LTS WITH READ/WRITE So you want to mount your HFS+ ( ...

  8. 【转】linux文件系统之mount流程分析

    本质上,Ext3 mount的过程实际上是inode被替代的过程. 例如,/dev/sdb块设备被mount到/mnt/alan目录.命令:mount -t ext3 /dev/sdb /mnt/al ...

  9. 【转载】linux下的mount命令详解;

    以下内容来自:http://blog.csdn.net/clozxy/article/details/5299054 http://linux.chinaunix.net/techdoc/system ...

随机推荐

  1. python三:循环语句练习--小白博客

    # 打印0-10去掉5 count = - : count += : continue print(count) # 打印0-10的偶数 count = : print(count) count+= ...

  2. Technical Development Guide---for Google

    Technical Development Guide This guide provides tips and resources to help you develop your technica ...

  3. HDU - 1698 线段树区间修改,区间查询

    这就是很简单的基本的线段树的基本操作,区间修改,区间查询,对区间内部信息打上laze标记,然后维护即可. 我自己做的时候太傻逼了...把区间修改写错了,对给定区间进行修改的时候,mid取的是节点的左右 ...

  4. Day12 Python基础之生成器、迭代器(高级函数)(十)

    https://www.cnblogs.com/yuanchenqi/articles/5769491.html 1. 列表生成式 我现在有个需求,看列表[0, 1, 2, 3, 4, 5, 6, 7 ...

  5. 多线程系列之二:Single Thread Execution 模式

    一,什么是SingleThreadExecution模式?同一时间内只能让一个线程执行处理 二,例子 1.不安全的情况 用程序模拟 三个人频繁地通过一个只允许一个人经过的门.当人通过时,统计人数便会增 ...

  6. ESLint常见命令(规则表)

    1 禁用 ESLint: /* eslint-disable */ ; console.log(a); /* eslint-enable */ 2 禁用一条规则: /*eslint-disable n ...

  7. node path

    1.path.basename(path[, ext]) ● path <string> ● ext <string> An optional file extension ● ...

  8. IdentityServer4【QuickStart】之切换到混合流并且添加API访问

    切换到混合流并且添加API访问 前面的示例中我们开发了API访问和用户认证,现在我们要将两个合并到一起. OpenID Connect&OAuth 2.0组合的美妙之处是,你可以使用单一协议和 ...

  9. 《Effective C++》让自己习惯C++:条款1-条款4

    条款1:视C++为一个语言联邦 可以将C++分为4个层次: 1.C:C++实在C语言的基础上发展而来的. 2:Object-Oriented C++:C++面向对象. 3:Template C++:C ...

  10. Farm Irrigation

    题目:Farm Irrigation 题目链接:http://210.34.193.66:8080/vj/Problem.jsp?pid=1494 题目思路:并查集 #include<stdio ...