Sample Header Ad - 728x90

Where does the "Physical size" information come from?

0 votes
2 answers
89 views
I have an embedded Linux device (not a Raspberry Pi) which has two partitions on an eMMC drive. I have used a vendor-provided tool to copy these two partitions onto a USB drive whose size roughly equals the size of the eMMC drive. What I did next was mount the USB drive onto a Linux computer and use tools such as e2fsck and resize2fs -M to resize the second filesystem to a minimum viable size, and finally used gdisk to resize the partition itself to match. In all calculations I've been careful to ensure that the partition does not get smaller than the filesystem, even to a point where I've made the partition slightly larger, and then used resize2fs to enlarge the filesystem to match it. After these operations I have a 16 GB USB drive with a 118 MiB boot partition and a 3.1 GiB root filesystem partition. I then used dd to read data directly from the USB drive, utilizing bs= and count= parameters to limit the amount of data read to only extend up to where the second partition ends plus an extra sector to accommodate the "zero sector". The result is that I now have an image file in which the two partitions have exactly the size of their corresponding sources but when I use the "File" -> "Properties" option of the 7-Zip tool it claims that the "Physical size" (circled in red) is larger than these partitions, and larger than what I instructed dd to copy from the source. Where does this "Physical size" value come from? Is it part of the partition table? Or does dd read it from the disk somehow? Is there any way for me to modify it so as to get rid of the "Unexpected end of data" error? Picture from 7-zip
Asked by Antti Keskinen (3 rep)
Sep 23, 2024, 02:37 PM
Last activity: Sep 23, 2024, 08:00 PM