Skip to content

Development ~ Mounting images

[email protected] edited this page Nov 24, 2018 · 3 revisions

Quick guide on how to mount an .img file without booting it.

Inside the .img file there are usually two partitions: /boot partition and the main partition holding operating system , home directory etc. The first one /boot is possible to mount using different tools in Windows and get to the files. But the second partition will be much more difficult to mount on Windows as it a type of a Linux partition. Therefore in this guide we will show to do it on a Linux box. I did this on CentOS but it can be done on any other.

Get .img file into your linux box. Run this to examine it's contents

# kpartx -l FILE.img

Output will be something like this

loop3p1 : 0 65536 /dev/loop1 8192 loop3p2 : 0 8388608 /dev/loop2 81920

This shows two partitions without creating any loop devices. Now create two loop devices.

# kpartx -a FILE.img`

They will end up as /dev/mapper/loop0p1 and /dev/mapper/loop0p2.

The final step is to mount them. Create mount dirs before mounting.

# mkdir /mnt2/loop1 /mnt2/loop2
# mount -o loop /dev/mapper/loop0p1 /mnt2/loop1/
# mount -o loop /dev/mapper/loop0p2 /mnt2/loop2/

Done. You partitions are now accessible under /mnt2/loop1 and /mnt2/loop2

Copy or edit files as needed. You can now unmount the partitions

# umount /mnt2/loop1
# umount /mnt2/loop2

You should now be able to write .img to SDcard and boot into it.

# sudo dd if=/dev/"your SDcard" of=FILE.img

You can find the name of "your SDcard" with :

# lsblk

don't use sda, it's your main harddisk and it would be totally erased !! "your SDcard" should named sdb or sdc or mmcblk0. Try the lsblk command with and without our SDcard to identify its label.

Home

General

Hardware Setup

Software Setup

RC Control

Ground Stations

Expert Settings

Extensions / AddOns

  • HDMI-in cards
  • WebCams
  • Video Switcher
  • Thermal (FLIR, Seek)
  • 360° cameras

Community-HUB

Developer's Corner


Links

Known Issues

Clone this wiki locally