1. 程式人生 > >Linux mount 掛在 img 映象

Linux mount 掛在 img 映象

下面是掛載一個img的記錄過程, 沒有時間整理,等以後有時間再整理下吧

>> ls

md5sums 

openwrt-brcm2708-bcm2710-raspberrypi-3-rootfs.tar.gz 

openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img 

openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img.gz 

packages 

sha256sums

>> fdisk ./openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p


Disk ./openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img: 76 MiB, 79691776 bytes, 155648 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: 0x5452574f

Device                                            Boot Start    End Sectors Size Id Type
./openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img1 *     8192  49151   40960  20M  c W95 FAT32 (LBA)
./openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img2      57344
155647   98304  48M 83 Linux

Command (m for help): q

## 57344 * 512 = 29360128

>> sudo mount -o loop,offset=29360128 openwrt-brcm2708-bcm2710-rpi-3-ext4-sdcard.img /mnt

##陰影區:loop,offet 不能有空格

>> ls /mnt
bin  dev  etc  lib  lost+found  mnt  overlay  proc  rom  root  sbin  sys  tmp  usr  var  www