In blog entry "Provisioning your GRID with Oracle VM Templates" I explained how to mount a filesystem from an Oracle VM template that was build on a logical volume. It seems however, that Oracle VM templates are also shipped without logical volumes in it, just plain ext3.
So how would one manage to mount that then ?
First, setup the loop, to see what's in it.
[root@pts05 ] losetup /dev/loop99 /OVS/running_pool/gridnode01/System.img
[root@pts05 ]# fdisk -lu /dev/loop99
Disk /dev/loop99: 6530 MB, 6530871808 bytes
255 heads, 63 sectors/track, 793 cylinders, total 12755609 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/loop99p1 * 63 64259 32098+ 83 Linux
/dev/loop99p2 64260 8562644 4249192+ 83 Linux
/dev/loop99p3 8562645 12739544 2088450 82 Linux swap / Solaris
So, three plain partitions, no logical volumes in it.
What to do next ? it seems NOT possible to inform the kernel about that three partitions:
[root@pts05 p]# partprobe -s /dev/loop99 Error: Error informing the kernel about modifications to partition /dev/loop99p1 -- Invalid argument. This means Linux won't know about any changes you made to /dev/loop99p1 until you reboot -- so you shouldn't mount it or use it in any way before rebooting. Error: Error informing the kernel about modifications to partition /dev/loop99p2 -- Invalid argument. This means Linux won't know about any changes you made to /dev/loop99p2 until you reboot -- so you shouldn't mount it or use it in any way before rebooting. Error: Error informing the kernel about modifications to partition /dev/loop99p3 -- Invalid argument. This means Linux won't know about any changes you made to /dev/loop99p3 until you reboot -- so you shouldn't mount it or use it in any way before rebooting. Warning: The kernel was unable to re-read the partition table on /dev/loop99 (Invalid argument). This means Linux won't know anything about the modifications you made until you reboot. You should reboot your computer before doing anything with /dev/loop99.
Okay, since I don't want to reboot, this is not an option.Maybe we need to setup the loop, but with an offset to the partition I need.
Since the sector size is 512 bytes and I start at 64260, my offset will be: 512 * 64260 = 32901120. Why do I start at 64260, since I guess partition one is the /boot partition.
[root@pts05 tools]# losetup /dev/loop98 /OVS/running_pool/gridnode01/System.img -o 32901120 [root@pts05 tools]# losetup -a | grep offset /dev/loop98: [0811]:6127628 (/OVS/running_pool/gridnode01/System.img), offset 32901120
Yes, there it is ! Mounting is easy now !
[root@pts05 p]# mkdir /tmp/p; mount /dev/loop98 /tmp/p/ [root@pts05 p]# df -m | loop98 /dev/loop98 4013 2071 1901 53% /tmp/p [root@pts05 p]# ls -l /tmp/p/ total 196 drwxr-xr-x 2 root root 4096 Sep 3 00:03 bin drwxr-xr-x 2 root root 4096 Mar 25 05:44 boot drwxr-xr-x 2 root root 4096 Sep 4 09:58 crs drwxr-xr-x 2 root root 4096 Apr 10 07:14 dev drwxr-xr-x 96 root root 12288 Sep 10 07:03 etc drwxr-xr-x 4 root root 4096 Sep 8 21:30 home drwxr-xr-x 13 root root 4096 Sep 3 00:03 lib drwx------ 2 root root 16384 Mar 25 05:44 lost+found drwxr-xr-x 2 root root 4096 Jan 9 2009 media drwxr-xr-x 2 root root 4096 Jan 21 2009 misc drwxr-xr-x 3 root root 4096 Sep 4 09:40 mnt dr-xr-xr-x 2 root root 4096 Sep 8 21:22 net drwxr-xr-x 4 root root 4096 Sep 9 22:03 opt drwxr-xr-x 2 root root 4096 Mar 25 05:44 proc drwxr-x--- 2 root root 4096 Sep 8 22:30 root drwxr-xr-x 2 root root 12288 Sep 9 22:05 sbin drwxr-xr-x 2 root root 4096 Mar 25 05:44 selinux drwxr-xr-x 2 root root 4096 Jan 9 2009 srv drwxr-xr-x 2 root root 4096 Mar 25 05:44 sys drwxr-xr-x 3 root root 4096 Apr 10 07:03 tftpboot drwxrwxrwt 17 root root 4096 Sep 10 14:57 tmp drwxr-xr-x 2 root root 4096 Sep 2 22:13 u01 drwxr-xr-x 14 root root 4096 Apr 10 07:03 usr drwxr-xr-x 21 root root 4096 Apr 10 07:05 var
Rene Kundersma
Oracle Technology Services, The Netherlands