[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Archiving content of a directory on a DVD-R.

On 11/4/18 7:29 AM, peter@easthope.ca wrote:
How is this for archiving the content of a directory?

   pushd <aDirectory> ;
   printf "Insert blank DVD-R."; read t ;
   tar -vcpzf - * | xorriso -indev /dev/sr0 -add -- -commit ;
   xorriso -indev /dev/sr0 -du / -- -toc 2>&1 ;
   xorriso -indev /dev/sr0 -eject ;
   echo "Content of <aDirectory> archived in DVD-R." ;
   popd ;

I tried to find the simplest way to burn files to an optical disc using xorriso(1), and then put the incantation into a script. Here are the essential lines:

    xorriso -outdev  "$DEVICE"  -volid  "$VOLID"  -map_l $PWD / $@
    eject  "$DEVICE"

Basically: invoke xorriso with two options and one command that consumes the command-line arguments (paths to files).

Note that there is no tar or gzip involve, just a straight copy from one file system to another. (I typically create tarballs and matching checksum files on HDD, and then burn those to optical.)

And retrival.

   pushd <anEmptyDirectory> ;
   printf "Insert a DVD-R containing a tar archive."; read t ;
   xorriso -indev /dev/sr0 -toc 2>&1 ;
   xorriso -indev /dev/sr0 -extract / -- | tar -vxf ;
   xorriso -indev /dev/sr0 -eject ;
   popd ;

I put the disc into the drive, wait for Thunar (Xfce) to show the volume ID on the left pane, and then click on it. This mounts the disc at /media/cdrom0. I can then use whatever tools I like to access the contents of the disc.

Or, from the terminal:

2018-11-04 14:50:42 dpchrist@po ~
$ mount /media/cdrom0
mount: /dev/sr0 is write-protected, mounting read-only

2018-11-04 14:50:54 dpchrist@po ~
$ l /media/cdrom0
./		     README.source  dists/     install/      setup.exe
../		     README.txt     doc/       install.386/  tools/
.disk/		     autorun.inf    efi/       isolinux/     win32-loader.ini
README.html	     boot/	    firmware/  md5sum.txt
README.mirrors.html  css/	    g2ldr      pics/
README.mirrors.txt   debian@	    g2ldr.mbr  pool/

2018-11-04 14:51:44 dpchrist@po ~
$ eject
eject: unable to open `/dev/sr0'

2018-11-04 15:06:10 dpchrist@po ~
$ eject /mnt/cdrom0
eject: unable to find or open device for: `/mnt/cdrom0'

eject(1) doesn't seem to work, so I press the eject button the drive to get the disc out.


Reply to: