1

I've been trying to compile kodi in babanian os image by mounting it in my desktop pc with chroot. There is space issues occured and I create some space with commands below:

# qemu-img info bananian-1508.img
image: bananian-1508.img
file format: raw
virtual size: 1.8G (1900000256 bytes)
disk size: 1.8G

# qemu-img resize bananian-1508.img +2.2GB
Image resized.

After this, I mount image file and made resize on necessary partition. After all, when I check the image size, it looks like not expanded.

# qemu-img info bananian-1508.img
image: bananian-1508.img
file format: raw
virtual size: 4.0G (4262232576 bytes)
disk size: 1.8G

As you can see above, the raw image virtual size has extended but disk image size is still same. Did I made something wrong?

1 Answer 1

1

The disk size indicates space actually allocated for the image file on disk. The resize doesn't actually allocate any disk blocks; the image file is left as a sparse file. If you have expanded the partition and filesystem in the image, you will be able to write more data to files inside, and as data gets written to new blocks of the image file for the first time, actual disk blocks will be allocated.

The interesting information we can get from using ls -lhs is how the files are actually sized.

From "The Virtual Disk Cookbook" http://lnx.cx/docs/vdg/html/ch02s03.html

3
  • What was the solution then to expand the partition?
    – BTR Naidu
    Commented Mar 15, 2023 at 6:07
  • The command in the question actually worked; it was just the output of qemu-img info that was confusing. As shown above, qemu-img resize whatever.img +2.2G increases the image size by 2.2GB, for example. If you're asking what to do to enlarge partitions and filesystems on the disk once you've made the disk bigger, that depends a lot on what they are exactly, but a tool like gparted would be a good start for a disk with simple standalone filesystems like ext4 or similar
    – rakslice
    Commented Mar 16, 2023 at 1:28
  • I wanted to have this automated via the script. Therefore gparted is not an option. Also, the fs type is fat32 which is making it more complicated.
    – BTR Naidu
    Commented Mar 16, 2023 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .