DigitalOcean drops come with a limited amount of SSD storage. Here’s how you can add more drive capacity without costing a lot of money, using DigitalOcean’s dedicated storage solution.
Before we proceed, make sure to check if resizing your droplet is an alternative option. Switching to a larger droplet type can give you more storage space as well as a bump in CPU and RAM. This can be ideal if you need all three now, but don̵
You can change the size of the droplets in the DigitalOcean control panel by selecting your droplet and then clicking “Resize”. Choose “Disk, CPU and RAM” then select the plan you want to upgrade to. You must close your droplet while the change is being applied. Size related to disk capacity cannot be reversed.
Mount a block storage volume
Aside from droplet format, DigitalOcean’s block storage volumes are the easiest way to add extra storage space to your servers. Volumes are SSD-driven storage units. When you add a volume to a drop, it is akin to plugging in a physical removable disk.
The droplet now has two storage systems available: the regular SSD and the newly created volume. You determine the capacity of each volume, so that you can tailor your storage solution. The price is a fixed $ 0.10 per GB.
You can create a volume by logging into the DigitalOcean control panel and clicking the “Volumes” link in the left sidebar. Click on the blue “Create Volume” button at the top right of the screen.
Start by specifying the volume size you want to create. Use one of the pre-filled default settings or click “Enter size in GB” to adjust. Then give your volume a name and select the droplet you want to associate it with.
Format and mount volumes
You now need to choose how you want to mount your volume. Usually, “Auto format and mount” will give you normal default settings. When this option is selected, DigitalOcean will create a formatted volume, mount it to your droplet, and then mount it in the file system. You can choose the mount point after clicking “Create Volume”. DigitalOcean supports the Ext4 and XFS file systems. Ext4 is usually the best choice, although XFS is the preferred choice for Red Hat systems.
Choose the option “Manually format and mount” if you need a different file system. This also gives you more control over the mounting configuration as you have to set it up yourself in your drop.
You can use the following command to mount a volume
mount -o defaults,nofail,discard,noatime /dev/sda /mnt/example-mount
We assume that our volume is the
sda device ID. This usually applies to the first volume you attach to a DigitalOcean drop. The mounting options we provide are taken from DigitalOcean’s recommended approach to mounting volumes.
Using your volume
Once attached, formatted, and mounted, volumes simply become another file system location on your droplet. You can copy files to your volume with commands such as
cp example-file.txt /mnt/example-volume/example-file.txt – replace the path where you mounted your volume.
This is no different from using any other form of mountable storage device. Everything saved in the mount location is saved on the volume. The rest of your droplet’s filesystem remains on the dedicated SSD as usual.
To check the remaining disk space on your droplet and volume, use the
df -h order. The line with a mount point of
/ represents your drop’s SSD. The mount point of your volume is also listed so you can see how much capacity is left.
Manage your volumes
Volumes can only be added to one drop at a time. It is possible to reconnect with another drop at any time. This is useful if you are moving sources between droplets or decommissioning one in favor of another.
Use the Volumes page in Control Panel to find your volume. Hover over the name of the drop it is associated with and click “Edit”. You can now choose a new drop to mount the volume.
The size of the volumes can be changed by clicking the “More” button to the right of the table. Choose “Increase Size” and select the new capacity you want to use. Volumes can only be increased upwards so that the change cannot be undone.
Volumes support DigitalOcean’s Snapshots system for backups. This mechanism allows you to store a full disk image in your DigitalOcean account.
Click the “More” button next to a volume and click “Take Snapshot”. Use the dialog to name your snapshot, then press “Take Snapshot” to confirm. The process may take a few minutes. Larger drops take much longer.
You can use snapshots to recover your data in the future. Click on the “Pictures” link in the sidebar and find the snapshot you want to use. You can restore the snapshot to the volume it came from, or you can create a new volume with the snapshot as the base.
Snapshots you take are stored in your account forever. They are billed at $ 0.05 / GB / month. You only pay for the data in each snapshot, not for the size of the volume it comes from.
With the volumes of DigitalOcean you can easily add more storage space to an existing drop. The automated layout and assembly process makes setup an extremely easy process.
Volumes aren’t the only way to get more disk capacity. Depending on your requirements, DigitalOcean Spaces can be a viable alternative. It is a remote object storage system similar to Amazon S3. Spaces is much cheaper if you store large amounts of data – $ 5 / month for 250 GB – but does not connect directly to your droplet’s file system. It must be accessed via HTTP, so it is best used for static assets and long-term archives.