LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] loopback partition tables ?

[ILUG] loopback partition tables ?

Padraig Brady padraig at antefacto.com
Thu Nov 22 13:59:13 GMT 2001


John P. Looney wrote:

>  If I have a disk image on disk, can I mount partitions inside that disk
> image, loopback ? I can mount partition images no problems....just
> wondering is there wierd magic I could do to make it work.
> 
> Kate


Use gpart to find the partition offsets:

An example:

Say you have a 32MB disk image with a given geometry,
the following (non obvious) gpart command shows the
appropriate info:

gpart -vgd -C 31,32,63 sentinel.img

This will print info like:

Primary partition(1)
    type: 131(0x83)(Linux ext2 filesystem)
    size: 2mb #s(4576) s(32-4607)
    chs:  (0/1/1)-(8/15/32)d (0/0/33)-(2/9/9)r
    hex:  00 01 01 00 83 0F 20 08 20 00 00 00 E0 11 00 00

Primary partition(2)
    type: 131(0x83)(Linux ext2 filesystem)
    size: 28mb #s(58368) s(4608-62975)
    chs:  (9/0/1)-(122/15/32)d (2/9/10)-(31/7/39)r
    hex:  00 00 01 09 83 0F 20 7A 00 12 00 00 00 E4 00 00

The pertinent info here is s(32-4607) and s(4608-62975).
This means that partition 1 starts @ block 32 and partition 2
@ block 4608. The blocks are 512 bytes so the offset in bytes
for partitions 1 & 2 is: 16384 & 2359296.

These are the 2 bits of info required for the mount command,
so to mount the image you would do:

mkdir par1 par2
mount -t ext2 -o loop,offset=16384,ro sentinel.img par1
mount -t ext2 -o loop,offset=2359296,ro sentinel.img par2

Padraig.





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell