Report this

What is the reason for this report?

Trying to add a 10GB volume to a dedicated droplet running MySQL

Posted on February 5, 2018

Hello,

Our Droplet has been running out of disk space and we’ve attached a volume, but it’s not working. How do we make sure the droplet is using the extra disk we added?

The droplet is running MySQL only and is a dedicated database server.

Please let us know what we need to do.

Thank you.

Best,

Sunny



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Simply mounting the droplet will not help you get rid of disk space issues. You need to actually use the volume. When attaching a volume (https://www.digitalocean.com/community/tutorials/how-to-use-block-storage-on-digitalocean) you mount a certain folder to the block storage. Only data inside this exact folder will be stored on the block storage. You are writing the server only runs a MySQL Database, here is what I would do: 0. Make sure that the block storage is at least as big as the databases it should contain (use du for example)

  1. Stop the database
  2. Mount the storage somewhere (e.g. /mnt/storage)
  3. Copy your database storage to the mounted folder, make sure to preserve access rights, something like cp -rp /var/lib/mysql /mnt/storage should work
  4. unmount the storage and move the database storing location somewhere else (backup)
  5. mount the storage to your database data location (probably /var/lib/mysql) or change the datadir setting to point to the mounted volume.
  6. Start the database, check if everything is working
  7. make sure you added the volume to your /etc/fstab, especially if you changed the path to e.g. /var/lib/mysql

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.