1

Very recently, I changed the data_directory of posgresql (9.3.10) to point to a new data disk I recently added to my VM (Ubuntu 14.04 OS). All the old data has been transferred to this new disk as well.

Prior to this shift, the data_directory was residing in the disk that had the OS installed too. This was a digestible arrangement initially, but ultimately the data_directory almost came to fill the entire 30GB space available. Thus I made the shift.

My question is: can I delete the contents of the old var/lib/postgresql/9.x/main/ folder now that data_directory is entirely pointing to a new location?

The old files are still intact, taking a ton of space, and the only reason I haven't deleted them is because other elements in the postgresql config (or some daemon scripts) might be referring to this folder structure somehow. I'm not sure. Someone with experience can perhaps help out here.

1 Answer 1

0

There shouldn't be any references as all the scripts/utils/etc use the data directory environment variable.

the only place I would look is in the new configuration file - take a look you don't have any includes that point to the old folder (not sure at what version they added this option.)

BTW, it's always a good practice to rename (mv dir dir_bck) the folder for a week to see you really don't have anything trying to access there. (you shouldn't anyway as it's stale data...)

Regards,
- Jony

2
  • Sounds good, I was also thinking even if there are any dependencies that I ultimately stumble upon, one thing that ought to be absolutely safe is getting rid of the data inside the old /base folder. That immediately frees up several GBs for me, and even if I discover dependencies later, I'd at least have kept the old directory organization intact. Commented Mar 21, 2017 at 15:20
  • Just checked, don't have any include statements that refer to the older files Commented Mar 21, 2017 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.