I am trying to restore a huge postgresql database but I cannot recover all the indexes due to lack of space. Can I change the location of temporary files?
HD SDD status after partial loading of DB
The article below seems a first aproximation to work this issue.
''' https://cloudinfrastructureservices.co.uk/install-postgresql-on-centos-stream-9-server/ '''

Just get a bigger disk.
If the creation of an index fails, for example due to lack of disk space, PostgreSQL will clean up the partially created index.
If that's more than a play system, it would be a good idea not to have the database data on the root file system.