Faster way of upgrading postgres to 10 from 9.5 I am trying to test the migration of postgres to 10 from 9.5

On trying in a test DB of size 490 GB in one postgres node it is taking about 18 mins. The command I used

sudo -H -u postgres /usr/lib/postgresql/10/bin/pg_upgrade \
   -b /usr/lib/postgresql/9.5/bin \
   -B /usr/lib/postgresql/10/bin \
   -d /var/lib/postgresql/data/postgresql0 \
   -D /var/lib/postgresql/10/data/postgresql0 \
   -o ' -c config_file=/etc/postgresql/9.5/main/postgresql.conf' \
   -O ' -c config_file=/etc/postgresql/10/main/postgresql.conf' -k 


Is there any faster way of doing this?
I used a script for loading junk data in postgres. It created a lot of databases (about 500). So this was causing pg_dump to take so much time.

After populating only the relevant database (about 100 GB) I am seeing good performance (about 5 second with -k option).