Postgres SQL Full Disk Recovery

Just another day in the life of a Systems Admin. What happened today? Postgres server had a full disk partition. No big deal, ill just clear out some space. Laughter in the back there? You’ve been here before? Please, step on up!

A Short Story

As a Linux system admin, I was used to attending technical presentations and seminars, but this one was different. It was a lecture on database management, and the presenter seemed confident and knowledgeable. That is until he said, "The Postgres SQL database server had a full disk partition. No big deal, I'll just clear out some disk space."

I couldn't help but chuckle. The presenter seemed confused by my reaction, so I raised my hand and asked to come to the front. I explained that when the Postgres SQL server's disk is full, the database can't run. This means that the system won't allow any modifications, including clearing out disk space.

The presenter looked embarrassed, and I could see the attendees nodding in agreement. I quickly offered a solution to the problem. I suggested that the presenter identify and delete any unnecessary files on the disk to free up space. Alternatively, he could move some of the data to a different partition. This is only a valid solution if you have files on that partition. Many times a db has a dedicated partition; this means, as was in this case, there are no files to clear!

The only other solution, grow the disk space.

If you’re lucky or good, you have your partition on an LVM or other agile system, in which case you can simply grow your partition, startup your database, and then purge some stale data out.

If you’re less lucky and the partition is a full disk, then you will need to get a bigger larger disk mounted, migrate all data to the new partition which is larger and thus will have free space after, then unmount the other disk and mount the new one to the same mount point, or modify your postgres instance to use the new partition wherever it is mounted. Then restart postgres and purge out stale data, or not, you have more disk space now.

The presenter thanked me for my input, and the lecture continued. As the event ended, the presenter approached me, grateful for my advice. He admitted that he had never encountered such an issue before and promised to research more on database management.

As I walked out of the venue, I smiled to myself, happy to have helped and shared my knowledge. Being a Linux system admin, it was my responsibility to keep systems running smoothly, and I was glad to have fulfilled that responsibility, even outside of work.

This short story was brought to you with the help of chatGPT.

Subscribe to GraspOnCrypto
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.