LinuxQuestions.org
Help answer threads with 0 replies.
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 12-19-2009, 02:47 PM   #1
mtb
Member
 
Registered: Nov 2002
Location: Italy
Distribution: Linux Mint 17 Xfce
Posts: 295

Rep: Reputation: 30
Mounting a single fat32 partition inside a full disc image


I have recovered a whole dying hard drive using the command ddrescue, only 8192 byte out of 4.3 gigabyte are unreadable.

I have used the command (gnu) ddrescue /dev/sdb DiskImage.img

But unfortunatly this way i have a full-disk image that is not mountable... ( or at least i don't know how to mount it ), and the disk doesn't seem to work anymore that good... ( crack crack crack... ).

To see the partitions inside the "big" file, i have used fdisk -l, and damn there is only one partition, but how can i mount the content???

Code:
$ fdisk -l DiskImage.img
 
Si devono impostare cilindri.
È possibile effettuare questa operazione dal menu delle funzioni supplementari.

Disco DiscoF.img: 0 MB, 0 byte
255 heads, 63 sectors/track, 0 cylinders
Units = cilindri of 16065 * 512 = 8225280 bytes
Disk identifier: 0x3cfc3cfb

Dispositivo Boot      Start         End      Blocks   Id  System
DiscoF.img1   *           1         523     4200966    b  W95 FAT32


I know i could use photorec foremost or similar software, but since the disc image is almost perfect, i would be able to preserve file names, paths and dates...

The last idea would be to mount it as a full-drive image with Virtualbox... But transferring data would be quite annoying.

Thank you in advance.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-19-2009, 03:00 PM   #2
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
maybe kpartx can be used?

kpartx can mount partitioned virtual hard drives,etc
http://panoskrt.wordpress.com/2009/0...in-image-file/

http://www.forensicswiki.org/wiki/Mounting_Disk_Images

hope that helps some?
 
Old 12-19-2009, 03:07 PM   #3
mtb
Member
 
Registered: Nov 2002
Location: Italy
Distribution: Linux Mint 17 Xfce
Posts: 295

Original Poster
Rep: Reputation: 30
Great!!!

Thank you!

Unfortunatly kpartx for ubuntu 8.04 seems broken, but i'm launching the laptop with 9.04 and i hope it will work!
 
Old 12-19-2009, 03:09 PM   #4
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
I used it in 9.04
it works for me

course I'm just trying to mount partitioned qemu img's
 
Old 12-19-2009, 03:19 PM   #5
mtb
Member
 
Registered: Nov 2002
Location: Italy
Distribution: Linux Mint 17 Xfce
Posts: 295

Original Poster
Rep: Reputation: 30
Perfect! Thank you again.

By the way, works after a reboot even with 8.04 lts.
 
Old 12-19-2009, 03:23 PM   #6
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
what works after reboot?
did you fix it already?
OH- you mean kpartx?
 
Old 12-19-2009, 04:57 PM   #7
mtb
Member
 
Registered: Nov 2002
Location: Italy
Distribution: Linux Mint 17 Xfce
Posts: 295

Original Poster
Rep: Reputation: 30
kpartx avaible from ubuntu 8.04 repositories works after reboot.

I did everything i needed!
 
Old 12-19-2009, 05:56 PM   #8
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
then mark the thread as solved!
go to your first post, select thread tools/mark as solved from right hand corner^

so it worked OK or what?
If you wanna help out others who read this
Please explain what you did?
 
Old 12-20-2009, 02:20 AM   #9
mtb
Member
 
Registered: Nov 2002
Location: Italy
Distribution: Linux Mint 17 Xfce
Posts: 295

Original Poster
Rep: Reputation: 30
You're right:

I did as root:
Code:
#kpartx -a DiskImage.img
gpt: 0 slices
dos: 4 slices

in order to  add partition devmappings

#kpartx -l DiskImage.img
gpt: 0 slices
dos: 4 slices
loop0p1 : 0 8401932 /dev/loop0 63
And i copied the loop name ( loop1p1 )

Then i did:

mount -o ro /dev/mapper/loop1p1 /mnt/recovery

And copied the whole content from /mnt/recovery

It worked perfectly.

After i removed the loop0p1 device with

Code:
#kpartx -d DiskImage.img
gpt: 0 slices
dos: 4 slices
loop deleted : /dev/loop0
 
Old 12-20-2009, 04:33 AM   #10
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Your the Man
Linux rocks huh?
 
Old 12-20-2009, 06:39 AM   #11
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
For the record, to manually mount a partition inside a disk image:

First use...

Code:
fdisk -lu diskimage.iso
...to get the block size and starting block number of the partition you want to mount.

Then mount the device with loopback and an offset option equal to blocksize*startingblock.

You can use bash's built-in arithmetic function to calculate it for you.

If, for example, the blocksize is 512, and the starting block is 40890...

Code:
mount -t auto -o loop,offset=$((40890*512)) /path/to/diskimage.iso /mnt/mountpoint
There may be other ways to do it as well, but this is what I've used in the past.
 
2 members found this post helpful.
  


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
Mounting a FAT32 Partition tsunamikitsune Linux - Newbie 5 02-09-2007 10:49 PM
Mounting FAT32 partition Stable61 *BSD 3 09-17-2006 08:32 AM
how can I mount an fat32 partition with full access for a normal user? (FC5) thefinalxia Linux - Newbie 4 04-10-2006 02:02 AM
Partition mounting/KDE errors after creating Fat32 Partition BertBert Linux - General 1 07-07-2004 10:59 AM
Mounting FAT32 partition? timmyk0 Linux - Newbie 4 09-19-2003 08:22 PM

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

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