Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-22-2011, 10:04 AM   #1
LQ Newbie
Registered: Aug 2011
Distribution: Gentoo, Debian, RHEL
Posts: 12

Rep: Reputation: Disabled
Mounting partitions contained within a raw disk image

I am wondering if anyone knows a quick way to mount partitions contained within a raw, complete disk image. (i.e. created by dd -if /dev/sdX) I try to avoid creating these for obvious reasons, but when the situation requires it being able to loop mount partitions within the image would be a handy tool. Since the image is complete and raw it contains the MBR ant partition table, so I cannot just "mount -o loop /file/image /mnt/point" and have it work.

I currently know of two solutions:

1) Pull the partition table out of the image, dd the partition I want to a new file, and mount that. I don't like this option because it requires enough disk to create a whole new file, and requires the copy time to make it.

2) Route the image through AoE so the kernel will create partition devices on the AoE nodes. This works well, but requires AoE support.

Does anyone know of a third option? I'm hoping for an option that creates dev (or comparable) nodes like AoE, but doesn't require looping the data through the network stack.

Last edited by TJNII; 08-22-2011 at 10:21 AM.
Old 08-22-2011, 10:39 AM   #2
Registered: Aug 2002
Posts: 16,025

Rep: Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850Reputation: 1850
Yes by adding an offset option like:
Old 08-22-2011, 10:53 AM   #3
LQ Newbie
Registered: Aug 2011
Distribution: Gentoo, Debian, RHEL
Posts: 12

Original Poster
Rep: Reputation: Disabled
That answers the question main question, thanks.

However, it brings another: the blog says you can use kpartx for this but doesn't give details. Kpartx didn't have any effect when I tried it, and when I tried fdisk against a loop device node I got an invalid argument error. According to the link a discontinued patch is required to make loop devices work this way. Does anyone know how to use kpartx for this on a modern system, or will it no longer work? This is more idle curiosity now as the "mount -o offset" method in the above links will also do what I want.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] partitions within raw image; how to access those? Ramurd Slackware 4 05-13-2011 05:45 AM
Mounting/accessing individual partitions within a dd image? jessica6 Linux - General 5 07-30-2009 05:01 PM
Regarding Creation of Bootable ISO of hard disk image having multiple partitions.. nagamohan_p Programming 1 08-25-2006 09:11 AM
problem mounting a disk image zero79 Debian 2 05-03-2005 02:15 PM
auto mounting of hard disk partitions rm1 Programming 3 11-08-2004 09:04 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration