LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-18-2023, 10:14 PM   #1
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 464

Rep: Reputation: 133Reputation: 133
Mounting a VHD image


Am I wrong? or is it not possible to mount a VHDx image to read/copy its contents in Slackware?
 
Old 11-18-2023, 10:22 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
Not without installing additional software, as VHDX is a proprietary Microsoft (HyperV) disk format not recognised by any of the utilities shipped with Slackware.

libguestfs contains the necessary tools to mount a number of virtual disk formats, including VHDX.
 
3 members found this post helpful.
Old 11-18-2023, 10:31 PM   #3
___
Member
 
Registered: Apr 2023
Posts: 156
Blog Entries: 1

Rep: Reputation: Disabled
https://slackbuilds.org/repository/15.0/system/hivex/
 
Old 11-18-2023, 10:43 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
AFAIK, that SlackBuild only covers the HiveX tool, used to access Windows Registry files.
 
1 members found this post helpful.
Old 11-18-2023, 11:33 PM   #5
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 464

Original Poster
Rep: Reputation: 133Reputation: 133
That explains it :\

Thank you
 
Old 11-19-2023, 05:54 AM   #6
henca
Senior Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 1,016

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
If you have qemu installed you can probably use qemu-img to convert the VHDx image to a raw image which you with some trickery to pass the partition table will be able to mount.

Something like:

Code:
qemu-img convert -f vhdx -O raw old_image.vhdx  new_file.raw
su
losetup -Pf new_file.raw
mount /dev/loop0p1 /mnt/hd
regards Henrik
 
2 members found this post helpful.
Old 11-19-2023, 06:25 AM   #7
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,383

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
If you have qemu installed you can probably use qemu-nbd. I have never had need for VHDx but have used qemu-nbd in the past for qcow2 images.
 
1 members found this post helpful.
Old 11-19-2023, 09:46 AM   #8
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 464

Original Poster
Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by Ser Olmy View Post
libguestfs contains the necessary tools to mount a number of virtual disk formats, including VHDX.
YIKES!, The required package list is massive... Explains why I didn't find a Slackbuild or a package from Alien Bob

Currently I'm able to access the images when I need to by using a Windows VM,
It's just tedious to fire one up for something which should be simple to handle in Linux. Though I do get it.

This isn't something I run across often enough to make going through trying to compile and install libguestfs worth it.


Quote:
If you have qemu installed you can probably use qemu-nbd. I have never had need for VHDx but have used qemu-nbd in the past for qcow2 images.
I don't, I'm using Virtualbox for my VM needs
 
Old 11-19-2023, 10:53 AM   #9
henca
Senior Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 1,016

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
Quote:
Originally Posted by bitfuzzy View Post
I don't, I'm using Virtualbox for my VM needs
Unfortunately Virtualbox is not as feature rich as qemu, its conversion tool VBoxManage is only capable of converting from raw to some formats supported by Virtualbox.

However, even if you have no plans to use qemu for virtualization of x86 and other platforms like arm and sparc, you can still install qemu from slackbuilds.org at https://slackbuilds.org/repository/15.0/system/qemu/ only to use qemu-img to convert your VHDx image to a format readable by Virtualbox as well as the linux kernel loop device functionality.

Qemu from slackbuilds.org has no dependencies.

If you like virtualbox you should not load the kvm kernel module which speeds up x86 emulation in qemu. That kernel module will stop virtualbox from working as it cannot coexist with vboxdrv needed by virtualbox.

regards Henrik
 
1 members found this post helpful.
Old 11-28-2023, 09:06 AM   #10
SpacePlod
Member
 
Registered: Jan 2014
Distribution: Slackware
Posts: 115

Rep: Reputation: Disabled
libvhdi (on SBo) might work for you.

There was a version released just yesterday (libvhdi-alpha-20231127) that indicates added support for VHDx images. I'm the maintainer, and I will try and get an update to SBo before the Friday update cycle if I can get it properly tested by then.
 
1 members found this post helpful.
Old 12-03-2023, 12:50 PM   #11
opty
Member
 
Registered: Mar 2021
Posts: 183

Rep: Reputation: Disabled
I hope libvhdi works with *.avhdx, thanks for mentioning!
 
Old 12-03-2023, 04:12 PM   #12
OutSiderBR
Member
 
Registered: Jan 2015
Location: São Paulo-SP-Brazil
Distribution: Slackware
Posts: 69

Rep: Reputation: Disabled
Quote:
Originally Posted by henca View Post
Unfortunately Virtualbox is not as feature rich as qemu, its conversion tool VBoxManage is only capable of converting from raw to some formats supported by Virtualbox.

However, even if you have no plans to use qemu for virtualization of x86 and other platforms like arm and sparc, you can still install qemu from slackbuilds.org at https://slackbuilds.org/repository/15.0/system/qemu/ only to use qemu-img to convert your VHDx image to a format readable by Virtualbox as well as the linux kernel loop device functionality.

Qemu from slackbuilds.org has no dependencies.

If you like virtualbox you should not load the kvm kernel module which speeds up x86 emulation in qemu. That kernel module will stop virtualbox from working as it cannot coexist with vboxdrv needed by virtualbox.

regards Henrik
henca,
I use VirtualBox at home and qemu at work. My home notebook runs VirtualBox normally and it loads the kvm module on boot. Was that you meant ? Here is a printout:

Code:
dell:~$ lsmod | grep kvm
kvm_intel             344064  0
kvm                  1064960  1 kvm_intel
irqbypass              16384  1 kvm
 
Old 12-05-2023, 08:50 PM   #13
SpacePlod
Member
 
Registered: Jan 2014
Distribution: Slackware
Posts: 115

Rep: Reputation: Disabled
Quote:
Originally Posted by opty View Post
I hope libvhdi works with *.avhdx, thanks for mentioning!
The update for libvhdi is submitted. It passed the basic vhdx (v2) tests, but I don't have access to differencing disk files to test with, so YMMV.
 
1 members found this post helpful.
Old 12-05-2023, 10:40 PM   #14
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,020

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
https://github.com/brandonkal/guestfs ???
 
Old 12-06-2023, 12:40 AM   #15
henca
Senior Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 1,016

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
Quote:
Originally Posted by OutSiderBR View Post
henca,
I use VirtualBox at home and qemu at work. My home notebook runs VirtualBox normally and it loads the kvm module on boot. Was that you meant ?
No, I meant that regardless of plans to use qemu for virtualization it should be possible to use qemu-img to convert the VHD image to a raw format possible to mount as a loopback device.

Your choice of virtualization tool sets the kernel module you load. Those kernel modules are not compatible, you cannot run qemu and virtualbox at the same time on the same host machine. But even if you are running virtualbox you can use the tool qemu-img without any kvm kernel module loaded.

regards Henrik
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting VHD with minix Hosenfeld Linux - Virtualization and Cloud 3 07-26-2012 03:21 PM
partitioning qemu-img; share your wisdom and what you got on vhd? linus72 Linux - General 3 06-14-2009 10:41 AM
Possible to transfer files to/from portable vhd from/to PC? linus72 Linux - Newbie 2 05-26-2009 09:22 PM
Ubuntu freezing at boot on qemulator vhd-how to fix? linus72 Linux - Newbie 0 05-17-2009 08:41 PM
Expanding a VHD's size? Mark_667 Linux - Software 0 12-11-2008 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration