LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-24-2016, 10:55 PM   #1
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Rep: Reputation: 15
how do I mount this .img file that might be corrupted.


fdisk -l my_file.img

Disk my_file.img: 2040 MB, 2040258560 bytes
255 heads, 63 sectors/track, 248 cylinders, total 3984880 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk my_file.img doesn't contain a valid partition table

=========================================================
what parameter I should use in my mount command to mount this .img file?

mount -o loop,offset=xxx my_file.img /mnt/tmp? what offset I should use to bypass the corrupted or nonexistent partition table?
 
Old 08-24-2016, 11:10 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,970

Rep: Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633
Why did you start a new thread ?. With no background info.
 
Old 08-25-2016, 12:21 AM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,531

Rep: Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622Reputation: 2622
did you or did you NOT use -loop
you do not say
 
Old 08-25-2016, 03:05 AM   #4
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Original Poster
Rep: Reputation: 15
what type of filesystem it is? from the fdisk -l I couldn't tell.
 
Old 08-25-2016, 03:05 AM   #5
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by John VV View Post
did you or did you NOT use -loop
you do not say
I put -loop there
 
Old 08-25-2016, 03:10 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,981

Rep: Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734
Quote:
what offset I should use to bypass the corrupted or nonexistent partition table?
You can mount only valid filesystems, offset should point to the beginning of a real filesystem.
But actually you do not need partition table, so
Quote:
Disk my_file.img doesn't contain a valid partition table
is not an error message, just information. fdisk unable to print partition table, because it does not exist.

what will file image.img respond?
 
Old 08-25-2016, 07:00 AM   #7
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920Reputation: 2920
Assuming that the image file contains an extn filesystem, what does e2fsck -f my_file.img produce?
 
Old 08-25-2016, 08:34 AM   #8
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 948

Rep: Reputation: 216Reputation: 216Reputation: 216
What do you expect the img file to contain?

OK
 
Old 08-25-2016, 11:42 AM   #9
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by hydrurga View Post
Assuming that the image file contains an extn filesystem, what does e2fsck -f my_file.img produce?
too many prompts.

sudo e2fsck -f my_file.img
[sudo] password for lilzz:
e2fsck 1.42.9 (4-Feb-2014)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
Error reading block 6324224 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes
Force rewrite<y>? yes
Superblock has an invalid journal (inode 8).
Clear<y>? yes
*** ext3 journal has been deleted - filesystem is now ext2 only ***

Superblock has_journal flag is clear, but a journal inode is present.
Clear<y>? yes
The filesystem size (according to the superblock) is 14338560 blocks
The physical size of the device is 498110 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no
Error reading block 6815744 (Attempt to read block from filesystem resulted in short read) while reading inode and block bitmaps. Ignore error<y>? yes
Force rewrite<y>?
 
Old 08-25-2016, 11:59 AM   #10
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
What is in the image? Bare filesystem or is it partitioned? You are working on a copy of it, right?
 
Old 08-26-2016, 12:35 PM   #11
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Emerson View Post
What is in the image? Bare filesystem or is it partitioned? You are working on a copy of it, right?
e.

yes, I use dd to output that to an image.

It's an image copy of my bad linux harddrive. It's not a bare file system. It has OS, data, and all the other stuffs .
I only want to recover my data.

Now I use a healthy system to work on it.
 
Old 08-26-2016, 01:51 PM   #12
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
Quote:
Originally Posted by lilzz View Post
e.

yes, I use dd to output that to an image.

It's an image copy of my bad linux harddrive. It's not a bare file system. It has OS, data, and all the other stuffs .
I only want to recover my data.

Now I use a healthy system to work on it.
OK, so you have the image of whole harddrive. Why are you running fsck on whole image then? You should run fcsk on the filesystem you want to repair. BTW, the tool for imaging damaged drives is ddrescue.
 
Old 08-26-2016, 07:19 PM   #13
lilzz
Member
 
Registered: Aug 2006
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Emerson View Post
OK, so you have the image of whole harddrive. Why are you running fsck on whole image then? You should run fcsk on the filesystem you want to repair. BTW, the tool for imaging damaged drives is ddrescue.

Can you give an example of that?
let's say I put back my bad harddrive and I use LiveCD to boot up.
The bad harddrive is /dev/sda1

How to run fsck for the files I want? Do I need to remember all the filenames or folder names?

and which step I use fsck, and which step I use ddrescue?
 
Old 08-27-2016, 03:57 AM   #14
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,981

Rep: Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734Reputation: 5734
first you need to find the partition table on that drive and locate the partitions. Probably gparted can do that for you. as far as I know gparted will not work on the .img file (as a device), but you can try to find the partitions inside the img file too. Next you need to find the offset of the filesystems in it and that offset can be used by mount. fsck runs on filesystems, not on files.
http://unix.stackexchange.com/questi...e-and-mount-it
 
Old 08-27-2016, 06:10 AM   #15
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
fdisk will work on image, so will file utility. You could dump a new image with ddrescue of sda1, not sda. Image of sda1 will be filesystem only, without partition table.
 
  


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
[SOLVED] how to mount .img file linuxboy2008 Linux - General 15 10-29-2018 11:17 PM
[SOLVED] How to mount DOS img file? kaza Linux - Software 14 01-23-2017 06:14 PM
Mount a .img file chaz_d Linux - General 3 09-26-2012 07:46 PM
[SOLVED] Mounting .img file (chromiumos.img); can't mount it?? Help please? linus72 Linux - General 2 11-27-2009 08:11 PM
Mount *.img file - What fs type tobiasw Linux - General 14 10-17-2006 03:43 PM

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

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