On Wed, 26 Jun 2019 05:14:11 -0700 (PDT),
activewholefoods@gmail.com declaimed the
following:
Dennis, thanks for explaining how mount won't work. No 2nd BBB.
Can I do cat of eMMC to read the contents of some of the files? The
important files I need are c/cpp source text files. From the mSD, how do I
specify the eMMC directory?
With no partition table, there is no way to tell it where the
"directory" is located. It needs to know where the start of the partition
was to then locate the data structures telling it where the files are. Note
that in Linux, the "directory" is just another file
http://tldp.org/LDP/intro-linux/html/sect_03_01.html
(Lots of stuff on that page, but I'm going to quote from the end...)
"""
3.1.3.2. The file system in reality
<SNIP>
Every partition has its own file system. By imagining all those file
systems together, we can form an idea of the tree-structure of the entire
system, but it is not as simple as that. In a file system, a file is
represented by an inode, a kind of serial number containing information
about the actual data that makes up the file: to whom this file belongs,
and where is it located on the hard disk.
Every partition has its own set of inodes; throughout a system with
multiple partitions, files with the same inode number can exist.
Each inode describes a data structure on the hard disk, storing the
properties of a file, including the physical location of the file data.
<SNIP>
The only information not included in an inode, is the file name and
directory. These are stored in the special directory files. By comparing
file names and inode numbers, the system can make up a tree-structure that
the user understands. Users can display inode numbers using the -i option
to ls. The inodes have their own separate space on the disk.
"""
Information for one of my BBB (but I have no idea if it varies any from
reflash to reflash -- or based upon who provided the eMMC, mine is old
enough to have Micron chips for eMMC and SDRAM) -- use fixed width font
debian@beaglebone:~$ sudo fdisk -l
[sudo] password for debian:
Disk /dev/mmcblk1: 3.7 GiB, 3925868544 bytes, 7667712 sectors
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: dos
Disk identifier: 0xc57622dd
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 8192 7667711 7659520 3.7G 83 Linux
Disk /dev/mmcblk1boot1: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mmcblk1boot0: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
debian@beaglebone:~$
debian@beaglebone:~$ sudo parted -l
Error: /dev/mmcblk1boot0: unrecognised disk label
Model: Generic SD/MMC Storage Card (sd/mmc)
Disk /dev/mmcblk1boot0: 1049kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
Model: MMC MMC04G (sd/mmc)
Disk /dev/mmcblk1: 3926MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 3926MB 3922MB primary ext4 boot
Error: /dev/mmcblk1rpmb: unrecognised disk label
Warning: Error fsyncing/closing /dev/mmcblk1rpmb: Input/output error
Retry/Ignore? i
Model: Generic SD/MMC Storage Card (sd/mmc)
Disk /dev/mmcblk1rpmb: 131kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
Error: /dev/mmcblk1boot1: unrecognised disk label
Model: Generic SD/MMC Storage Card (sd/mmc)
Disk /dev/mmcblk1boot1: 1049kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
debian@beaglebone:~$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1 179:0 0 3.7G 0 disk
+-mmcblk1p1 179:1 0 3.7G 0 part /
mmcblk1boot0 179:8 0 1M 1 disk
mmcblk1boot1 179:16 0 1M 1 disk
mmcblk1rpmb 179:24 0 128K 0 disk
debian@beaglebone:~$
debian@beaglebone:~$ sudo blkid
/dev/mmcblk1p1: LABEL="rootfs" UUID="0983c07a-71fe-435f-b97f-f7a36e2fc3d3"
TYPE="ext4" PARTUUID="c57622dd-01"
/dev/mmcblk1: PTUUID="c57622dd" PTTYPE="dos"
debian@beaglebone:~$
Or somehow copy a block of the eMMC. Then search it to extract the text
content.
You /might/ be able to use "dd" to copy the raw eMMC contents to a file
on some other media, but then you will have learn how to navigate the
structure of the partition (presuming you can find it in that raw data).
Note that there is no guarantee that file contents will be contiguous --
even if the editor writes the entire contents as a new file and renames it
after deleting the original, the blocks will be allocated from a free list
of blocks, and those may be scattered.
The main take-away from above is that -- for my eMMC, the primary
partition starts at sector 8192 (or 4MB in) -- so if you zeroed 100MB,
you've also wiped out the first 96 MB of the data. If the "inodes" are
stored there, then the pointers to the files themselves have been lost.