Addressing Raw VDMK Images unambigously

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Javex
Posts: 5
Joined: 28. Aug 2014, 00:36

Addressing Raw VDMK Images unambigously

Post by Javex »

Hi,

I am currently running a Windows host system that should start a raw Linux system. I created a RAW disk image to \\.\PhysicalDrive3 or so. However, after a reboot, the drive order has changed. Thus, the VMDK now points to a different drive, namely the exact drive I am booting the host from. However, I want to boot a different drive, that now has a different number.

Is there a way to unambigously identify a drive (by ID/UUID etc.) under Windows? Is it possible to to make this stable in any way?

Regards,
javex
dlharper
Posts: 291
Joined: 25. Aug 2011, 19:17
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows (several versions); DOS

Re: Addressing Raw VDMK Images unambigously

Post by dlharper »

Windows tends to allocate drive letters in the order that it finds them, which varies with each boot-up.

You can allocate drive letters to particular drives using "Disk Management" (from (My )Computer | Manage). This is usally preserved across reboots. Pick a letter near the middle of the alphabet. This prevents Windows having already alocated your chosen letter before it finds this particular drive.

Not sure this is quite what you are after. My apologies if I have misunderstood.
Javex
Posts: 5
Joined: 28. Aug 2014, 00:36

Re: Addressing Raw VDMK Images unambigously

Post by Javex »

You seem to misunderstand me. Let me clarify. I have created a RAW disk according to "Chapter 9: Using a raw host hard disk from a guest". That means a I ran a command similar to:

Code: Select all

VBoxManage internalcommands createrawvmdk -filename C:\path\to\raw.vmdk -rawdisk \\.\PhysicalDrive3
On this drive lies a normal Linux installation that can be booted normally via GRUB (I currently am writing from this system running natively). However, I modified the system in such a way that it can also be booted as a virtual machine. That means I created a virtual machine that has only one drive: This raw.vmdk. In the same manner as with a native boot, GRUB launches, starts Linux and it works inside my VBox the same way it does when booting natively.

However, upon reboot, this \\.\PhysicalDrive3 is now the drive from which I boot the host Windows system. The Linux system is now on \\.\PhysicalDrive1. So what I would have to do is

- Detach the old raw.vmdk
- Remove the old raw.vmdk from VBox and from the filesystem
- Create a new vmdk
- Reattach it to the VM
- Start the VM

I would much rather either have
a) the disks each having a persistent name, i.e. fixing the order in which they are named so it always appears as \\.\PhsyicalDrive3.
b) referring to the disk via a unique identifier, e.g. the UUID or ID (as Linux offers via /dev/disk/by-{uu,}id/.

I would prefer b) but would be happy with either solution as long as it is stable across reboots.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Addressing Raw VDMK Images unambigously

Post by mpack »

I have had many occasions to wish for this feature, but as far as I know, Windows does not provide persistant names for local drives, only network objects have UNC identifiers.

This not not something VirtualBox can control.
AnrDaemon
Posts: 134
Joined: 7. Feb 2010, 23:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu Linux, Windows

Re: Addressing Raw VDMK Images unambigously

Post by AnrDaemon »

Check mountvol.
Use disk UID to mount a filesystem.

They are not literally persistent (only within a given OS installation, as hey are constructed from NTFS ID, which is shorter, than UUID, and some installation-dependent prefix), but should satisfy your needs, hopefully.
Javex
Posts: 5
Joined: 28. Aug 2014, 00:36

Re: Addressing Raw VDMK Images unambigously

Post by Javex »

I checked mountvol but it seems to be concerned with disks that have or should get a drive letter. But Windows won't even understand the physical drive as it contains an ext4 and an LVM parition. It can see the sizes but nothing more. And I want windows to just ignore the drive.

However, I found a way to handle this issue: I literally wrote a script that accomplishes what I described above, i.e. remove old vmdk, create new one and star the VM. Before I executed these steps I find the correct phyiscal drive via its serial which is unique even if two identical drives are installed (which happens to be the case with my drives). The script can be found here

I appreciate all your help but it seems this is a limitation of Windows. The only thing VBox could do would be to be able to refer it by serial or similar (as my script actually does).
Last edited by Javex on 3. Sep 2014, 00:58, edited 1 time in total.
AnrDaemon
Posts: 134
Joined: 7. Feb 2010, 23:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu Linux, Windows

Re: Addressing Raw VDMK Images unambigously

Post by AnrDaemon »

Eh?

Code: Select all

    \\?\Volume{907c2c4d-c109-11dd-a36b-806d6172696f}\
        C:\

    \\?\Volume{04eabee2-1c54-11e4-a3a0-806d6172696f}\
        C:\dev\sdc1\
        C:\d\

    \\?\Volume{4aee6480-972b-11de-b8ca-0015f2ef1bb5}\
        C:\dev\sdd1\

    \\?\Volume{04eabee3-1c54-11e4-a3a0-806d6172696f}\
        R:\

    \\?\Volume{0d41deee-2363-11de-84ee-0015f2ef1bb5}\
        X:\

    \\?\Volume{5056b24e-57b4-11e2-bf74-000479677624}\
        W:\

    \\?\Volume{49f56597-68b9-11e2-bdd6-080027004078}\
        *** НЕТ ТОЧЕК ПОДКЛЮЧЕНИЯ ***

    \\?\Volume{49f56599-68b9-11e2-bdd6-080027004078}\
        *** НЕТ ТОЧЕК ПОДКЛЮЧЕНИЯ ***

    \\?\Volume{49f5659b-68b9-11e2-bdd6-080027004078}\
        *** НЕТ ТОЧЕК ПОДКЛЮЧЕНИЯ ***

    \\?\Volume{49f5659d-68b9-11e2-bdd6-080027004078}\
        *** НЕТ ТОЧЕК ПОДКЛЮЧЕНИЯ ***
Javex
Posts: 5
Joined: 28. Aug 2014, 00:36

Re: Addressing Raw VDMK Images unambigously

Post by Javex »

Yes, I saw that output. But how would I use it with VBox? I tried to address it through the values displayed there but it won't create them for me (tried replacing the "?" with a "." as well). I don't know how to use this ID with the command to create the vmdk. It wouldn't help if I were to resolve from ID to phyiscal drive manually during creation because that would still only reference the drive by its non-persistent number.
AnrDaemon
Posts: 134
Joined: 7. Feb 2010, 23:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu Linux, Windows

Re: Addressing Raw VDMK Images unambigously

Post by AnrDaemon »

It seems like that is not possible, unfortunately. :(
I've already tried it with new VBox install, it doesn't pick separate partitions. Only the disk itself...
Javex
Posts: 5
Joined: 28. Aug 2014, 00:36

Re: Addressing Raw VDMK Images unambigously

Post by Javex »

Yes, it seems that way. I would be a nice feature, but right now, my scripts seems to work perfectly fine for my purpose. Thanks for your help anyway.
AnrDaemon
Posts: 134
Joined: 7. Feb 2010, 23:41
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu Linux, Windows

Re: Addressing Raw VDMK Images unambigously

Post by AnrDaemon »

I should thank you too.
Your question gave me an idea on how to access GPT disk under XP. :)
Post Reply