Re: accessing loopback filesystem+partitions on a file

Grzegorz Kulewski
2005-06-29T00:42:01Z

On Wed, 29 Jun 2005, Luke Kenneth Casson Leighton wrote:

> [if you are happy to reply at all, please reply cc'd thank you.]
>
> hi,
>
> i'm really sorry to be bothering people on this list but i genuinely
> don't what phrases to google for what i am looking for without getting
> swamped by useless pages, which you will understand why when you see
> the question, below.
>
> the question is, therefore:
>
> * how the hell do you loopback mount (or lvm mount
> or _anything_! something!) partitions that have
> been created in a loopback'd file!!!!
>
> [aside from booting up a second pre-installed xen
> guest domain and making the filesystem-in-a-file
> available as /dev/hdb of course.]
>
> answers of the form "work out where the partitions are, then use
> hexedit to remove the first few blocks" will win no prizes here.

The bad news: it was impossible (or at least very hard to do).

The good news: it is possible now. The anwser is:
- figure where the partitions are (possibly using some simple script),
- use device-mapper to create block devices covering partitions,
- mount them.

I do not know if this anwser will win your price but it is IMHO far better
than hexedit... :-) And probably this is the only anwser.

(IIRC if you have one partition you can skip partition table with offset
option to losetup. But this will only work in this special case...)

Grzegorz Kulewski