I've done the following several times, but now it doesn't work anymore:

  1. downloaded the latest Raspbian image
  2. qemu-img resize 2017-06-21-raspbian-jessie-lite.img +300M
  3. sudo losetup -P /dev/loop0 2017-06-21-raspbian-jessie-lite.img
  4. sudo gparted /dev/loop0
  5. using gparted, resized the fs partition to fill the empty space
  6. sudo losetup -D
  7. truncate --size=$[(3162111+1)*512] 2017-06-21-raspbian-jessie-lite.img

The "magic number" 3162111 is the last sector of the second partition. Then I burned an sd-card with the new image. It doesn't boot - it hangs on the 4 raspberries with black screen.

Of course the original one works fine. I've noticed that sudo losetup -a still shows the image mounted:

$ sudo losetup -a
/dev/loop0: [2049]:1179664 (/home/dev/opt/2017-06-21-raspbian-jessie-lite.img), offset 48234496

Trying again with sudo losetup -D doesn't change anything. Even fuser -c or -k does nothing useful.

I'm afraid the problem on boot is related to this. What could I try to check now?

Your Answer

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

Browse other questions tagged or ask your own question.