LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2006, 05:42 AM   #1
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Rep: Reputation: 15
Mount *.img file - What fs type


Hello,
Im trying to mount a img file on my Fedora linux distribution. Is there a command to find out what fs the img file is. Because im trying to mount the img file and the only fs what works is tmpfs, debugfs and proc. But the files in the mount directory are useless.

Here is what I tried:

#mount -o loop r2.img testdir
#mount -o loop -t debugfs r2.img testdir
#mount -o loop -t ext2,...

Thanks and regards
Tobias
 
Old 10-17-2006, 06:02 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Most of the time *img's are iso's, try using -t iso9660

Hope this helps.
 
Old 10-17-2006, 06:19 AM   #3
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
No luck.. its not mounting with iso9660,
i tried also with CD-Burner tools.. What possibilities exist to create a img File? My "pc" what i am working with have two img files , the first one (r1.img) i can mount with ext3, in this image i find startup files like grub, bzImage. The other image file r2.img I cannot mount. I tried to unzip the file too, but I get the message: r2.img not in gzip format.
Any Suggestions?


Thanks and regards
Tobias

Last edited by tobiasw; 10-17-2006 at 06:42 AM.
 
Old 10-17-2006, 06:58 AM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
try
Code:
file r2.img
to see what kind of file it is.
 
Old 10-17-2006, 07:26 AM   #5
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
Thank you very much!

By typing "file r2.img"

I get:
r2.img: Squashfs filesystem, little endian, version 2.0 ...

I also can mount it then with squashfs:
mount -o loop -t squashfs r2.img testdir

But when I change, or try to create a file in this image, it gives me the Error message: (i did cp xxx.sh test.sh)

cp: cannot create regular fiel 'test.sh': Read-only file system.

Does anybody know how to change a file in this image?


Thanks and regards
Tobias
 
Old 10-17-2006, 07:31 AM   #6
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
I don't know if this'll work, but when you mount it, if you do so with read-write permissions, perhaps you'll be able to modify it:
Code:
mount -o loop,rw -t squashfs r2.img testdir
I'm not at a linux machine, so I can't test that to see if it's right, but I think it is...

edit: your cp command is trying to copy xxx.sh to the current directory, which is presumably in the mounted image, in which case cp xxx.sh ~/test.sh will copy (and rename it to test.sh) into your home directory, if all you want to do is modify it. If not, the above should work. Again, I've not tried this, so I'm not sure.

Last edited by pwc101; 10-17-2006 at 07:34 AM.
 
Old 10-17-2006, 07:39 AM   #7
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
No, with this option I still cannot create a file in the image. For example if I try to create a directory, I get the error message:
mkdir: cannot create directory 'test': Read-only file system


Thanks and regards
Tobias
 
Old 10-17-2006, 07:45 AM   #8
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
hmmm... don't know then... sorry

unless you extract all the contents to a temp directory, and then remake the img file afterwards...?
 
Old 10-17-2006, 07:48 AM   #9
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
... Good Idea..

How can I do this?
Is it afterwards the same img?
 
Old 10-17-2006, 07:49 AM   #10
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
squashfs is not designed to be modified. If you want to add a file to a squashfs, I think you have to extract the existing files to a regular filesystem, add your new file, and use the mksquashfs tool to generate a new .img file containing the old files and your new file.

See the squashfs howto for more info.
 
Old 10-17-2006, 08:16 AM   #11
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
Quote:
Originally Posted by tobiasw
... Good Idea..

How can I do this?
Is it afterwards the same img?
No... it'll have a different amount of bits depending on what you edited...

What exactly are you trying to do?
 
Old 10-17-2006, 09:03 AM   #12
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
Its an Internet Terminal, and I want to change some content of it...

Is there an easy way to install squashfs tool, it seems to be very advanced to install, like recompile kernel.. .

Thanks and regards

Tobias
 
Old 10-17-2006, 09:25 AM   #13
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
I think you'd only need to install it if you wanted to create a new squashfs file afterwards. If you just wanted to stick it on a CD, I presume you could extract the contents using the cp command and then remake an iso from the extracted files.

I'd try running
Code:
yum search squashfs
to see if you've got anthing in your repositories that'll install it for you. It's been a while since I used fedora and yum, so that command might not be correct.
 
Old 10-17-2006, 02:53 PM   #14
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
Hello,

I mounted now the r2.img in testdir, then copied the content with cp * -r in a new directory, changed the files and then created with
mksquashfs a new img file. Then I copied the img files to the Terminal, but after a while a get following error message:

SQUASHFS error: Unable to read page, block baa198b, size 97a7
Zlib_fs returned unexpected result 0xfffffffd
request module: runaway loop modeprobe binfmt_0000

What I did:
Code:
mount -o loop -t squashfs old.img tmpold
cd /tmpold
cp * -r ../test
cd ../test
mksquashfs etc home opt .. /home/new.img

mksquashfs version: 2.1R
Old files used version 2.0





Many thanks

Tobias
 
Old 10-17-2006, 03:43 PM   #15
Freex
LQ Newbie
 
Registered: Oct 2006
Location: Belgium, Europe
Distribution: OpenSUSE 11.3 KDE, PCLinuxOS 2010 KDE
Posts: 29

Rep: Reputation: 17
Can you clarify at what stage it goes wrong: The copying, the changing of the files or the creation of the new image?

aren't you supposed to put 'cp -r * <folder>' instead of 'cp * -r <folder>'? Also note that "if any directories are created by the cp command during the copying process, the newly created directory will have the same mode as the corresponding source directory." This means that if you use cp to make a new directory and the directory you copy from is read-only, the destination directory will also be read only, you have to do some chmod stuff to change that
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount: unknown filesystem type 'ntfs' when trying to mount windows drive... DiZASTiX Linux - Hardware 12 09-28-2008 07:29 PM
fdisk and mount dont agree on file system type (fat32 vs. ntfs) schneidz Linux - Software 4 07-20-2006 11:17 AM
Mount initrd.img? sti2envy Linux - General 3 02-12-2006 08:53 PM
can mount C not D FAT: invalid media value (0x45) mount: wrong fs type, bad option Emmanuel_uk Linux - Newbie 10 11-29-2005 02:47 AM
automount: mount(generic): failed to mount (null) (type iso9660) on /mnt/media/ vasudevadas Slackware 5 10-17-2005 03:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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