How to read divided emmc partition?

Hi All, we have reduced the rootfs partition to 12GiB and we are using the remaining 2GiB for custom data. When I issue command, sudo ./flash.sh -r -k APP -G backup.img jetson-xavier-nx-devkit-emmc mmcblk0p1 only 12GiB is read. How to read the remaining 2GiB?

hello sadaa,

this command, sudo ./flash.sh -r -k APP -G backup.img jetson-xavier-nx-devkit-emmc mmcblk0p1, it only read and back-up APP partition,
I assume you’ve update the flash configuration file to define partition layouts, right?
you may check the partition label with $ ls -al /dev/disk/by-partlabel, and using dd commands to read your customize partition.

Hi Jerry, I have not updated the flash configuration file. I flashed the emmc partition using the following command sudo ./flash.sh -S 12GiB jetson-xavier-nx-devkit-emmc mmcblk0p1 and mount the 2GiB partition at runtime. I have a scenario where my kernel image is corrupted. So I am trying to read the rootfs partition, update the kernel and flash it again. I also want to read the 2GiB partition so that I can verify the custom data as well. Is there a way to read the custom partition from linux PC?

hello sadaa,

there’s functionality to load kernel image via filesystem, however, kernel image is actually flashed to the kernel partition.
there should be redundancy feature to switch to workable partition, may I know what’s the corruption you’ve seen, could you please setup serial console and gather the logs for reference.

Hi Jerry, We were trying to update the kernel at runtime. Since kernel is present at /boot/ folder, we were just replacing the image with the newer one and rebooting. But sometimes, kernel images is not properly copied, only part/ one-third is actually copied. So after rebooting, board stuck at uboot.

hello sadaa,

please setup serial console and gather the failure in details for reference,
thanks

I am not sure how serial console will help here. My initial question is to read the 2GiB partition. Can you share on how to read the partition using flash.sh

no, that’s not supported.

okay, I understand. Is there a way to mount the jetson partitions in my local pc? like nfs or nbd-client?

Just adding some details to @JerryChang’s answer: dd is a great tool for cloning any partition which is not changing during the read. The clone program is good for reading the rootfs since a recovery mode Jetson does not have a changing rootfs, and is thus superior for rootfs clone compared to dd. Since your data partition is not changing (I am assuming your program is not updating the partition during the dd) it is actually the simplest and most reliable method. You can even redirect the dd output to ssh to another computer, and on the other computer you can resume the dd through ssh to a file on the local system (or to another disk). Or, if you have a removable disk (e.g., SD card or USB), then you can just dd to that.

Hi linuxdev, Thanks for the reply. I believe that we can use dd only if jetson is running(booted and connected to network). But in my case, device is not bootable. So, I want to clone both rootfs and the custom data partition in recovery mode. Is it possible? If it is, can you share how? Really appreciate the help.

you may only back-up APP partition with flash script, i.e. sudo ./flash.sh -r -k APP -G backup.img ...
that 2GiB partition is mounted after system boot-up, so it’s not recognize while you’re in the recovery mode.

The original TK1 had the ability to clone either the whole eMMC or any partition. Since those early 32-bit days no Jetson has had this ability, at least it is not publicly exposed. I suppose that if you know the partition label, you could attempt to use that in the clone command. Note the “-G APP” in the clone command. Maybe naming your partition would clone it, but I have doubts (it would be interesting to find out if that works). Otherwise your partition is lost without more destructive methods like unsoldering the memory and copying it in a tool for accessing that memory directly.

Oh I see, I have tried changing the configuration xml to add the data partition there with a new name like CUST and modified the flash.sh script, so that I can read the partition by giving-G CUST. But it failed. I was getting Access denied error.