LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-31-2016, 12:40 PM   #1
snowmagician
Member
 
Registered: Sep 2016
Distribution: Kubuntu
Posts: 62

Rep: Reputation: Disabled
Question How to mount the file image.dd


I was able to rescue the partition with the testdisk utility on Knoppix, and it did give me a file named image.dd and its size is roughly 350 GB

How do I mount it so I can access the files inside the image.dd? I notice there are two commands I can use - kpartx and losetup but not sure which command to use. It appears kpartx will use losetup if necessary

Last edited by snowmagician; 12-31-2016 at 12:43 PM.
 
Old 12-31-2016, 12:56 PM   #2
ugjka
Member
 
Registered: May 2015
Location: Latvia
Distribution: Arch, Centos
Posts: 368
Blog Entries: 5

Rep: Reputation: 264Reputation: 264Reputation: 264
try plain mount /path/to/image destination/
 
Old 12-31-2016, 02:17 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,792

Rep: Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220
It depends on what you actually saved. If it was the complete partitioned disk, then you need to run "kpartx -av /path/to/image.dd" to get the internal partitions mapped as devices under /dev/mapper. Then you can mount those just like any other device. If it was just the one partition, then you do not use kpartx, and you need to use the "--loop" option on the mount command
Code:
mount -o loop /path/to/image.dd /path/to/mount/point
 
Old 01-01-2017, 02:47 AM   #4
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Just to add, although the OP mentioned just a partition image, for a full disk image you need to find the offset of the partition to specify where on the disk image is the start of the partition you want to mount as in the example below, in case you want to mount all partitions and not extract them.
Code:
STEPS FOR MOUNTING PARTITION OF IMAGE.DD FILE FROM IN SAME DIRECTORY AS ROOT OR SUDO:

1: mkdir /mnt/image
2: sfdisk -l -uS image.dd
3: mount -oloop,offset=32256 image.dd /mnt/image

OFFSET = Sectors offset of beginning sector of partition multiplied by 512, in this case the first partition starts at offset 63.

Last edited by Brains; 01-01-2017 at 02:50 AM.
 
Old 01-01-2017, 08:50 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,792

Rep: Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220Reputation: 2220
Quote:
Originally Posted by Brains View Post
Just to add, although the OP mentioned just a partition image, for a full disk image you need to find the offset of the partition to specify where on the disk image is the start of the partition you want to mount
You can do it that way, or you can let kpartx parse the partition table and create /dev/mapper devices for each of the partitions in the image.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount image file of a partition ViniciusBorges Linux - Hardware 2 09-18-2014 07:09 PM
[SOLVED] cannot mount an image file cccc Debian 3 06-08-2013 08:14 PM
how to mount a kvm image file hrmb Linux - Virtualization and Cloud 5 02-11-2010 10:06 AM
can't mount the iso image file gbstack Linux - Newbie 3 09-06-2008 10:16 AM
mount .iso (image) file and read *.avi file smartdragonfly Linux - Software 2 12-21-2006 04:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:46 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