Celeb Glow
news | April 02, 2026

I am trying to unzip bz2 file but then I get the error saying No space left

bzip2 -dk a.osm.bz2
bzip2: I/O or other error, bailing out. Possible reason follows.
bzip2: No space left on device Input file = a.osm.bz2, output file = a.osm
bzip2: Deleting output file a.osm, if it exists.

I did a df -h and

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 439G 115G 302G 28% /
/dev/sda2 976M 104M 806M 12% /boot
....

the file is around 100GB. And, I should definitely have around 350GB of free storage. I don't get why it is causing an error.

$du -sh a.osm.bz2
100G a.osm.bz2
$ df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 439G 121G 295G 30% /
5

2 Answers

It's a big world ;-) The error is reasonable.

From :

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 the pbf version , which will be much faster.
4

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
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy