I Would like to increase my /Var which contains my Web site data and Database data already in it. is that possible to increase my /var with a Block Storage Volume WITHOUT LOOSING THE DATA ALREADY IN IT. if so . Kindly Explain the Same
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
This is a bit complicated task! However, it is not impossible to accomplish it. I have managed to mount a block-storage volume to /var/ directory of my Droplet without apparent issues. However, with that being said, I highly recommend you to take snapshots of your Droplet and make sure you have local backups(downloaded from Droplet via SFTP or RSYNC or SCP). Here is what I did:
Create a new volume of 10GB(you can choose any size) .
When you are adding the volume, enter the volume name(in my case, I used the volume name as “var”) opt for Manually Format & Mount and click on Create Volume.
Once the Volume is created, you will get a Modal pop up with the mounting instructions. Copy that and save it on a notepad. It will look something like this
Now SSH into your Droplet and perform the following tasks:
snapdservice running in your Droplet:
We need to stop this as snapd library files are located at /var/lib/snapd and while we copy, mount and reboot, the Droplet would fail to locate the .snap files due to block device change.
**You would need to gracefully stop any database services like MySQL as well. As I mentioned on the top, please make sure that you have backups in place. I would suggest taking MySQL dumps from your database before stopping the service and save it somewhere outside the Droplet environment. **
Please make sure to replace
/dev/disk/by-id/scsi-0DO_Volume_varwith whatever was shown on your Modal pop up initially when you created the volume.
Now comes the process of mounting. Here you would face downtime on your website and services. So you will want to plan this out whenever you anticipate less traffic.
Let us rename
/varto something else:
/etc/fstabfile like below:
(Please make sure to replace
I hope this helped!
Please please make sure that you have backed up everything before doing the above!