title: How can i use cloud-init to load a datadisk on an ubuntu VM in azure
body: <p>I have been trying use cloud-init to partition and mount a datadisk on a Ubuntu VM in azure. Most of the online examples show how to do that for the temporary disk but not for data disk. I tried dabbling around with it with out much luck. Please let me know if I am doing something wrong in the below code or if its not possible to do it with cloud-init</p>
  
  <pre><code>#cloud-config
  device_aliases: {'ephemeral0': '/dev/sdb','datadisk': '/dev/sdc1'}
  
  disk_setup:
      ephemeral0:
           table_type: mbr
           layout: True
           overwrite: False
      /dev/sdc1:
           table_type: mbr
           layout: True
           overwrite: False
  
  fs_setup:
      - label: ephemeral0
        filesystem: ext4
        device: ephemeral0.1
        replace_fs: ntfs
      - cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
        label: '/dev/sdc1/'
        filesystem: ext4
        device: '/dev/sdc1/'
        replace_fs: ntfs
  
  mounts:
      - ["ephemeral0.1", "/mnt"]
      - ["/dev/sdc1/", "/datadisk"]
  </code></pre>