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-0010-

    题目: 判断101-200之间有多少素数,并输出所有素数. 程序分析: 判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除则表明次数不是素数,反之是素数.用else 可以进一步简化代 ...

  2. Python Revisited Day 02 (数据类型)

    目录 Python 关键字 整数 整数转换函数 整数位逻辑操作符 浮点类型 math模块函数与常量 复数 精确的十进制数字 decimal 字符串 str.format() 格式规约 Python 关 ...

  3. LZO

    LZO 是致力于解压速度的一种数据压缩算法,LZO 是 Lempel-Ziv-Oberhumer 的缩写.这个算法是无损算法,参考实现程序是线程安全的. 实现它的一个自由软件工具是lzop.最初的库是 ...

  4. JavaScript实现文字跑马灯

    其实实现文字的跑马灯和实现图片轮播的原理是一样的. 下面是我自己实现的,文字的位置可以随便更改,效果不会变,文字的内容可以通过ajax获取,同时,可以直接用Jquery改写一下,很方便. <!D ...

  5. 【学习总结】Git学习-参考廖雪峰老师教程八-使用GitHub

    学习总结之Git学习-总 目录: 一.Git简介 二.安装Git 三.创建版本库 四.时光机穿梭 五.远程仓库 六.分支管理 七.标签管理 八.使用GitHub 九.使用码云 十.自定义Git 期末总 ...

  6. 为github添加ssh key

    用git关联github上的远程仓库前需要先为github添加ssh key 一.检查本机是否生成ssh key 本地查找.ssh文件,其中id_rsa.pub中的内容就是ssh key 二.为git ...

  7. python3 九九乘法表打印花式操作(然并卵)

    # 九九乘法表# 方法一# for i in range(1, 10):# for j in range(1, i+1):# print('{}x{}={}\t'.format(i, j, i*j), ...

  8. Linux 查找文件命令 find whereis locate

    Linux 有三个查找文件的命令:find, whereis, locate 其中find 不常用,whereis与locate经常使用,因为find命令速度较慢,因为whereis与locate是利 ...

  9. 将表单数据转换为json代码分享

    <body> <form action="#" method="post" id="form1"> <inpu ...

  10. java语句中的重定向函数

    重定向后面就不能转发了,所以return null