LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-02-2017, 05:45 PM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Slackware,Linux From Scratch
Posts: 545
Blog Entries: 93

Rep: Reputation: 151Reputation: 151
xorriso: how to build an iso image file


I'm trying to create an iso image with xorriso. I am having trouble. Part of the trouble is the man page: I can't wrap my head around it.

What I cannot figure out how to do is to copy from a directory or directories onto a ISO file. The following (these are not the actual commands, I've made them up for clarity) is a specific example of what I want to accomplish:
Code:
xorriso \
 -create_new_image_file /put_it_here/a_dvd_image.iso \
 -straight_iso_9660 \
 -plus_rock_ridge \
 -plus_joliet \
 -add_in_this_directory bubbles \
 -add_in_this_directory bagles \
 -add_in_this_directory stuff \
 -keep-dates-as-is-im-serious-dont-screw-around \
 -volume_name "BUBSTUFF"
Upon completion, the root directory of the iso (if mounted, or after being burned to CD/DVD) would look something like:
Code:
 bagles  bubbles  stuff
How can I do this?

Thank you.

p.s. I've tried the mkisofs compatibility version (xorissofs) and it fails to understand the --graft-points command.
 
Old 08-03-2017, 01:17 AM   #2
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
you should take a look at some of Erics scripts the on in question is the mirrior and build dvd or cdrom or what ever.
http://www.slackware.com/~alien/tools/
you will see the mkisofs comand used at it fullest mirror-slackware-current.sh
you will find it easy
 
Old 08-03-2017, 01:48 AM   #3
scdbackup
Member
 
Registered: Oct 2013
Posts: 155

Rep: Reputation: Disabled
Hi,

-graft-points of the mkisofs emulation works if you
do not write it with double dash (--graft-points).

I would translate your pseudo-code example of a run in xorriso command
language to:
Code:
xorriso \
  -outdev /put_it_here/a_dvd_image.iso -blank as_needed \
  -joliet on \
  -map bubbles /bubbles \
  -map bagles /bagles \
  -map stuff /stuff \
  -volid "BUBSTUFF"
Command -blank "as_needed" enables overwriting of existing ISO file content.
If you want to truncate the file to the length of the new ISO, you have
to delete it by e.g. "rm" before running xorriso.
Rock Ridge is on by default.
ISO 9660 / ECMA-119 cannot be disabled.
File timestamps and permissions are preserved by default.

If this is a backup run, then i would use as first command in the list of
xorriso commands:
Code:
-for_backup
.
It records MD5s which later can be checkread. It also records xattr or ACL
if present on disk, which xorriso later can restore if desired. It marks
hardlink families which xorriso can later restore so they are hardlinks
again.

With a more complicated command list in a run, one would have to keep
in mind that the native xorriso commands are executed in sequence
like shell commands. I.e. you first need to aquire the output drive
(in this case the ISO) and make sure it is empty, to get a loaded empty
ISO model into which you can map files. (You could also remove some
files from the ISO after mapping their directories. Or you could equip
them by content filters for encryption or compression.)


In mkisofs compatibility mode this would be:
Code:
xorrisofs \
  -o /put_it_here/a_dvd_image.iso \
  -R \
  -J \
  -V "BUBSTUFF" \
  -graft-points \
  /bubbles=bubbles \
  /bagles=bagles \
  /stuff=stuff
If the output file already exists, it will be truncated to size 0 before
writing begins.

As with mkisofs, the sequence of options does not matter much. If
you use an option twice, then normally the second one prevails.
(This is easier to grasp than the native commands, but also ambiguous if you
want to make more elaborate ISO manipulations.)


Have a nice day

Thomas
 
Old 08-03-2017, 08:30 AM   #4
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Slackware,Linux From Scratch
Posts: 545

Original Poster
Blog Entries: 93

Rep: Reputation: 151Reputation: 151
@scdbackup

Thank you. That worked (your first command line is what I used).

It had never occured to me that the image file name could be used as the output device.

It is tricky how order matters: putting '-blank "as_needed"' before the -outdev resulted in an error message.

One minor thing: the ownership of the files & directories in the iso was apparently left as the original owner. I remember that mkisofs would change this to a sane or generic value so that whoever mounted the resultant image or CD would see themselves as the owner?

Unless the way I mounted the iso affects the apparent owner & group of files?
Code:
mount -o ro a_dvd_image.iso temp as root
Maybe actually burning the image will tell me more.

I was confused at your mention of backup. My task is to simply take several directories and put them onto a data CD/DVD.

Anyway, again, thanks for the helpful information.

Last edited by jr_bob_dobbs; 08-03-2017 at 08:31 AM.
 
Old 08-03-2017, 10:00 AM   #5
scdbackup
Member
 
Registered: Oct 2013
Posts: 155

Rep: Reputation: Disabled
Hi,

> It had never occured to me that the image file name could be used
> as the output device.

I thought it is easy to use because you can replace the name of
your ISO image by e.g. /dev/sr0 to use optical media directly.

> It is tricky how order matters: putting '-blank "as_needed"' before
> the -outdev resulted in an error message.

Think of xorriso's native commands like of shell commands.
You cannot erase all files in a filesystem before you mounted it.

Sequential command execution is necessary to express image manipulations
unambiguously. It matters whether you remove a directory before or
after you give a command that creates it with some files in it.

Said this, there is option -x which, if among the xorriso commands, causes
automatic command sorting according to the list which you can get by
Code:
xorriso -list_arg_sorting
> One minor thing: the ownership of the files & directories in the iso
> was apparently left as the original owner.

One would not want that for backups which shall be able to restore as
much as possible of the original files, if needed.

> I remember that mkisofs would change this to a sane or generic value
> so that whoever mounted the resultant image or CD would see themselves
> as the owner?

Seeing oneself as owner (i.e. varying without changing the ISO) is a
matter of system command mount(8) with filesystem driver "iso9660":
Code:
     uid=value and gid=value
         Give all files in the filesystem the indicated user or group id,
         possibly overriding the information  found  in  the  Rock  Ridge
         extensions.
Maybe a desktop automounter will use these options to let all files
appear as owned by the desktop user.

The mkisofs-ish option -r sets owner and group id to 0. On Debian this is
the user "root". Others have more or less abandoned that user id.
This option also sets the files to read-only and read permission for all.

In xorriso's native command language one would apply such a change
by manipulation commands after the files where put into the ISO model
by command -map or others. E.g. give two directory trees to user "nobody"
(id 65534 on my system) and group id 24, then do to /bagles and the files
underneath what mkisofs option -r does.
Code:
...map.commands...
-chown_r nobody /bubbles /stuff -- \
-chgrp_r 24 /bubbles /stuff -- \
-find /bagles -exec mkisofs_r -- \
Don't omit the "--" words. They act as separators between commands with
a variable number of parameters.

If you plan elaborate manipulations, consider to explore them in dialog mode.
Code:
xorriso -abort_on NEVER -dialog on -page 16 80
This will ask you to enter lines with one or more commands and their
parameters. See also the third example in
https://www.gnu.org/software/xorriso....html#EXAMPLES
There are commands for inspecting the result before writing happens. E.g.
Code:
-lsl /bubbles --
-find / -exec lsdl --
and you may bail out instead of actually writing the ISO
Code:
-rollback_end
(At this point it would be rewarding to revisit the man page of xorriso.)

> Maybe actually burning the image will tell me more.

It should not make a difference to Linux whether you give mount the ISO
as image file or as "CDROM" device. But maybe a desktop automounter makes
a difference.

Whatever, xorriso can burn it for you:
Code:
xorriso -as cdrecord -v -eject fs=32m blank=as_needed dev=/dev/sr0 a_dvd_image.iso
> I was confused at your mention of backup

I use it mainly for high fidelity backups on BD media.
Another important job of xorriso is to create the bootable installation
ISOs of various GNU/Linux distros.

Have a nice day

Thomas
 
Old 08-05-2017, 08:02 AM   #6
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Slackware,Linux From Scratch
Posts: 545

Original Poster
Blog Entries: 93

Rep: Reputation: 151Reputation: 151
Thank you very much. Physical DVD came out correctly and as per my goal.

Last edited by jr_bob_dobbs; 08-05-2017 at 08:04 AM.
 
  


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
Build kernel and packages to iso image Harshit_24 Linux - Newbie 8 09-17-2015 05:46 AM
LXer: Kali Linux ISO: Build a custom KDE image LXer Syndicated Linux News 0 03-31-2013 02:42 AM
how does one combine all binary files from live-build into an iso image? robertkey Linux - General 2 09-18-2012 12:04 AM
mount .iso (image) file and read *.avi file smartdragonfly Linux - Software 2 12-21-2006 04:48 AM
Can an iso image file be modified? Berhanie Linux - General 3 02-01-2004 09:40 PM

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

All times are GMT -5. The time now is 11:29 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
Open Source Consulting | Domain Registration