How to Mount Disk Image (*.img) File on Linux

In some cases, we need to mount disk image to modify O/S files. Let’s review the Mount Disk Image (*.img) File on Linux.

 

There are many cases I used and remember one of them during the ODA VM Cloning process to get zero down time I change the IP configuration to not get IP conflict.

 

Mount Disk Image (*.img) File on Linux

 

Here is the steps

 

[[email protected] test]# losetup -f

/dev/loop0




[[email protected] test]# losetup /dev/loop0 System.img

[[email protected] test]# kpartx -a /dev/loop0

[[email protected] test]# vgscan

Reading all physical volumes. This may take a while...

Found volume group "vg_crpapp" using metadata type lvm2




 [[email protected] test]# vgchange -ay vg_crpapp

2 logical volume(s) in volume group "vg_crpapp" now active




[[email protected] test]# ls -lrt /dev/mapper/vg_crpapp*

brw-rw---- 1 root disk 252, 67 Nov  5 16:32 /dev/mapper/vg_crpapp-lv_swap

brw-rw---- 1 root disk 252, 66 Nov  5 16:32 /dev/mapper/vg_crpapp-lv_root




[[email protected] test]# mkdir /image

[[email protected] test]# mount /dev/mapper/vg_crpapp-lv_root /CRP2/

vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet

BOOTPROTO=none

IPADDR=1.1.1.2

PREFIX=24

GATEWAY=1.1.1.1

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="eth0"

UUID=60ba15ca-4460-40bf-9ae5-c041539f83ad

ONBOOT=yes

DEVICE=eth0

USERCTL=no

LAST_CONNECT=1471983821

 

 

 

Do you want to learn Oracle Database for Beginners, then Click and read the following articles.

Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 1,218 views last month,  1 views today

About Cihan Gedik

I am currently working as Senior Oracle Application Database Administrator. I have experienced many EBS database upgrade, migrations, Fresh EBS installations, Solaris to Linux, Windows to Linux replatform migration projects in medium and large companies and also experienced core database migration projects for one of the biggest bank of Katar.With my colleagues we decided to run this platform to share our knowledge

Leave a Reply

Do NOT follow this link or you will be banned from the site!