VMware Communities
taylorkh
Contributor
Contributor
Jump to solution

Need help connecting a guest to a physical hard drive on the host

I am running Workstation 12.5.2 on CentOS 7..3. I have a VM of the same OS.  The documentation explains clearly how to configure the guest to access a physical disk on the host. Workstation prompts me that it must be run as root in order to configure the physical disk into the VM. I ran Workstation as root and added the physical disk. I noted that the new .vmdk file containing information related to the physical disk is owned by root. When I powered on the guest (running Workstation as root) I, the humble user, could login to the VM and see the physical file system with gnome-disks. Using root privileges on the guest I could mount the physical disk. While this was encouraging I could not power on the guest when I ran Workstation with my non-root account. I changed ownership of the .vmdk file back to my user but that did not help. 

Reading over the documentation again I noted that the account running Workstation must have ownership privileges of the physical disk on the host. This is granted to group disk. I added my user to this group and tried again (fresh copy of the guest). I was again prompted that Workstation had to be run as root to configure the physical disk which I was attempting to add.  I went back as root and added the disk. I changed ownership of the .vmdk back to my user  and tried again. Workstation crashes (simply goes away) when attempting to power on the guest when run my my non-root user. I ran Workstation again, as me, and then looked at the guest properties I found under the Hardware tab an entry regarding the physical disk. When I clicked on this item I received a message:

"Unable to reteive disk information:Insufficient permission to access file"

What file could this be?  I have ownership of all files within the guest. The file listed above the message is the .vmdk file which I took ownership of away from root. Very frustrating. Can anyone offer any advice?

TIA,

Ken

Reply
0 Kudos
1 Solution

Accepted Solutions
continuum
Immortal
Immortal
Jump to solution

My theory is the disklayout you use:

createType="partitionedDevice"

# Extent description

RW 63 FLAT "vmCentOS7Mate-0-pt.vmdk" 0

RDONLY 1985 FLAT "/dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116" 63

RW 234375000 ZERO

RW 168 ZERO

RW 3906250 FLAT "/dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116" 234377216

RW 7879206 ZERO

I assume your host tries to use /dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116 for his own purposes.r
Good old Windows 2003 was the last host os that I could use with partitionedDevice rawdisks.
As far as I know every guestOS newer than that requires root-right for partitionedDevice and only lets FullDevice be used by normal users.
By the way - I wonder why you go through this extra-issues for a VMDK thats as small as 8Gb ?
The performancegain you hope for does in no way justify the extra work IMHO


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

View solution in original post

Reply
0 Kudos
9 Replies
continuum
Immortal
Immortal
Jump to solution

Can you please provide additional info ?
- vmdk-file
-vmware.log
- sgdisk -p <device you want to use> -sgdisk.txt
- mount > mounted-devices.txt

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
taylorkh
Contributor
Contributor
Jump to solution

Thanks Ulli.

I will do so shortly.  I believe it would be beneficial for me to connect a fresh copy of the guest and grab the most recent vmdk-file and log. No telling what damage I may have done messing with it.  Please bear with me.

Ken

Reply
0 Kudos
taylorkh
Contributor
Contributor
Jump to solution

I started with the fresh copy of the guest. I ran Workstation as player, opened the guest and added the physical disk. This being the small 2 GB partition on /dev/sda. I then powered on the guest, logged into the guest as my user account, shut down the guest and closed player. I changed ownership of the log and vmdk files so I could grab them and upload.

Reply
0 Kudos
taylorkh
Contributor
Contributor
Jump to solution

That should be I ran Workstation as root. :smileyblush:

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

Based on your input so far I do not expect any damage so far.
Since WS 9 or 10 the behaviour that you see so far seems to be almost normal:
Often WS seems to start without problems - then after a while (usually inide first 5 minutes WSseems to remember something that was considered to be too dangerous for a non-root  user.
With the latest versions I rather assume that you MUST use a root-account to be able to use the rawdisk feature.
But lets see the details I asked for next

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
taylorkh
Contributor
Contributor
Jump to solution

Thanks again Ulli,

This is a home project on a test machine. Nothing to damage. Sorry I have not been on top of this thread. I did not have my email preferences set properly in the forum and did not receive notification of your reply. I THINK that is fixed now.

I wonder about the advisability of running WS as root? I would be running the guest as ME not root so it could not do too much mischief. With the WS processed running as root could anything from the guest work its way back through WS to the host with root privileges? IN quiring minds wonder...

The aim of this experiment is to run the guest from an encrypted partition and have it access another encrypted partition for its data.  The data would thus not be accessible directly on the host and any "leakage" from programs running on the guest would, I think, be written to the encrypted partition where the guest files reside.  At least that is the plan.  I have accomplished this scheme by having the guest connect to an encrypted FILE on the host via nfs and have the guest decrypt the data.  I was thinking that performance would be better if the guest accessed the disk directly without having nfs overhead in the middle.

Ken

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

My theory is the disklayout you use:

createType="partitionedDevice"

# Extent description

RW 63 FLAT "vmCentOS7Mate-0-pt.vmdk" 0

RDONLY 1985 FLAT "/dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116" 63

RW 234375000 ZERO

RW 168 ZERO

RW 3906250 FLAT "/dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116" 234377216

RW 7879206 ZERO

I assume your host tries to use /dev/disk/by-id/ata-SanDisk_SDSSDP128G_142360402116 for his own purposes.r
Good old Windows 2003 was the last host os that I could use with partitionedDevice rawdisks.
As far as I know every guestOS newer than that requires root-right for partitionedDevice and only lets FullDevice be used by normal users.
By the way - I wonder why you go through this extra-issues for a VMDK thats as small as 8Gb ?
The performancegain you hope for does in no way justify the extra work IMHO


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
taylorkh
Contributor
Contributor
Jump to solution

Good morning Ulli.

You have earned five stars!  That was the issue exactly. The test PC boots from /dev/sdb so  I removed /dev/sda from /etc/fstab on the host, rebooted, and was able to add the test partition /dev/sda2 to a guest as ME and run it from WS as ME. No root required.  I then added /dev/sda back to fstab and remounted. When I attempted to start the guest I received this error message:

The partition table on the physical disk has changed since the disk was created. Remove the physical disk from the virtual machine, then add it again

Cannot open the disk '/run/media/ken/seagate1/vmCentOS7Mate/vmCentOS7Mate-0.vmdk' or one of the snapshot disks it depends on.

Module 'Disk' power on failed.

Failed to start the virtual machine.

Bottom line it looks like I would need to dedicate a physical drive for use by the guest.  I can do that.

As far as the trouble and small size etc... I had been experimenting with shared folders - without success so far - and I came across the documentation about connecting a physical hard drive. So I decided to try it to see what I could learn.  The situation which caused me to try the experiment with the encrypted guest and encrypted data file system dates back 30 years to a real world situation involving an out of date procedure referencing an even more out dated government publication and an electrician - pulling cables for our Banyan Vines network - falling through the ceiling into the classified documents "vault" room. That experience sharpened my insight into privacy. When I find a new technology/feature I poke and prod it and see what it can do for me in terms of keeping confidential information confidential.


Again let me offer my sincere thanks for your assistance.

Ken

Reply
0 Kudos
Calbertobr
Contributor
Contributor
Jump to solution

Another option is to create a partition and give permission to the user who uses Vmware Workstation.
And I do this to avoid using root.

Reply
0 Kudos