On Sun, 22 Sep 2019 10:17:36 -0700 Samuel Sieb <samuel(a)sieb.net> wrote:
On September 22, 2019 8:07:21 AM PDT, Ranjan Maitra
<maitra(a)email.com> wrote:
>$ sudo losetup -f -P /home/maitra/SD_card_rescue.img
>losetup: /home/maitra/SD_card_rescue.img: failed to set up loop device:
>No such file or directory
That file didn't exist like it says.
>$ sudo mount -o loop /home/maitra/SD_card_rescue.log /mnt/test
>
>But now I get:
>
>mount: /mnt/test: wrong fs type, bad option, bad superblock on
>/dev/loop0, missing codepage or helper program, or other error.
>
>So, I looked at (as per
>https://askubuntu.com/questions/634501/cant-mount-iso-file-as-loop-device-error-failed-to-setup-loop-device):
>
>$file /home/maitra/SD_card_rescue.log
>
>and I got:
>
>/home/maitra/SD_card_rescue.log: DOS/MBR boot sector; partition 1 :
>ID=0x83, start-CHS (0x0,32,33), end-CHS (0x3ec,254,63), startsector
>2048, 16143277 sectors
You wrote the image to that file. Losetup on that file should work like you expect.
Thanks very much! I will go through the steps again just to be sure.
While comparing with
https://blog.tinned-software.net/rescue-data-from-corrupt-sd-card/
I get:
$ sudo parted -l
[sudo] password for maitra:
Model: USB Mass Storage Device (scsi)
Disk /dev/sda: 8270MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 8266MB 8265MB primary ext4
Model: PC401 NVMe SK hynix 512GB (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000MB 999MB fat32 EFI System Partition boot, esp
4 1000MB 22.5GB 21.5GB linux-swap(v1) swap
3 22.5GB 478GB 456GB
2 478GB 505GB 26.8GB ext4
5 505GB 509GB 4295MB ext4
6 509GB 512GB 2621MB ext4
-----
The first part is slightly different from on that page which reads:
$ parted -l
...
Warning: Unable to open /dev/mmcblk0 read-write (Read-only file system).
/dev/mmcblk0 has been opened read-only.
Model: SD SL32G (sd/mmc)
Disk /dev/mmcblk0: 31,9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 31,9GB 31,9GB primary lba
--------------------------
Notably, my disk flag type is "ext4" and there are no flags. This is different
from what the partition on that post is (there the disk flag type is "primary"
and the flag is "lba".
Is this important?
Just to clarify, my SD is being read through an adapter because there is no SD card
Other than that, the situation is the same: I have a corrupt (I guess) SD card with
pictures from a camera from a year ago.
Many thanks,
Ranjan