#osm Trick to allow importing an entire country to pgRouting/PostGIS/PostgreSQL [1]: first chop up the source into smaller pieces using splitter [2], otherwise the osm2pgrouting tool will keep crashing:
$ java -jar splitter.jar --output-dir=splits/ country.osm
$ ONCE=--clean; for f in splits/*.pbf; do osmconvert $f --out-osm -o=part.osm; osm2pgrouting -f part.osm $ONCE ...; ONCE=; done
[1] https://pgrouting.org/
[2] https://wiki.openstreetmap.org/wiki/Mkgmap/help/splitter