I'm using osm2pgsql to import the entire planet database. I've followed the instructions from the switch2osm (https://switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/) page and used the following command:
osm2pgsql --slim -C16384 --cache-strategy sparse -d osm_2015 --number-processes 4 planet-latest-september-5.pbf
Note that I am doing the import on a virtual machine (VM). Other details are as follows:
Planet file size: 29GB
RAM: 24GB
CPU: 8 X Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
4TB disk mounted remotely
OS: Ubuntu 14.04
psql (PostgreSQL) 9.3.9
PostGIS Version 2.1.2
I've completed importing but osm2pgsql took 1817529 seconds overall to import the data, which comes to about 21 days!
My question is, what can I possibly do to optimize/minimize the import time in the future using the specifications that I've listed above? Please note that I'm really new to this.