Linux – How to auto mount 2nd drive on boot in Windows Azure on linux

automountazureblock-devicelinuxubuntu-12.04

I'm currently programming a website and it's connecting to Ubuntu 12.04 linux VM on Windows Azure for database connections. The issue I'm having is that if the VM is restarted the attached disk I added for the db data files does not auto mount after the boot. I've added an entry in /etc/fstab (entry below) without any luck.

  1. What do I need to do to get this second drive (sdc1) to auto mount on boot in Azure?
  2. Does the auto mount happen BEFORE postgresql service starts? If not mounted before Postgresql, what do I need to do to have postgres start after its mounted?
  3. I'm also having to set sudo blockdev --setra 2048 /dev/sdc1 after the reboot as well. How do I get that setting persisted after reboot on the attached drive?
UUID=123456-456-546498-56464987-54654    /mnt/db_data    ext4    defaults,discard    0   0

Note: That isn't the UUID I'm using. I made it up just in case for security reasons.

Best Answer

  1. The following simple line works for me on ubuntu LTS 12.4:

    UUID="3c378300-120e-418c-a288-7aa623b26e66" /mnt-test auto defaults

    Also using ext4. It is auto mounted without any problems, are you getting any error message in syslog why your drive is not mounted

  2. Yes, the fstab (mount) script is one of first ones, you can check for yourself in the rc.d folders, see the UpStart docs

  3. You should use udev for that, there you can create these kind of settings per device.