By deishelon
Hey! I’d like to know how to expand existing disk with block storage? Currently my droplet is running out of storage and I’m thinking about using Block Storage, but I’d like to expand with it already existing folder eg. all my files are stored /home/www-data Is it possible to add more space to www-data folder ?
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!
Accepted Answer
Using block storage is almost like attaching a USB drive to a laptop. It shows up on your Droplet as a separate drive. That said, you can mount the block storage /home/www-data and store your data there.
The first step would be to move the existing data:
- mv /home/www-data /home/www-data-backup
Next, when you are following the configuration instructions provided in the control panel, replace the instances refrencing /mnt/ with where you really want to mount the volume. For example, if you named the volume volume-nyc3-01 the instructions will suggest you mount it to /mnt/volume-nyc3-01. Instead use: /home/www-data
like so:
- sudo mkdir -p /home/www-data
- sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-nyc3-01 /home/www-data
- echo /dev/disk/by-id/scsi-0DO_Volume_volume-nyc3-01 /home/www-data defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab
Next, we’ll make sure that the new block storage backed directory has the same permissions and ownership as the old directory:
- sudo chown -R --reference=/home/www-data-backup /home/www-data
- sudo chmod -R --reference=/home/www-data-backup /home/www-data
Finally, after verifying everything works as expected, you can remove the old directory to free up the space on your Droplet’s local drive.
Check out this tutorial for more information DigitalOcean Block Storage:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.