[clug] Reading partition tables via loopback
Tony Breeds
tony at bakeyournoodle.com
Thu Feb 26 22:58:13 GMT 2004
On Fri, Feb 27, 2004 at 09:43:09AM +1100, Darren Freeman wrote:
<snip>
> How do I convince linux to treat a loopback device like a hard disc, and
> probe for partitions? As in I have my image mounted as /dev/loop6 and
> was hoping to see stuff like /dev/loop61 /dev/loop62 etc. with my
> partitions. Unfortunately it didn't happen automagically, is there a way
> to force/trick this to happen?
You can't the loop block devices doesn't support partitions nor does it
have minor numbers for this purpose.
> Any other ideas? Hopefully I don't need to parse the DOS partition table
> and determine the offset into the partitions. This would work though
> since losetup accepts an offset.
You can mount the img file and then run fdisk -l on it to calculate the
offsets for you. At least this way you don't need to manually parse the
partition table.
You could always write your own block device based on loop.c :)
Yours Tony
linux.conf.au http://lca2005.linux.org.au/
Apr 18-23 2005 The Australian Linux Technical Conference!
More information about the linux
mailing list