0

I have followed the instructions on https://pixelfriedhof.com/en/remote-backup-your-raspberry-pi-with-ssh-via-terminal/ to remotely back up the SD of my Raspberry PI (I don't have access to the SD) and ended up with a ~6GB .gz file for a mostly empty 32GB SD card.

I followed the instructions on the same website to re-write the image on another SD card - although of 64GB size, if this matters. LUbuntu shows 2 partitions in the File explorer: boot, and rootfs. I can explore boot just fine, but rootfs does not have the eject icon next to it and I cannot explore it.

Since fdisk tells me there are 2 sane partitions (FAT and Linux) in the file contained within the .gz archive (which I can only assume to be a .img file), I have tried multiple ways to mount the other partition (kpartx is one of them, it tells me wrong filesystem for loop0p1, while I can mount loop0p2 which is boot for some reason ; I have tried mounting the img with offset as well) in vain.

Is it normal that I can't mount the image? I would like to check it's correctly made at least...

1
  • 1
    An image created with dd from a live system, like your link suggested, cannot ever be correctly made. You might get a useful almost-correct copy, but you could also end up either with something completely corrupt or - worse - something subtly corrupt that you don't notice until too late Commented Nov 5, 2020 at 12:27

1 Answer 1

0

You should be able to mount the partitions, but you must understand the difference between the image and the partitions.

The image contains two partitions. You can (should) not mount the image, but you should mount the partitions. So, from the command-line that would be:

$ sudo -s
# losetup -Pf 2018-11-13-raspbian-stretch.img
# ls /dev/loop*
/dev/loop-control  /dev/loop0p1  /dev/loop1  /dev/loop3  /dev/loop5  /dev/loop7
/dev/loop0         /dev/loop0p2  /dev/loop2  /dev/loop4  /dev/loop6
# mount /dev/loop0p2 /mnt
# ls /mnt
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
#

With losetup, you set-up a loopback device for the image. -P (or --partscan if you like typing) forces the kernel to scan the partition table on a newly created loop device. It therefore creates the p1 and p2 devices for partition 1 and partition 2.

Now, you have a device for both partitions that you can mount.

You must log in to answer this question.

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