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. Codeblocks 遇到的问题 Cannot open output file, permission denied

    Codeblocks下运行C++的程序时,偶尔会出现  Cannot open output file, permission denied 的问题,导致不能够编译. 在 Stack Overflow ...

  2. 便于记忆的SA构造

    首先学习基数排序. memset(b, 0, sizeof(b)); for(int i = 0; i < n; i++) b[a[i]]++; for(int i = 1; i <= m ...

  3. Python-类的特性(property)

    什么是特性property property是一种特殊的属性,访问它时会执行一段功能(函数)然后返回值 例一:BMI指数(bmi是计算而来的,但很明显它听起来像是一个属性而非方法,如果我们将其做成一个 ...

  4. 全局关键字搜索:Element UI Table内容过滤\jQuery过滤器fastLiveFilter插件\BootstrapVue插件;

    ```html data:{ resultMaster: [], otableData:[], schfilter:'' } watch: { schfilter: function(val, old ...

  5. poj2226 Muddy Fields 填充棒子(二分匹配)

    参考博客:https://blog.csdn.net/liujc_/article/details/51287019 参考博客:https://blog.csdn.net/acdreamers/art ...

  6. javaweb之Cookie学习

    Cookie简介 HTTP是无状态协议,服务器不能记录浏览器的访问状态,也就是说服务器不能区分中两次请求是否由一个客户端发出.这样的设计严重阻碍的Web程序的设计.如:在我们进行网购时,买了一条裤子, ...

  7. echarts使用笔记四:双Y轴

    1.双Y轴显示数量和占比 app.title = '坐标轴刻度与标签对齐'; option = { title : { //标题 x : 'center', y : 5, text : '数量和占比图 ...

  8. windows中在vs code终端使用bash

    vs code Visual Studio Code的缩写,很好用的一个编辑器. 终端 vs code的终端(命令行)在windows中,默认使用的是powershell,如下图所示: powersh ...

  9. IdentityServer4【QuickStart】之使用ResourceOwnerPassword流程来保护API

    使用ResourceOwnerPassword流程来保护API OAuth2.0中的ResourceOwnerPassword授权流程允许一个客户端发送username和password到token服 ...

  10. laravel belongsTo使用

    前提:订单表(order)和用户表(user) 表结构: order CREATE TABLE `order` ( `id` char(16) COLLATE utf8mb4_unicode_ci N ...