Page 1 of 1

Error accessing NTFS partions in windows guest

Posted: 3. Jan 2017, 12:46
by Andy45
I've a laptop running Linux (Ubuntu 16.04) and Virtualbox v5.1 installed on it. As a guest I have installed Windows 10 into a native partition on that laptop. This is working well.
I cloned the hard drive with CloneZilla to a hard drive connected via USB. This was no problem. All went well and I was able to access any of the partitions with Linux, even the two NTFS partitions.
I then plugged the external drive into another machine running also Linux (Debian) with Virtualbox installed on it (version 5.1). I configured the access to the NTFS partitions exactly the way it was on the original laptop and tried to boot windows with Virtualbox. The Grub2 boot loader started just the same as it does on the original machine and I selected Windows. But all I got was a blank black screen. After twiggling around with the configuration I was able to start the boot partition and windows tried to start. It stopped with an error and gave me the option to repair the disk. But this does not work, because the second partition with the system itself is treated as a raw partition under windows and is not accessible. All I can do is format that partition, what I don't want.
If I try to mount the NTFS partition with Linux (the host), everything works and I can read the contents of the disk.

I've also an older Win7 installation on the same machine. When I start it over Virtualbox and try to access the external USB drive, the 2 NTFS partitions are marked as RAW. But the Linux partition on the same drive works (with ext2fsd).

I need to start the Win10 on the external hard drive to get access to some special software installed on it. How can I do that? What should I check or try?

A.T.

Re: Error accessing NTFS partions in windows guest

Posted: 4. Jan 2017, 10:36
by Andy45
UPDATE:
It seems that the USB driver of VirtualBox has some problems when it have access to a whole hard disk connected via USB. It sees the partitions, but when I try to read from them, I get errors or the partition appears as if there's no valid file system on it. Accessing a Linux partition with ext4 file system works but gives me a lot of "inode errors"! Accessing a NTFS formatted partition doesn't work at all.

One possibility to overcome this is to make a raw copy of a partition like:

Code: Select all

dd if=/dev/sdd3 ibs=4M | VBoxManage convertfromraw stdin lhc_system.vdi 2179846897664 --format VDI
I did it with "dd" because I can define a buffer what makes reading the disk a lot faster.
Than I'm able to access the resulting VDI file without a problem. But there's still a big problem. The VDI file is about 2Tb large. This is the total free capacity of a disk of mine. Cloning all of the 6 partitions into one huge file would exceed the free capacity of my drive.
So I made 2 VDI files. The small one contains the boot partition and the second contains the system. Is there a way to make one VDI file out of these 2? If yes, how?
Or is there a special way to access the hard drive so, that all data is passed through?
Is there a bug in the USB drivers of Vitualbox? Or have I misunderstood something and what I try is not possible with USB? BTW: I can't connect the external hard drive to a SATA port on the motherboard because I have no more free SATA ports and I don't want to dismantle the external hard drive. But I assume that this could be a possible solution.

A.T.

Re: Error accessing NTFS partions in windows guest

Posted: 4. Jan 2017, 11:52
by omf
mmmh, are you sure, that your ubuntu does not mount the drives itself? that would also lead to fs-errors and as I remember ubuntu mounts all pnp-disks per default...

the other thing is, why are you accessing the drive via USB-Inclusion in virtualbox? do you need access to the MBR of the USB-drive?

I think, it would be easier/more transparent, if you define each partition of the USB-drive as raw-format-image, vbox accesses them via standard linux-paths in /dev/sdXN and there's no mapping at all, which might crash.

Re: Error accessing NTFS partions in windows guest

Posted: 5. Jan 2017, 12:11
by Andy45
mmmh, are you sure, that your ubuntu does not mount the drives itself? that would also lead to fs-errors and as I remember ubuntu mounts all pnp-disks per default...
Yes, I'm sure that the drive is not mounted by host OS. As I wrote, the host OS is able to read the filesystems on the disk without any problem. But I made sure that none of the partitions is mounted at the time I start the virtual machine (Virtualbox).
the other thing is, why are you accessing the drive via USB-Inclusion in virtualbox? do you need access to the MBR of the USB-drive?

I think, it would be easier/more transparent, if you define each partition of the USB-drive as raw-format-image, vbox accesses them via standard linux-paths in /dev/sdXN and there's no mapping at all, which might crash.
I'm not sure what you mean with "define each partition of the USB-drive as raw-format-image".
I've tried several things. One of my first try was to only give access to the 2 NTFS partitions. I created a VMDK file with the following commands:

Code: Select all

sudo install-mbr --force -d 131 -e 123 -o 0 WIN10.mbr
VBoxManage internalcommands createrawvmdk -filename Windblows10.vmdk -rawdisk /dev/sdd -partitions 1,2,3 -relative -mbr ./WIN10.mbr
After that it started to boot but told me about errors on the disk and crashed. I've also a Linux distribution running with Virtualbox and tried to access the NTFS partitions from this Linux. But it can't detect any file system on the disk.
I tried with different controllers like SATA, IDE, USB. Nothing worked. While SATA and IDE tried to read, USB even can't find a disk.
This was the second try:

Code: Select all

VBoxManage internalcommands createrawvmdk -filename Windows10.vmdk -rawdisk /dev/sdd
When I try to boot with that, the grub2 bootloader starts and I can select to start Windows or Ubuntu on the disk. Starting Windows ends with a black screen. Starting Ubuntu works, but give me a lot of inode errors. After I stopped Ubuntu I started fsck on the host to repair the file system. Although I forced it to check the disk, it couldn't find any errors.

What else can I try?

A.T.