Tuesday, May 17, 2016

Ubuntu on VirtualBox - Mount a vdi drive on startup

Hi, I had Ubuntu 14.04 running on VirtualBox and needed more storage. A solution was an old vdi with enough space available, but... only available after login.

The drive was mounted using:

gvfs-mount -d /dev/sdb3

that's the command line equivalent of clicking on drive icon to mount it, after login.
 I needed the drive already mounted at login time.

Fstab didn't work because virtualbox is loaded after it.

Solution:

1 - Discover the device of your drive (sdb3 in my case):
     sudo fdisk -l

2 - Make a folder to mount your drive:
     mkdir /media/adminuser/mydrive

2 - Edit rc.local
     sudo -H gedit /etc/rc.local

3 - Add a line before exit 0
    mount -t ext4 /dev/sdb3 /media/adminuser/mydrive

4 - Save and reboot.

Good luck!
PS: More info here

No comments:

Post a Comment