explor img file

1, get offset

# parted bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img 
GNU Parted 3.1
Using /workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model:  (file)
Disk /workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img: 3565MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  3565MB  3561MB  primary  ext4         boot

(parted) unit B
(parted) p                                                                
Model:  (file)
Disk /workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img: 3565158400B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start     End          Size         Type     File system  Flags
 1      4194304B  3565158399B  3560964096B  primary  ext4         boot

(parted) 

get the ext4 partation offset 4194304

or u can use fdisk:

fdisk -l /workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img

Disk /workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img: 3565 MB, 3565158400 bytes, 6963200 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 label type: dos
Disk identifier: 0xca52207f

                                                       Device Boot      Start         End      Blocks   Id  System
/workspace/bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img1   *        8192     6963199     3477504   83  Linux

the offset is 8192(sectors) * 512 = 4194304 Byte

2,mount 

mount -o loop,ro,offset=4194304 bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img  /mnt/
http://www.cnblogs.com/skynext/
原文地址:https://www.cnblogs.com/skynext/p/7927632.html