Limit GB ghost instances for self-hosted

Good evening everyone.

I have set up a home server with ubuntu 22.04 and am setting up various instances of ghost on custom domains for various people.

However, I needed to limit the GB that the various admins of the ghost instances installed on my system could use.

How can I set a limit in terms of GB or MB so that at a certain point the upload is blocked? This would be very useful as it would save my storage space a lot.


I’d look into partitioning that server into separate droplets/containers/virtual servers.

Two decades ago (gasp, yes, it was), I had a small flock of real servers running virtual servers with this software: Overview - Linux-VServer. (This was back before every host in existence sold VPS hosting.) It was great because everyone I hosted had the ability to do whatever they needed to do as ‘root’ in their own vservers, but I could put limits on usage so they couldn’t run amok.

YMMV (it HAS been two decades), and it’s very possible there are better options now than there were then!

You can use Quota on Ubuntu. It’s built into the kernel.

sudo apt install --yes quota

Then amend the fstab to include quotas on the filesystem (you can do this for /), and finally assign quotas to users.

1 Like

I ran a web-hosting company and this how we managed per-customer disk space limits-- each customer had a unique unix user that we assigned a quota to.

With Ghost, it normally runs all the instances as a ghost user, so you’ll have to figure out how to customize that user, hopefully in a way that doesn’t break during upgrades or maintenance.

1 Like

Another idea is to partition your disk. Create a partition for each user. Then mount those partitions where the ghost storage for each user is stored.

If you are using BTRFS, you can use sub-volumes for this, and BTRFS natively supports quotos for sub-volumes.

I thought of a similar solution. But before implementing it, I would have liked to see if there was any different solution.

I also thought when the folder reaches a certain weight in GB the front end was disabled leaving only the back end in order to make room. But I don’t know how far it can be done.