Hi all,
I attach a physical disk to a virtual machine using /dev/sdx in the VBoxManage internalcommands createrawvmdk command.
It works fine but depending of the number of disks connected to the bar metal machine device name changes.
Is there a way to use not /dev/sdx but UUID of the physical disk to avoid this problem ?
Thanks for your help.
VBoxManage internalcommands createrawvmdk using UUID
-
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: VBoxManage internalcommands createrawvmdk using UUID
Physical disks don't have virtual disk UUIDs. The UUID in question is a field in the virtual disk header, which of course is lacking in a raw image. Some filesystems may store UUIDs on the disk for other purposes, but those purposes are nothing to do with any VM platform.
It's possible to assign any UUID you like to a VDI, there's an internalcommand for that (VBoxManage internalcommands sethduuid <file> <uuid>). You'd have to take care: different tools have different byte order conventions (presentation and storage) for UUIDs.
It's possible to assign any UUID you like to a VDI, there's an internalcommand for that (VBoxManage internalcommands sethduuid <file> <uuid>). You'd have to take care: different tools have different byte order conventions (presentation and storage) for UUIDs.
-
fth0
- Volunteer
- Posts: 5690
- Joined: 14. Feb 2019, 03:06
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Linux, Windows 10, ...
- Location: Germany
Re: VBoxManage internalcommands createrawvmdk using UUID
I haven't tried it myself inside VirtualBox, but I'd suggest to try the symbolic links in the /dev/disk/by-* hierarchy. At least they were invented exactly to solve the Linux device enumeration and naming problem that you're experiencing.didierg wrote:Is there a way to use not /dev/sdx but UUID of the physical disk to avoid this problem ?
Please report back if it works or not.
-
didierg
- Posts: 34
- Joined: 1. Apr 2008, 02:12
- Primary OS: Fedora other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Fedora & Windows
Re: VBoxManage internalcommands createrawvmdk using UUID
@ fth0fth0 wrote:I haven't tried it myself inside VirtualBox, but I'd suggest to try the symbolic links in the /dev/disk/by-* hierarchy. At least they were invented exactly to solve the Linux device enumeration and naming problem that you're experiencing. )
I edited the vmdk file and I modified the line to specify the disk by UUID and it works !
The line in vmdk now looks like that:
Code: Select all
# Extent description
# RW 488397168 FLAT "/dev/sdd" 0
RW 488397168 FLAT "/dev/disk/by-id/ata-Samsung_SSD_840_EVO_250GB_S1DBNSAF123456F" 0