site  contact  subhomenews

Multisession-DVD with zisofs compression

November 26, 2020 — BarryK

I am investigating saving sessions back to DVD in EasyPup, after a lapse of about 8 years. Here is a post from a few days ago:

https://bkhome.org/news/202011/multi-session-dvd-still-highly-relevant.html

EasyPup saves each session to the DVD (DVD-R or DVD+R) as a new track, and it will appear as a folder when the disc is mounted. Each folder is a date, running EasyPup right now and I have 8 tracks saved:

2020-11-26-17-11
2020-11-26-17-30
2020-11-26-17-40
2020-11-26-18-05
2020-11-26-18-21
2020-11-26-18-37
2020-11-26-18-46

A possible improvement would be to use zisofs, which saves files compressed to the DVD. I didn't know how to implement it, so I asked Thomas Schmitt, the creator and maintainer of 'xorriso'. Thomas was extremely helpful and provided a solution.

Having a first go at doing this, I edited /etc/rc.d/functions4puppy, which is in all pups, right back to the early days. It has a function multisavefunc(), called from /etc/rc.d/rc.shutdown and /usr/sbin/savesession-dvd.

multisavefunc() uses 'growisofs' to write a track, however Thomas recommended to use 'xorriso' directly. 'growisofs' is a frontend to 'mkisofs' from the cdrtools package, or 'xorrisofs' from the 'xorriso' package. 'xorrisofs' is only a symlink to 'xorriso', so why not just use 'xorriso' directly. Basides, 'growisofs', in the 'dvd+rw-tools' package hasn't seen any life since 2010.

So, here is the code, using growisofs, where CDR=/dev/sr0 and $MYDATE is the name of the folder to be created on the DVD:

growisofs -M $CDR -D -R -quiet -new-dir-mode 0755 -graft-points \
 -x /initrd/pup_rw/tmp $REMSFS -x /initrd/pup_rw/proc -x /initrd/pup_rw/run \
 -x /initrd/pup_rw/sys -x /initrd/pup_rw/var -x /initrd/pup_rw/initrd \
-x /initrd/pup_rw/mnt ${MYDATE}=/initrd/pup_rw \
2> /tmp/dvderr.txt

Thomas provided the equivalent using xorriso, with zisofs. I am thankful for the help, as it is a quite complicated commandline:

xorriso \
-report_about warning \
-dev "$CDR" \
-compliance deep_paths:long_paths \
-pathspecs as_mkisofs \
-not_paths \
/initrd/pup_rw/tmp /initrd/pup_rw/proc /initrd/pup_rw/sys \
/initrd/pup_rw/var /initrd/pup_rw/initrd /initrd/pup_rw/mnt \
/initrd/pup_rw/run ${xREMSFS} \
-- \
-add ${MYDATE}=/initrd/pup_rw -- \
-zisofs level=8:block_size=64k \
-find / -type f -pending_data -exec set_filter --zisofs -- \
-fs 32m \
2> /tmp/dvderr.txt

And it works! I had already saved some tracks using growisofs, so the files are not compressed, but that is no problem. The compression is completely transparent.

To confirm that compression really was happening, tools like 'du' and 'df' do not help, instead I used 'disktype' -- which is an old utility, very helpful utility actually, and it is a pity that it is a dead project. Anyway, I still include it in Easy.

I created a 1GB file filled with zeros, using 'dd', in /root, then saved the session, which will be track number 8. Then used 'disktype':

# disktype /dev/sr0
...
Track 8: Data track, 1.531 MiB (1605632 bytes)
...
...yes! 

Tags: easy