Re: Needed: functionality of mkisofs command
Hi,
Richard Owlett wrote:
> I wish to use ISO files as archives.
> Multiple references suggest command of form:
> $ mkisofs –o backup.iso /home/tin/Documents/backup
This is the very minimum of an ISO production command.
> Debian does not have "mkisofs".
In 2006, Debian forked genisoimage (package "cdrkit") from mkisofs.
But it is meanwhile (nearly) unmaintained and i am entitled to pull away
as many users as possible to xorriso.
> The manpages for xorriso and xorrisofs say they are suitable.
Yup. xorrisofs tries to provide the main use cases of mkisofs by options
which are mainly compatible. (Those many "main"s are caused by the wide
range of mkisofs and xorriso use cases.)
> BUT give no example. I got lost attempting to follow the manpages.
man 1 xorrisofs, section EXAMPLES:
A simple image production run
A prepared file tree in directory ./for_iso gets copied into the root
directory of the ISO image. File permissions get set to read-only for
everybody. Joliet attributes for Microsoft systems get added. The
resulting image gets written as data file ./image.iso on disk.
$ xorrisofs -r -J -o ./image.iso ./for_iso
But i would advise some additional options
--for_backup will add MD5 checksums, by which xorriso can test whether
the image (possibly on an optical medium) is still good.
It will also record ACLs, xattr, and hardlink relations.
This extra info can be restored if you restore the files
by xorriso.
-V TIN_DOCS_"$(date '+%Y_%m_%d_%H%M%S')"
will label the filesystem as
TIN_DOCS_2019_10_27_141830
showing the local time when the backup was made.
and for backup purposes, option -r is suboptimal, because it alters the
recorded file permissions.
So i'd advise something like this:
xorrisofs \
--for_backup \
-J \
–o backup.iso \
-V TIN_DOCS_"$(date '+%Y_%m_%d_%H%M%S')" \
/home/tin/Documents/backup
Checkreading:
xorriso -for_backup -indev backup.iso -check_media --
--------------------------------------------------------------------------
In general, i would advise to use for backup xorriso's native command set,
not the emulation of mkisofs:
xorriso \
-for_backup \
-joliet on \
-outdev backup.iso \
-volid TIN_DOCS_"$(date '+%Y_%m_%d_%H%M%S')" \
-map /home/tin/Documents/backup /
This would be the better base for the evolution of your backup script.
You will probably get more ideas when it did it first few rounds of backup.
For example you can go for incremental backups:
xorriso \
-for_backup \
-joliet on \
-assert_volid 'TIN_DOCS_*' \
-dev backup.iso \
-volid TIN_DOCS_"$(date '+%Y_%m_%d_%H%M%S')" \
-update_r /home/tin/Documents/backup / \
-commit -toc -check_md5 FAILURE --
To be run on yet non-existing "backup.iso" to create it as base backup.
Then to be run e.g. daily to mirror the changes in /home/tin/Documents/backup
since the previous backup. The new session will be checkread in the end.
Get an overview of available backups:
xorriso -for_backup indev backup.iso -toc
This will tell something like
TOC layout : Idx , sbsector , Size , Volume Id
ISO session : 1 , 0 , 1987001s , HOME_2019_08_01_112807
ISO session : 2 , 1987168 , 45766s , HOME_2019_08_02_113650
ISO session : 3 , 2033088 , 59896s , HOME_2019_08_03_124015
...
ISO session : 86 , 5843296 , 62017s , HOME_2019_10_26_132545
ISO session : 87 , 5905472 , 67737s , HOME_2019_10_27_115020
You may use the "sbsector" number with mount(8) option "-o sbsector="
or you may let xorriso find a particular day for you:
sudo osirrox -mount backup.iso volid '*2019_08_03*' /mnt/iso
This will mount the session with the matching label at /mnt/iso.
Each session shows its own files and all older files if they were still
existing when the backup session was created.
Have a nice day :)
Thomas
Reply to: