I am trying to unzip bz2 file but then I get the error saying No space left
It's a big world ;-) The error is reasonable.
From https://wiki.openstreetmap.org/wiki/Planet.osm:
on 2021-02-01, the plain OSM XML variant takes over 1370.5 GB when uncompressed from the 99.3 GB bzip2-compressed downloaded data file).
You could ...
- get more disk space
- download osm files for only the regions you really need
- for small regions, use the API.
- use
osmosis
to extract the needed data from the planet.osm file yourself. But instead of the.bz2
file, you should use thepbf
version , which will be much faster.
With some time you could figure out how big the files in the archive are, from the archive file itself.
-rw------- 1 criggie criggie 95M Jul 22 2015 home-email.tar.bz2
$ bzcat home-email.tar.bz2 | wc -c
149606400
So that 95 MB archive expanded to 149,606,400 bytes in one tar file, which is enough info for your purposes.
In the unix world, compression can be a different process to archiving, which is why we have gzip
and bzip2
, and separately have tar
for sticking things together.
You could dig inside an expanded tar file with test and verbose flags
$ bzcat home-email.tar.bz2 | tar -tv
...big list of output....
An archiver/compressor like zip
combines the two functions, so had your archive been a zip
or an arc
or a lhz
etc that originated in the PC world, you would have to check the flags for a LIST option - example :
$ unzip -lv /home/criggie/config.zip
Archive: /home/criggie/config.zip
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 2020-07-28 17:04 00000000 dir/
1708 Defl:N 1093 36% 2017-02-15 14:15 7c7aee5a dir/file1.txt
5354 Defl:N 2860 47% 2020-03-10 15:57 31be4459 dir/file2.txt
-------- ------- --- -------
319022 10362 26% 20 files