Community

How to add and mount a second volume to a server using the terraform provider

Hi, I know, how to add a volume to my data-center (and to my server) using terraform. How can I mount this volume using a script? Where do I know the device/uuid from? Many thanks, Uli

 
  • **bold**
  • _italics_
  • `code`
  • ```code block```
  • # Heading 1
  • ## Heading 2
  • > Quote
 

Hello Uli,

If I'm understanding the question correctly, you want to know the device that an attached volume will be assigned when you connect it to a server?

Based on the output of lsblk and running a few tests, it seems that additional volumes are assigned as /dev/vdX. So a server with a single boot volume looks like this:

lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk
├─vda1 253:1    0  26G  0 part /
└─vda2 253:2    0   4G  0 part [SWAP]

When you attach a second (10 GB) and third (20 GB) volume, it looks like this:

lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk
├─vda1 253:1    0  26G  0 part /
└─vda2 253:2    0   4G  0 part [SWAP]
vdb    253:16   0  10G  0 disk
vdc    253:32   0  20G  0 disk

You can remove one of them and reattach it and it should take back the same device it was initially assigned, unless you add something new to the mix. An additional new device will be assigned to the lowest available /dev/vdX.

Does that help answer your question?

Eric