Jump to content

How do I write in an iso image?


MottS
 Share

Recommended Posts

Hi

 

I'm trying to add a file to a .iso image. I mounted it with

mount -t iso9660 -o loop -rw /path/to/image.iso /mnt/Iso

But I get the following when trying to move a file in it.. look:

root@localhost Distro # cp atk-1.2.2.tar.bz2 /mnt/Iso

cp: cannot create regular file `/mnt/Iso/atk-1.2.2.tar.bz2': Read-only file system

How could I write in it?

 

Thx

 

MOttS

Link to comment
Share on other sites

For what I've read, the iso9660 doesn't support a write mode. It used to way back in older kernels. I'm not 100% positive though, there may be a way..

 

An alternative is to mount the loop, cp the files to a rw file system and then make a new iso based on that.. more work but will work..

Link to comment
Share on other sites

Thx for the reply cannonfodder.

An alternative is to mount the loop, cp the files to a rw file system and then make a new iso based on that.. more work but will work..

I already tried that but I don't get the same md5sum. Let me show you what I did:

gd@localhost Distro $ mount -t iso9660 -o loop MandrakeLinux-9.1rc2-CD1.i586.iso /mnt/cd1

gd@localhost Distro $ mkdir cd1

gd@localhost Distro $ cp -a /mnt/cd1/ cd1

gd@localhost Distro $ mkisofs -RJ -o cd1.iso cd1/cd1

gd@localhost Distro $ md5sum MandrakeLinux-9.1rc2-CD1.i586.iso cd1.iso

342862f7a2da34b6d9d772d6bdf91b4d  MandrakeLinux-9.1rc2-CD1.i586.iso

292c3a1384787cccc6b6e1c64ad1a7f1  cd1.iso

gd@localhost Distro # ls -l

...

-rwxrwxrwx    1 root     root     682131456 Mar  4 10:51 MandrakeLinux-9.1rc2-CD1.i586.iso

-rwxrwxrwx    1 root     root     682131456 Mar  5 10:32 cd1.iso

...

In real words I mounted the image, copy the stuff of that image into a dir and made an image of that dir. However, even though the image size of the images are the same, their md5sum aren't. There must be some stuff that haven't been copied into cd1 dir... What am i missing here ?

 

Is IsoBuster in windows can modify iso images btw ?

 

MOttS

Link to comment
Share on other sites

There is a nohide option mentioned in the man mount although I'm not sure how to use it. Maybe there are some hidden files. Another possibility is that you are making your iso differently than they did (perhaps different options) that alters the final contents. The real question is are the the same byte for byte. In terms of size, they seem to have the same number of bytes.. Must be a way to compare two directories byte by byte and list differences (diff?)

Link to comment
Share on other sites

same size wouldn't make a bit of difference in the md5sum actually, you can check with something like this:

 

terry@linux:/home/terry$ touch a.txt b.text; echo "a" > a.txt; echo "b" > b.txt

terry@linux:/home/terry$ root@linux:/home/terry# md5sum a.txt b.txt 

60b725f10c9c85c70d97880dfe8191b3  a.txt

3b5d5c3712955042212316173ccf37be  b.txt

 

and you would use diff:

terry@linux:/home/terry$ diff a.txt b.txt 

1c1

< a

---

> b

 

 

This is from The Linux Cookbook:

 

9.4.2 Finding the Differences between Files

 

Use diff to compare two files and output a difference report (sometimes called a "diff") containing the text that differs between two files. The difference report is formatted so that other tools (namely, patch---see section Patching a File with a Difference Report) can use it to make a file identical to the one it was compared with.

 

To compare two files and output a difference report, give their names as arguments to diff.

 

    * To compare the files `manuscript.old' and `manuscript.new', type:

 

     

 

$ diff manuscript.old manuscript.new RET

 

The difference report is output to standard output; to save it to a file, redirect the output to the file to save to:

 

 

 

$ diff manuscript.old manuscript.new > manuscript.diff RET

 

In the preceding example, the difference report is saved to a file called `manuscript.diff'.

 

The difference report is meant to be used with commands such as patch, in order to apply the differences to a file. See Info file `diff.info', node `Top', for more information on diff and the format of its output.

 

To better see the difference between two files, use sdiff instead of diff; instead of giving a difference report, it outputs the files in two columns, side by side, separated by spaces. Lines that differ in the files are separated by `|'; lines that appear only in the first file end with a `<', and lines that appear only in the second file are preceded with a `>'.

 

    * To peruse the files `laurel' and `hardy' side by side on the screen, with any differences indicated between columns, type:

 

     

 

$ sdiff laurel hardy | less RET

 

To output the difference between three separate files, use diff3.

 

    * To output a difference report for files `larry', `curly', and `moe', and output it in a file called `stooges', type:

 

     

 

$ diff3 larry curly moe > stooges RET

 

There is also cmp:

terry@linux:/home/terry$ cmp a.txt b.txt 

a.txt b.txt differ: byte 1, line 1

Link to comment
Share on other sites

Hey !

 

Thank you much guys.. I'm gonna try the 'diff' command tonight with some other options to make an iso out of the copied directory.

 

I'm just trying to add a file to an iso image!!! wtf!!! I remember having done that with IsoBuster in my windows days.. or was I too drunk ? :)

 

anyway

 

MOttS

Link to comment
Share on other sites

About the images not having the same checksum: did you put the same title and other info in the .iso that you made?

If not, sure it's different; they don't have the exact same info.

 

Mandrake puts something like: Mandrake cd x and some other stuff in the publisher/edition headers of the iso.

 

Use for instance gcombust to read the iso info ('read info' after selecting the iso)...

Link to comment
Share on other sites

Well thanks guys..

 

I finally by-pass the problem. I wanted to add 2 folders (RPM2 and RPM3) to iso #1 of MDK 9.1RC2 so that I could install form the hard drive only with that image. I needed to do that because the MDK installed does not ask for the path of the other iso image when we install from the hard drive. It only ask for the path of the first iso and we can't use the other 2. So I did a minimum install (about 175 MB of stuff is installed .. IceWM included) and everything went well.. no package error or other. Once rebooted into IceWM I mounted the three images, modified fstab and urpmi. I've then be able to install other packages from cd2 and 3.

 

aRTee, I was not using any GUI.. plain 'mount' and 'mkisofs'. I never used gcombust.

 

I'm still thinking we can write to iso images in windows with IsoBuster. Sad I don't have access to a win box so that I can check.... Anyone ?

 

MOttS

Link to comment
Share on other sites

aRTee, I was not using any GUI.. plain 'mount' and 'mkisofs'. I never used gcombust.

Wisea$$! ;)

 

Ok, command line cowboys, in that case: try a man mkisofs, and check for the -A switch:

-A application_id

             Specifies a text string that will be  written  into  the  volume

             header.   This  should  describe the application that will be on

             the disc.  There is space on the  disc  for  128  characters  of

             information.   This  parameter  can  also  be  set  in  the file

             .mkisofsrc with APPI=id.  If specified in both places, the  com-

             mand line version is used.

 

Did you use this, with the correct info that was in the original iso?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...