postgresql vacumm disk space

Run vacuumdb without increasing disk space:

service postgresql stop
mv /var/lib/postgresql/9.5/main /mnt/new_disk
ln -s /mnt/new-disk/main /var/lib/postgresql/9.5
chown postgres:postgres /mnt/new-disk
service postgresql start
vacuumdb –all –full
service postgresql stop
rm /var/lib/postgresql/9.5/main
mv /mnt/new_disk/main /var/lib/postgresql/9.5
service postgresql start

Leave a Reply

Your email address will not be published.