Centos/ubuntu methods for mounting VMDK, VDI as block devices (non-vdfuse)

Source: Internet
Author: User

Because Vdfuse only support virtualbox4.x, is now in the new version of Ubuntu or CentOS canceled, change the idea, you can use the QEMU+NBD method to mount Vmdk,vdi,vhd,vhdx and other formats of the disk.

The following methods are implemented on CENTOS7.

1, compile the kernel, compile NBD as module.

Yum Groupinstall "Developmenttools" yum install gcc ncurses ncurses-devel bcyum updatewget https://www.kernel.org/pub/ LINUX/KERNEL/V4.X/LINUX-4.0.TAR.XZTAR-XF linux-4.0.tar.xz-c/usr/src/cd/usr/src/linux-4.0/make Menuconfig

On the configuration screen, go to the menu

Device Drivers→block Devices

Selected:

<M> Network block device support

Save, Exit:

< SAve >


< Exit >

Roughly like:

. config-linux/x86 4.0.0 Kernel Configuration

→device Drivers→block devices─────────────────────────────────────────────

┌───────────────────────────── Block devices ─────────────────────────────

Arrow keys navigate the menu. <Enter> selects submenus---> (or empty│

submenus----).  Highlighted letters is hotkeys. Pressing <y>│

includes, <N> excludes, <M> modularizes features. Press <Esc><Esc> to│

  │   Exit, <?> for help, </> for search.  Legend: [*] built-in  []       &NB Sp │  

  │ ┌──── ↑ (-) ─────────────────────────────────────────────────────────────  

  │ │    [*]     C ompressed RAM block device debug Support                  

  │ │    < >   C Ompaq Smart Array 5xxx support                              

  │ │    < >   My L ex dac960/dac1100 PCI RAID Controller support            

  │ │     < >   M I Cro Memory MM5415 Battery backed RAM support              

  │ │     <M>   L Oopback Device Support                                 &NBS P    

  │ │     (0)     N u mber of loop devices to Pre-create at init time          

  │ │     < >     C Ryptoloop Support                                 &NB Sp      

  │ │     < >   D RBD Distributed replicated Block Device support            

  │ │     <M>   N e twork block device Support                           and nbsp    

  │ │     <M>   N V M Express block device                                 &NB Sp │  

  ──── ↓ (+) ─────────────────────────────────────────────────────────────┘  

├─────────────────────────────────────────────────────────────────────────

          <Select>< E xit > < H elp > < S Ave > < L oad >         │  

─────────────────────────────────────────────────────────────────────────┘

                                                                               



To compile the kernel again:

Makemake Modules_install Install

Upon completion, reboot

2, modify the configuration:

Set the new kernel to start automatically:

Grub2-set-default 0

To set the NBD module to load automatically:

Build file:/etc/sysconfig/modules/nbd.modules

Content:

Modprobe NBD max_part=16

Reboot.

3. Installation configuration qemu-img and QEMU-NBD

Yum Install qemu-img

4. Create a file and mount it:

Qemu-img create-f VPC test.vhd 10G//Create a dynamic mode 10G VHD format file qemu-img create-f vmdk test.vmdk 10G//Create a dynamic mode 10G vmdk format file Qem U-nbd-c/dev/nbd0 TEST.VMDK//Attach TEST.VMDK to/dev/nbd0 device files


This article is from the "Zhang Yu (Data Recovery)" blog, please be sure to keep this source http://zhangyu.blog.51cto.com/197148/1862716

Centos/ubuntu methods for mounting VMDK, VDI as block devices (non-vdfuse)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.