January 4

Mount a VirtualBox drive image as disk (mount to folder) in 3 ways

1.
yum install ntfs-3g ntfsprogs
VBoxManage clonehd --format RAW ubuntu.vdi ubuntu.img

To determine the correct offset you can run:
# fdisk -l image.img

Disk choban.img: 157.3 GB, 157286400000 bytes, 307200000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3a3a2d46

Устр-во Загр Начало Конец Блоки Id Система
ubuntu.img1 * 63 39037949 19518943+ 7 HPFS/NTFS/exFAT
ubuntu.img2 39037950 307199999 134081025 5 Extended
ubuntu.img5 39038013 307194929 134078458+ 7 HPFS/NTFS/exFAT

For example if start is 128 and sector size is 512 then the offset is 65536. (128*512=65536)
mount -o loop,offset=32256 ubuntu.img /mnt/image/

2.
apt-get install virtualbox-fuse
vdfuse -a -f /path-to-vdi-file /mnt
mount -o loop /mnt/Parition1 /mountpoint

3.
apt-get install qemu
rmmod nbd
modprobe nbd max_part=16
qemu-nbd -c /dev/nbd0 drive.vdi
mount /dev/nbd0p1 /mnt
qemu-nbd -d /dev/nbd0


Copyright 2021. All rights reserved.

Posted 4 January 2017 by admin in category "simple memo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.