How do I mount vhd disk to Ubuntu (Hyper-V)?

11,599

At first you tell Hyper-V to use the VHD as a Harddrive for the Ububtu.

Second you thell ubuntu to mount the disk to a directory. (in general this is done by ubuntu at boot time via automount more about this by googling fstab or automount).

If it is not done automatically you could mount it yourself with:

mkdir -p /mnt/<diskname>
chmod 755 /mnt/<diskname>

mount /dev/sdX /mnt/<diskname>

X is the corresponding letter a,b,c,d... for the disk you will mount a is the first/system disk so if you have no sticks etc. mounted, b is what you need).

Share:
11,599

Related videos on Youtube

AmShegar
Author by

AmShegar

Updated on September 18, 2022

Comments

  • AmShegar
    AmShegar almost 2 years

    I use windows server 2008r2 with role Hyper-V. The guest system is Ubuntu 12.04 LTC. It is situated on the dynamic virtual hard disk VHD1.

    I add another VHD2 disk as SCSI. Now I want to mount this disk to Ubuntu. How can I do this?

    I'm novice. My problem is that I do not know where new VHD situated. I add this VHD2 disk in hyper-v manager, but I cannot find it in Ubuntu

    I can not find this VHD2 in media

    Image1

    Image 2

    Is /dev/sdb my VHD2?

    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 10 years
      The same way you would mount any other drive in Ubuntu, virtual or not. What happened when you tried?
  • AmShegar
    AmShegar over 10 years
    eh..., I do this: 1) sudo fdisk -l (i find /dev/sdb) 2) sudo mount /dev/sdb /mnt/database (here i have error about file system) 3) sudo mkfs -t ext4 /dev/sdb (I have warning: /dev/sdb is entire device, not just one partition! Proceed anyway? (y,n) - My problem is that I do not know that /dev/sdb is my VHD2)
  • konqui
    konqui over 10 years
    if you do mkfs you will override what is on your disk. is this second vhd a new created one or is this a image with data on it? if there is data ther will also be a partition table so maybe mount /dev/sdb1/mnt/database will work.
  • konqui
    konqui over 10 years
    i would try this: 1. shutdown, 2. in hyper-v unconnect the image, 3. start linux and look what is there sda etc. 4. shutdown again 5. readd image in hyper-v 6. lokk again the new sdX entry is your disk.