VirtualBox Windows Host, Linux Guest, how to mount a raw partition?

0

1

I have a Linux VM running in VirtualBox on Windows. It is running fine, it is running from a raw partition of a SSD for some time now.

Today I connected a small HDD to the machine, via a SATA port. This HDD has one partition on it. It is an ext3 partition which contains some backup data from another Linux machine (bare metal). I now want to continue using this HDD on this Linux guest as a backup drive, still having access to the old backup data from the other machine (I'm migrating a system from bare metal to a VM)

I followed the steps listed in Use physical harddisk in Virtual Box

To be precise, I used the following command to create the virtual image: VBoxManage internalcommands createrawvmdk -filename "C:\Users\Main\VirtualBox VMs\Disks\hdd-ps4-p1.vmdk" -rawdisk \\.PhysicalDrive3 -partitions 1 -relative

I also tried without the -relative flag, it gives me the same result, with the difference that the size of the disk in the VirtualBox UI differs (full hdd size vs partition only size)

Now, the thing is that when I add it to the VM and boot the VM, and do an ls -lsa \dev\, I get an entry named sdb. When I start the vm without that image added, that sdb is not there, so I assume that his is the added image.

I was actually expecting to see a sdb1 which I could then sudo mount /dev/sdb1 /media/hdd/

Does anyone know what is going on?

I tried sudo sudo mount /dev/sdb /media/hdd/, but this gives me a mount: wrong fs type, bad option, bad superblock on /dev/sdb -- I also wasn't hoping for this to function.

--- Update ---

I've tried again, this time without specifying a partition during the creation of the image. This works. There I have an sdb and sdb1 as expected, and am able to mount sdb1 and access the old files on it.

But is there a way to create an image just with this one partition? I want to use the remainder of the HDD (about 30%) for other stuff. My VM boots from partition 1 of a SSD, and the second partition is actually an NTFS partition accessible to the Windows Host, so it must be possible to do the same with the HDD, I assume.

Daniel F

Posted 2017-04-05T11:47:13.053

Reputation: 751

No answers