Mounting Orin Nano SD card image at Ubuntu host

as recommended here

I am trying to mount the image of an Orin Nano SD card at an Ubuntu 22.04 host.:
sudo mount -o loop /media/ox/Data1/jsNanoFullSd.img /mnt/sdNano
gives this error:
mount: /mnt/sdNano: wrong fs type, bad option, bad superblock on /dev/loop, missing codepage or helper program, or other error.

For testing I have created another SD card from the image file, it boots at the Nano, so the file is OK.

Before I created a loop device with
sudo losetup /dev/loop18 /media/ox/Data1/jsNanoFullSd.img
(according to losetup the devices loop1…loop17 already exist for snaps)

Interstingly fdisk -l shows the sections on the SD card as ‘Microsoft basic data’:

@om3-244:~$ sudo fdisk -l /dev/sdb
[sudo] password for ox: 
Disk /dev/sdb: 119,08 GiB, 127865454592 bytes, 249737216 sectors
Disk model: USB3.0 CRW   -SD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 67B7C6BE-FD86-4CBC-9C1F-8521B3493C5C

Device       Start       End   Sectors   Size Type
/dev/sdb1  3050048 249737175 246687128 117,6G Microsoft basic data
/dev/sdb2       40    262183    262144   128M Microsoft basic data
/dev/sdb3   262184    263719      1536   768K Microsoft basic data
/dev/sdb4   263720    328487     64768  31,6M Microsoft basic data
/dev/sdb5   328488    590631    262144   128M Microsoft basic data
/dev/sdb6   590632    592167      1536   768K Microsoft basic data
/dev/sdb7   592168    656935     64768  31,6M Microsoft basic data
/dev/sdb8   656936    820775    163840    80M Microsoft basic data
/dev/sdb9   820776    821799      1024   512K Microsoft basic data
/dev/sdb10  821800    952871    131072    64M EFI System
/dev/sdb11  952872   1116711    163840    80M Microsoft basic data
/dev/sdb12 1116712   1117735      1024   512K Microsoft basic data
/dev/sdb13 1117736   1248807    131072    64M Microsoft basic data
/dev/sdb14 1248832   2068031    819200   400M Microsoft basic data
/dev/sdb15 2068032   3050047    982016 479,5M Microsoft basic data

My question: How can I mount that image file so that I can access the Jetson root File System on the host?

What is the source of this .img file? If this is a clone of some sort of the Jetson’s rootfs, then loopback can do this. As is it looks like you are trying to mount this directly, but in this form, it is a file, not a filesystem.

If you have a file with the .img extension, and if that file is a clone of an ext4 filesystem partition, and if that clone file is at location “/mnt/file.img”, then check this out:

mkdir ~/clone
sudo mount -o loop /mnt/file.img ~/clone
cd ~/clone
sudo umount ~/clone

There is an extreme difference between having binary data in a file that is within an SD card partition, and having the actual partition. Partitions can be mounted, files cannot, but a file which contains a partition can be adapted to look like a partition by loopback.


The source of this .img file: it was done by dd, copying the whole of the SD card:
sudo dd if=/dev/sdb of=/media/ox/Data1/jsNanoFullSd.img

So, yes my attempt to mount this disk-image file did not make sense.

Now I did the following:
dd if=/dev/sdb1 of=/media/ox/Data0/jsNanoMPart.img
sdb1 being the main (117G) partition of the 128 Gb SD card
(assuming this partition - and now this file - contains the root FS as ext4)

sudo losetup /dev/loop20 /media/ox/Data0/jsNanoMPart.img

sudo mount -o loop /media/ox/Data0/jsNanoMPart.img /mnt/sdNano
mount: /mnt/sdNano: can't read superblock on /dev/loop20.

This seems to indicate the first block of the partition is damaged(?)
Also strange is that in the fdisk listing above, the partitions are marked as ‘Microsoft’ (assuming it means FAT32) - should this not be ext4, coming from the Nano? (the SD card was created by flashing the Nano from the SDK)

I have no idea what you are trying to do.
Why you need to modify the image when you have the physical SD card?

You need to use -p as it contains a whole disk.

For example, I tested with the sd-blob.img from JetPack 6 DP Orin Nano SD card image:

losetup -f
sudo losetup -P /dev/loop5 sd-blob.img 
sudo mount -o loop /dev/loop5p1 /mnt/

sudo umount /mnt/
sudo losetup -d /dev/loop5

Thank You very much - this solved it, can now access the mounted Root FS!

Re Question above: I did not want to modify the image, only mount the RootFS from the full-SD imagefile and that’s working now, great!

Tips: Make sure you don’t use a directory that contains the loopback file when you mount the file as a mount point. Don’t use both losetup and mount -o loop at the same time (they both bind a loop device).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.