1. 程式人生 > >linux下掛載img方法

linux下掛載img方法

# fdisk -lu arch-live-usb.img
You must set cylinders.
You can do this from the extra functions menu.
Disk arch-live-usb.img: 0 MB, 0 bytes
248 heads, 19 sectors/track, 0 cylinders, total 0 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 identifier: 0xff978785

            Device Boot      Start         End      Blocks   Id  System
arch-live-usb.img1            2048      593919      295936   83  Linux

Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 32, 33) logical=(0, 107, 16)
Partition 1 has different physical/logical endings:
     phys=(36, 247, 19) logical=(126, 10, 18))
# losetup -fo 1048576 arch-live-usb.img  // 這裡的 -fo 104857=(2048*512)
是指定第一個分割槽在整個磁碟映象檔案中的偏移量
# losetup -a  // 得到 loop 裝置檔案路徑,如 /dev/loop0

# mount /dev/loop0 /mnt