LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2006, 03:00 PM   #1
sancho
Member
 
Registered: Sep 2003
Distribution: Ubuntu 9.04/9.10 (64-bit)
Posts: 149

Rep: Reputation: 15
Mount a full drive image?


I recently did a complete drive image of a hard drive (which contained 4 partitions) using a command similar to "dd if=/dev/hda of=/imagefile". The command eventually completed successfully and now I've got a huge "/imagefile" of the entire drive.

I know that when you create an image file of a single partition (i.e. "dd if=/dev/hda1 of=/firstpartition"), you can mount that file as though it were the original block device using a loopback mechanism. However, I've created an image file that encompasses several partitions.

Is it possible for me to mount individual partitions off of this single image file? If so, how?

Thanks.
 
Old 01-16-2006, 12:41 AM   #2
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
You first need to determine the byte offset of the partition you want to mount. To do this, as root, attach your disk image to a loopback device (like /dev/loop0), print the partition table, and then detach the loopback device.

Code:
losetup /dev/loop0 /path/to/diskimage
fdisk -l /dev/loop0
losetup -d /dev/loop0
(NOTE: You need an unused loopback device for this, so if /dev/loop0 is being used, and you want to quickly find an unused loopback device, run losetup -f)

Next, find the partition you want to mount in the partition table that was printed, and multiply the starting number by the unit size in bytes (which should also have been printed in the same listing, towards the top). After that, all you need to do is mount it as you would any partition image, but also specifying the offset that you just calculated.

Code:
mount -o loop,offset=OFFSET_IN_BYTES /path/to/mountpoint
This is all based on a FAQ that I found on google:
http://www.mega-tokyo.com/osfaq2/ind...0Under%20Linux

But I think these steps are a bit easier to follow, and more specific.
 
Old 01-17-2006, 09:39 PM   #3
sancho
Member
 
Registered: Sep 2003
Distribution: Ubuntu 9.04/9.10 (64-bit)
Posts: 149

Original Poster
Rep: Reputation: 15
zhang,

Sounds good to me; I'll have to try that out once I have access to my server again. Thanks!
 
Old 01-17-2006, 10:34 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
If you do a complete image of the drive, then you should have partition table and everything. For example, if /dev/hda has 4 partitions---hda1 thru hda4, and you image the whole drive, it should show up as---eg---/dev/hdb1 thru /dev/hdb4

If you imaged to a file, then you can dump the image back to a drive.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount usb drive, umount and mount another drive arubin Linux - Hardware 9 01-17-2007 03:46 AM
hard drive failing, how can I create an image of my drive? oily_rags SUSE / openSUSE 6 07-07-2005 02:19 PM
Anyone know how to mount a hard drive image? redhatman Linux - Newbie 5 08-11-2004 04:41 PM
Gqview can't full screen an image flubber Linux - Software 1 04-04-2004 07:23 AM
What fstab mount setting do you use to get full access to a vfat drive? BarkingBonefish Linux - Newbie 4 03-12-2004 12:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:37 AM.

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