Mount (Automount) VHD partition in Ubuntu host

Most of the time you need to add hard disk space to you virtual machine without effecting Primary hard disk. Below procedure can be used to add another virtual hard disk to Ubuntu hosted inside Hyper-V.

1. Add new hard disk from VM settings.
1
2. Start virtual machine and start terminal or connect through terminal client

3. Create folder where you want to mount your new disk. E.g. /mnt/extradisk

sudo mkdir /mnt/extradisk
sudo chmod 755 /mnt/extradisk

4. Run following command to check disk devices. Lets say it shows /dev/sdb as new device

sudo fdisk -l

5. Try mounting in manually first

sudo mount /dev/sdb /mnt/extradisk

6. If you get error of file system then run following command and mount again.

sudo mkfs -t ext4 /dev/sdb

7. To automount with default options add below line in /etc/fstab file

/dev/sdb        /mnt/extradisk  ext4    defaults        0       0

Leave a Reply

Your email address will not be published.