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. 二、截取字符串长度(css方式)

    只针对谷歌 width: 100%; //height: 58px; overflow:hidden; text-overflow:ellipsis; display: -webkit-box; -w ...

  2. 2017百度软研(C++)

    问了很多,不过很多也都没有问到,感觉有点偏,很深入的东西,越问越虚.第一次实习面试从百度开始,也从百度结束吧.看得见的差距,不想将就,所以还是拿最后一次机会去尝试.win or go home, 所以 ...

  3. Python学习第二篇

    list_num=list(range(1,1000001)) print(min(list_num)) print(max(list_num)) print(sum(list_num)) print ...

  4. Python_列表初识及操作

    列表 列表初识 列表属于容器性数据类型. li = [123, '狗', True, [1, 2, 3], {'name': 'Lon'}, (1, 2, 3)] 其中包含有int型,例如123:字符 ...

  5. shell脚本--编写CGI代码(shell结合html)以及环境变量

    实现shell和html标签混合的方式编写代码: 推荐  初始CGI ,看完大概之后,大概对cgi有个大体的印象.下面是编写混合代码的示例: #!/bin/bash #index.cgi echo & ...

  6. Servlet--HttpServlet实现doGet和doPost请求的原理

    转:https://blog.csdn.net/m0_38039437/article/details/75264012 一.HttpServlet简介 1.HttpServlet是GenericSe ...

  7. 使用Random类生成指定范围的随机数

    目的:要生成在[min,max]之间的随机整数 public class RandomTest { public static void main(String[] args) { ; ; Rando ...

  8. C# Note28: Dispatcher类

    在项目中也是经常用到: 刚见到它时,你会想:为什么不直接使用System.Windows命名空间下的MessageBox类,何必要这么麻烦?(认真分析看它做了什么,具体原因下面解释) 主要介绍的方法: ...

  9. 关于golang.org/x包问题

    关于golang.org/x包问题 由于谷歌被墙,跟谷歌相关的模块无法通过go get来下载,解决方法: git clone https://github.com/golang/net.git $GO ...

  10. k8s授权访问

    #监听本地的8080端口 kubectl  proxy --port=8080 [root@k8s-m ~]# kubectl proxy --port=8080Starting to serve o ...