Quite old topic but for those looking for it, you need to change the owner of the the directory, and not the permissions:
$ chown -R postgres /root/pgdata
Quite old topic but for those looking for it, you need to change the owner of the the directory, and not the permissions:
$ chown -R postgres /root/pgdata