VirtualBox VMDK Physical Drive Incorrect Partition Size

0

So I've setup VirtualBox to work just fine.

I am running Kali Linux within my VM and it can live boot properly. I created a VMDK file that pointed towards the physical drive (a USB) that I wanted to be the main drive for the VM.

What I was trying to do was to get a full install of Linux on the drive by using it as the physical drive for the VM, then do a Graphical Install onto it rather than just using UUI so that I had a Kali live boot USB.

Within the Graphical Install, I get all the way towards the end for partitioning the drive and it's showing my physical drive as 136.5 GB instead of it's actual 128 GB. I'm not understanding how it's showing that I have more space than I actually do (I've checked the partitions and it's a single partition so there's no extra space anywhere.)

I'd rather do a full install on the drive rather than a persistent live because 1) I couldn't get the persistence to work even after setting everything up correctly, and 2) because I'd rather have it save installed files and act like an entire OS than just persistent data.

My guess is that it's an issue with the VMDK or how VirtualBox is actually seeing my physical drive (USB).

At the end of the Graphical Install, I get the following error: BLKCACHE_IOERROR with the details saying this:

The I/O cache encountered an error while updating data in medium "ahci-0-0" (rc=VERR_ACCESS_DENIED). Make sure there is enough free space on the disk and that the disk is working properly. Operation can be resumed afterwards.

This tells me that it's an issue with the how the VM sees the external USB physical drive. With the VERR_ACCESS_DENIED it makes me think that my USB doesn't have the proper read/write permissions.

So basically what I'm asking is if anyone has had this issue and knows a fix for it. Or possibly if someone may know of another way for me to get a full Kali install on an external USB drive without using a VirtualBox VM (I figured this was the easiest way.)

For the record: Windows 10 Host (64-bit) Kali Linux Guest (issue with both 64 and 32)

If there's anymore information you may need, please let me know.

EDIT: I forgot to mention, that I also tried doing this off an Ubuntu Xenial host (a seperate USB live boot) and got the same issue where the drive showed up as 136.5 GB in the Graphical Install within VirtualBox.

Eric Oleen

Posted 2016-08-09T20:28:07.853

Reputation: 1

Ok, you say it's not the host or guest OS. Can you just for testing purposes 1) switch to another external drive and 2) Use VHD container format instead of VMDK? – nixda – 2016-08-09T21:23:18.657

@nixda #2 is not possible since I had to do the ` VBoxManage internalcommands createrawvmdk -filename "\path\to\file.vmdk" -rawdisk \.\PhysicalDrive2. I'll test #1 real quick. – Eric Oleen – 2016-08-09T21:52:05.663

@nixda I just tried using another external drive (8 GB) and within the same VM (since it has the .vmdk to that USB drive plug location) it still showed 136.5 GB. However, the difference is that in the settings of the VM it now shows Virtual Size: 127.17 GB and Actual Size: 7.21 GB. So VirtualBox is seeing the right sizes, but the Graphical Install is not. – Eric Oleen – 2016-08-09T21:58:00.897

136,5 GB == 127,1 GiB – nixda – 2016-08-09T22:33:05.390

@nixda The drive is 127 GB though, not GiB. Then how might it matter as to the failed installation? Right now I used Disk2vdh to put the drive to a VHD file, and VirtualBox showed Virtual Size: 127 GB and Actual Size: 150 MB. It also seems to have gone further in the installation but is hung up right now so I'm hoping I just have to wait. (Hung at "Storing language...") So by this conclusion, would you figure it's an issue with the drive? Any idea how i might be able to properly debug and fix this? I'll try VHD with the other drive I have. – Eric Oleen – 2016-08-09T22:50:48.713

@nixda Okay so apparently although I had the USB drive as the one setup, it was trying to install to my physical C:// drive instead of the F:// that the external USB was plugged into. Looks like I have to actually use the VMDK for it to actually access the USB. – Eric Oleen – 2016-08-09T23:14:25.313

Answers

0

The reason its most likely reporting different size, is that Linux generally uses the EXT filesystem and I am going to assume your USB Drive is formatted as NTFS. Also could be you don't have write-caching enabled or maybe some other thing.

First things first, in your host go to where you can see all your drives, right click your USB one, then click properties. Go to hardware tab, select the USB drive, the click properties in the bottom right corner. On the next window, select change settings, and change the setting to better performance instead of quick removal. This will enable write caching which is something it needs as your error pertains to I/O cache of the drive. Due note, that enabling this setting means you can't just unplug your USB Drive from the host, you will have to right click the icon in the task tray and eject it first to safely remove it without possible data loss.

Second, in your VM's setting for the guest, go to your storage, click on the controller and on the right hand side, tell it to use Host I/O cache.

Thirdly, you didn't have to do a vmdk, virtualbox has the ability to mount usb drives from the host, into the guest. You need to have the extensions installed and you can even additionally setup a usb filter to explicitly add the usb device to your guest or have it detect it anyhow and make sure in the USB filters area in the settings of the VM guest, that you select the appropriate usb version that your usb drive uses and the port its connected to. If both the device and the usb port can handle USB 3.0 devices, select usb 3.0 in the usb filters area.

here is guide for the third part USB Device in Guest

the fourth thing you are going to want to do, is format the drive that Kali linux needs it to be first, then attempt to install kali linux to it. And because the device should natively be detected it should be able to install a live version of the OS instead.

Hopefully this resolves your problem you are having. Do let us know if you try this and it still does not work as it could be a bug within virtualbox or maybe something else.

Frostalf

Posted 2016-08-09T20:28:07.853

Reputation: 429

#4 shouldn't be an issue since the drive will get auto-formatted when trying to install. #2 was already done. I think we may have found the issue is with my drive. With option #1, I go to the location to switch from quick removal to better performance. After selecting better performance, the USB has a "write-caching policy" that gets enabled. It has the option of "Enable write caching on the device". After clicking okay: `Windows could not change the write-caching setting for the device. Your device might not support this feature or changing the setting." Time to go google an answer @Frostalf – Eric Oleen – 2016-08-10T02:22:59.547

The drive is formatted to NTFS so I will try changing it to FAT32 to see if that will fix the write-caching issue. @Frostalf EDIT: FAT32 did not help... – Eric Oleen – 2016-08-10T02:26:40.283

After reading about write-caching, I realize why it would be needed in order to get a full install properly on a USB drive but I am unable to do this. Is there a way to bypass this "error" and force write-caching onto it? – Eric Oleen – 2016-08-10T02:31:55.233

you need to ensure the box is selected to enable the write caching below too. Unless its already checked and its giving you problems. With the formatting, I was saying you could try formatting the drive in the guest to the EXT Filesystem to see if it resolves your issue of incorrect drive size reported. As for on windows, regardless of the filesytem in place on the drive, it would not affect the hardware settings. – Frostalf – 2016-08-10T02:35:46.017

Yea, I'm checking the box to enable write caching and it's giving me that issue. I sent an email off to PNY support in hopes that they may have the answer to properly enable write caching on the device. – Eric Oleen – 2016-08-10T02:51:26.773

for a USB Hard Drive, it is a bit odd that it doesn't have write-caching capabilities and I haven't in my experience have come across a USB HDD that doesn't support this. You could try going through the rest of the steps without enabling this option to see if it works. I haven't had your problem specifically and my USB drive works in my guest OS's which range from windows, to linux, to Mac. But I generally keep my USB drives on the optimize performance setting as I rarely unplug them from my computer. – Frostalf – 2016-08-10T02:58:32.140