[wplug] Looking for a way to work with disk images

Chad Ziccardi cz at digitalfreaks.org
Thu Dec 8 19:33:17 EST 2005


On Thu, 2005-12-08 at 15:46 -0500, Bill Moran wrote:
> If I take a disk image, using dd for example:
> 
> dd if=/dev/hd0 of=somefile.img
> 
> On FreeBSD, I can then use mdconfig to create a file in /dev and access
> this image as if it were a real HDD:
> 
> mdconfig -a -t vnode -f somefile.img -u 4
> fdisk /dev/md4
> 
> (i.e. mdconfig creates /dev/md4, which can be accessed as if it were a
> normal hard drive, such as /dev/ad0 or /dev/da0)
> 
> I know there's a similar set of tools for doing this kind of thing on
> Linux, but my memory fails me as to the exact tools.  Any pointers
> would be gratefully welcome.

I think losetup is what you want.

man losetup

losetup /dev/loop0 /path/to/somefile.img
fdisk /dev/loop0



-- 
Chad Ziccardi, Professional Slacker          cz at digitalfreaks.org
"Some cause happiness wherever they go; others whenever they go."




More information about the wplug mailing list