LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-13-2013, 03:57 AM   #1
cbtshare
Member
 
Registered: Jul 2009
Posts: 619

Rep: Reputation: 42
help mounting image from .img file


I tried the following , and all worked up until the point where I try to mount,then it give error saying needs to specify FS, but my partition say lvm ,and dont remember what fs I used.

Quote:
file -s /Downloads/usb/backup_set_1.img
/Downloads/usb/backup_set_1.img: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0xb441; partition 1: ID=0x83, active, starthead 1, startsector 63, 211617 sectors; partition 2: ID=0x8e, starthead 0, startsector 211680, 116998560 sectors, code offset 0x48
Code:
parted /Downloads/usb/backup_set_1.img 
GNU Parted 2.1
Using /Downloads/usb/backup_set_1.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit                                                             
Unit?  [compact]? B                                                       
(parted) print                                                            
Model:  (file)
Disk /Downloads/usb/backup_set_1.img: 60011642880B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End           Size          Type     File system  Flags
 1      32256B      108380159B    108347904B    primary               boot
 2      108380160B  60011642879B  59903262720B  primary               lvm
2nd

Code:
 kpartx -a /Downloads/usb/backup_set_1.img 

ll /dev/mapper/
total 0
crw-rw----. 1 root root 10, 58 Oct 13 02:37 control
lrwxrwxrwx. 1 root root      7 Oct 13 02:47 loop0p1 -> ../dm-3
lrwxrwxrwx. 1 root root      7 Oct 13 02:47 loop0p2 -> ../dm-4

mount -o loop /dev/mapper/loop0p2 /mnt/bac/

mount: you must specify the filesystem type

file systems -t ext3/4/2/auto all give errors
Code:
losetup /dev/loop0 /Downloads/usb/backup_set_1.img

mount -o loop /dev/loop0 /mnt/bac/
Code:
fdisk -l /Downloads/usb/backup_set_1.img 
You must set cylinders.
You can do this from the extra functions menu.

Disk /Downloads/usb/backup_set_1.img: 0 MB, 0 bytes
240 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x48d97f5e

                          Device Boot      Start         End      Blocks   Id  System
/Downloads/usb/backup_set_1.img1   *           1          14      105808+  83  Linux
/Downloads/usb/backup_set_1.img2              15        7752    58499280   8e  Linux LVM


mount /Downloads/usb/backup_set_1.img /mnt/bac/ -o loop,offset=$((211680*512))
mount: you must specify the filesystem type
Thank you all for you input

Last edited by cbtshare; 10-13-2013 at 04:07 AM.
 
Old 10-13-2013, 07:00 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
After you ran all necessary commands up to 'kpartx -a /Downloads/usb/backup_set_1.img' your system should already expose a Device-Mapped Physical Volume Group to run 'dmsetup status; pvscan /dev/dm-4' and other pv*/vg*/lv* commands on?
 
Old 10-13-2013, 12:38 PM   #3
cbtshare
Member
 
Registered: Jul 2009
Posts: 619

Original Poster
Rep: Reputation: 42
Thank you uspawn for your input.I ran the following commands
Code:
dmsetup status
VolGroup-lv_swap: 0 6225920 linear 
VolGroup-lv_root: 0 100171776 linear 
loop0p2: 0 116998560 linear 
loop0p1: 0 211617 linear 
VolGroup-lv_home: 0 9781248 linear 
[root@Stainless ~]# pvscan /dev/dm-4
  PV /dev/sdb2   VG VolGroup   lvm2 [55.40 GiB / 0    free]
  Total: 1 [55.40 GiB] / in use: 1 [55.40 GiB] / in no VG: 0 [0   ]
but the issue I am having is,after I normally pvcreate, then add to a vg group and lv create, I then create the file system on the lvm, then mount it. But here I dont know the filesystem again.
 
Old 10-13-2013, 01:40 PM   #4
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 88
You can find the filesystem of a volume with the command sudo file -sL /dev/path_to/volume. If you're not sure of the volume paths, run sudo lvdisplay.
 
Old 10-13-2013, 07:04 PM   #5
WhiteR4VeN
LQ Newbie
 
Registered: Oct 2013
Location: WA
Posts: 9

Rep: Reputation: Disabled
@ cbtshare

Certain img files don't mount like iso files do. You need an extra parameter to the mount command. The offset parameter. The offset parameter is needed for img files.

Code:
mount -o loop,offset=<start of offset number> file.img mountpoint
The code above has worked with img files with normal disk volumes, I never tried this with LVMs but you can try it.

Try this code below with the offset values and see if it works.
Code:
mount -o loop,offset=108380160 /Downloads/usb/backup_set_1.img /mnt/
mount -o loop,offset=32256 /Downloads/usb/backup_set_1.img /mnt/boot
The offset values in bold are from the parted output in post #1 under the Start column.

Last edited by WhiteR4VeN; 10-13-2013 at 07:09 PM.
 
Old 10-13-2013, 07:19 PM   #6
cbtshare
Member
 
Registered: Jul 2009
Posts: 619

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by Robhogg View Post
You can find the filesystem of a volume with the command sudo file -sL /dev/path_to/volume. If you're not sure of the volume paths, run sudo lvdisplay.
It didnt work for me...
Quote:
file -sL /dev/dm-4
/dev/dm-4: data
[root@Stainless ~]# file -sL /dev/dm-3
/dev/dm-3: data
[root@Stainless ~]# file -sL /dev/mapper/loop0p2
/dev/mapper/loop0p2: data
@WhiteR4VeN , if you look at my initial post , I tried the offset method and it didnt work.
Code:
mount /Downloads/usb/backup_set_1.img /mnt/bac/ -o loop,offset=$((211680*512))
mount: you must specify the filesystem type
 
Old 10-14-2013, 12:02 AM   #7
cbtshare
Member
 
Registered: Jul 2009
Posts: 619

Original Poster
Rep: Reputation: 42
Any ideas? I cant find any info on google that helps.
 
  


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] Mounting .img file (chromiumos.img); can't mount it?? Help please? linus72 Linux - General 2 11-27-2009 09:11 PM
how to extract the files from a vfat .img image file, without mounting zoombee Linux - General 13 11-23-2008 06:39 AM
Mounting a .img file? RoaCh Of DisCor Linux - Newbie 2 07-12-2005 03:49 PM
mounting a .img file... username-inuse Linux - Software 3 05-01-2005 03:46 PM
mounting a img file kudos Slackware 2 04-30-2003 03:54 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration