My plan has 10GB of storage. How can I see precisely how much I am using?

I know that some is used by my services, and some is used by the disk directive in .platform.app.yaml. Is there a way to see how much is being used from the 10GB total that my project has?

SSH into a project environment

$ platform ssh

If you are not in the project directory where Platform.sh is set as remote (platform project:set-remote) follow the CLI instructions to access the project you want.

Check the disk storage of the project

$ df -H
Filesystem                                       Size  Used Avail Use% Mounted on
/dev/loop21                                      502M  502M     0 100% /
tmpfs                                             13k     0   13k   0% /dev
tmpfs                                            5.3M     0  5.3M   0% /dev/shm
tmpfs                                             53M  263k   53M   1% /run
/dev/loop69                                       31M   31M     0 100% /app
/dev/mapper/7iraodzyabnamgtvhuic5q6i34           512M   20M  501M   4% /mnt
/dev/mapper/platform-udos4pvcpyklbaxontkaeuwgmy  4.3G   39M  4.3G   1% /tmp
/dev/mapper/platform-lxc                         336G   19G  300G   6% /run/shared

Calculate

This is a small project on a “Medium” Platform.sh plan, which comes with 5 GB of storage per environment. Not including the last line of output, the two /dev/mapper/*

/dev/mapper/7iraodzyabnamgtvhuic5q6i34           512M   20M  501M   4% /mnt
/dev/mapper/platform-udos4pvcpyklbaxontkaeuwgmy  4.3G   39M  4.3G   1% /tmp

are the parts of the environment that are counted against this cap. The first line is dictated by the amount of disk allocated to mounts in .platform.app.yaml. In this case

.020 + .039 = 0.059

0.059 GB of the available storage is currently being used.

Your plan has a maximum amount of storage you can get with platform project:info subscription.storage the answer is in MB.

You distribute that total storage between your apps and your services by specifying the disk key of your .yaml files.

If like me you like bash one liners, here you go :

find . -type f -name '.platform.app.yaml' -o -name 'services.yaml' |xargs grep disk:

Executed at the root of your project will give how you distributed your storage.
25.

You can redistribute storage between your different apps and services, and you can upsize the size of the global storage.

Now, if you want to know for a specific app how much of the allocated is still free… you can use the CLI to get the “real usage” of each app. Short and sweet:

platform mount:size

Which directly gives you :

29

Lastly, you really want to also to add yourself a notification if ever you are running low on space: platform integration:add --type="health.email" --recipients="myemail@example.com" will do the trick.

Similar to what @oripekelman said platform db:size can give you your database storage, with the caveat it may not be 100% accurate

Checking database service mysqldb...
+--------------+--------+
| Property     | Value  |
+--------------+--------+
| max          | 2048MB |
| used         | 22MB   |
| percent_used | 1%     |
+--------------+--------+

Warning
This is an estimate of the database's disk usage. It does not represent its real size on disk.
1 Like