4527a575089648d24fdd714d73f8d37a5c8142aa
By:
Dibbyo457

How to attach Block Storage when Droplet connected to ServerPilot?

May 25, 2017 686 views
Block Storage WordPress Ubuntu 16.04

Hello, Guys. I'm stuck in little problem.
I have a Droplet which is connected to ServerPilot. I use WordPress on that Droplet, my question how to attach a Block Storage when I'm connected to ServerPilot?

I read this Tutorial, But I think something different in ServerPilot. So, I asked them & they told me I have to mount the Block Storage in /srv you can check the full ScreenShot Here.

I don't have a single knowledge in Linux, that is why I use DigitalOcean & ServerPilot for easy maintenance.

Did any of guys happen to using Block Storage when you're using ServerPilot? Could you help me by giving me step by step tutorial?
Remember, I use only WordPress, so I wants to mount or attach the Block Storage in such way, that I won't have any issue while uploading Images or Attachments in my WordPress Library.

Thank you.

2 comments
  • Hi,

    I have a 60gb droplet + 140gb volume.

    I followed all the steps but Serverpilot still sees just the 60gb from the droplet and not the 140gb from the volume.

    Do I have to do something else?

    Thank you!

  • Have you checked the storage information by "df -h" command?

1 Answer
jtittle1 May 25, 2017
Accepted Answer

@Dibbyo457

Once you deploy a new Droplet with a Volume, first click on the name of the Droplet and then, from the left side menu, click on Volumes.

You'll then want to click on More, then Config instructions. A pop up will be presented with the configuration commands that you need to run in order to mount the volume persistently.

Those commands will be something like:

sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01

and

sudo mkdir -p /mnt/volume-nyc1-01; sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /mnt/volume-nyc1-01; echo /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /mnt/volume-nyc1-01 ext4 defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab

Which, broken down in to multiple commands, looks like:

sudo mkdir -p /mnt/volume-nyc1-01
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /mnt/volume-nyc1-01
echo /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /mnt/volume-nyc1-01 ext4 defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab

Since ServerPilot is recommending that you mount to /srv, you'll need to modify those commands and remove the mkdir commands, as they aren't needed.

Keep in mind, this is an example. You're volume may be named different, so you need to replace the name of the volume in this example with the name of the volume that's created for you.

So what we'd end up with us a set of commands like this:

Formate and Prepare the Volume

sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01

Mount the Volume to /srv

sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /srv

Create the /etc/fstab Entry for Persistence

echo /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 /srv ext4 defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab

The part in the commands above that you will probably need to replace is

scsi-0DO_Volume_volume-nyc1-01

Once the above commands are ran, you'll all done and can then connect the new Droplet to SP.

  • @jtittle
    Hi, thank you so much for taking the time and giving me step by step tutorial. But I'm still confused. As you wrote, "Once the above commands are ran, you'll all done and can then connect the new Droplet to SP."
    Then connect to SP see that's part that really confusing me. My droplet is already connected to SP.
    So, I won't be able to attach a BS if my droplet already connected to SP?
    Could you please collaborate a little here?
    Thank you.

    • @Dibbyo457

      You can attach a volume to a current Droplet, though in that ticket, they are recommending that you create a new Droplet with a volume and, from what I can understand (even though it's not stated), migrate your data over.

      If you intend on deploying a volume to an existing Droplet, you'd need to backup all data that resides in /srv and verify it, delete the existing data, mount the volume (using the commands I provided, and changing the volume name as it applies to yours), and then restore the data from the backup.

      You would then need to go through and ensure that all permissions on all directories and files match what they were, and what they need to be in order for you to manage your site through ServerPilot.

      The above is most likely why they are recommending that you create a new Droplet and attach a volume to it, then migrate data over to it. Incorrect permissions can be problematic and cause numerous issues. Although somewhat easy to fix, we have no real indication of how ServerPilot sets up a server, so they may be doing something on the backend that may differ from what I might recommend doing -- that alone could prevent you from using their service on the front end.

Have another answer? Share your knowledge.