LinuxSay - A Discussion Forum for Linux Enthusiasts

How to Create Tar multi-volume by using the automatic rename script provided in the manual of GNU Tar?


#1

How to Create Tar multi-volume by using the automatic rename script provided in the manual of GNU Tar?

Hi everyone, please help I stuck, I try to create a multi-volume tar file that has the length of a CD ~ 650MB.

I try to follow the instructions of GNU Tar manual and follow the instructions that I got another little information on internet

http://www.gnu.org/software/tar/manual/html_node/Multi_002dVolume-Archives.html

PD: I’m not a programmer or developer.

According to that I think the procedure should be as follows:

1.- Make a file called new-volume.sh, with the content indicated by the manual GNU Tar as follows, and put this at the parenth folder to source files to tar multi-volume.

#! /bin/bash
# For this script it's advisable to use a shell, such as Bash,
# that supports a TAR_FD value greater than 9.

echo Preparing volume $TAR_VOLUME of $TAR_ARCHIVE.

name=`expr $TAR_ARCHIVE : '\(.*\)-.*'`
case $TAR_SUBCOMMAND in
-c)       ;;
-d|-x|-t) test -r ${name:-$TAR_ARCHIVE}-$TAR_VOLUME || exit 1
          ;;
*)        exit 1
esac

echo ${name:-$TAR_ARCHIVE}-$TAR_VOLUME >&$TAR_FD

2.- Make

sudo chmod 755 new-volume.sh

3.- Run

$ tar -c -L650M -f cd-disk.tar -F new-volume Videos

and theh, this give me an error

tar: new-volume: Cannot exec: No such file or directory tar: Error is not recoverable: exiting now tar: ‘new-volume’ command failed tar: Error is not recoverable: exiting now

This creates the first tar file named cd-disk.tar 650 MB correctly, but then throws an error and stop from making the tar multivolume.
Some clue?, Thanks.


#2

No idea about this multi-volume script, but try new-volume.sh instead of new-volume.

#tar -c -L650M -f cd-disk.tar -F './new-volume.sh' Videos

#3

Works! Oh! Thank you very much!

$ tar -c -L650M -f cdromdisk.tar -F './new-volume.sh' -C ~/Videos .
Preparing volume 2 of cdromdisk.tar.
Preparing volume 3 of cdromdisk.tar-2.
Preparing volume 4 of cdromdisk.tar-3.

Verifying…

$ ls -1
cdromdisk.tar
cdromdisk.tar-2
cdromdisk.tar-3
cdromdisk.tar-4
new-volume.sh

Verifying extraction

$ tar -x -f ../../backup/cdromdisk.tar -F './new-volume.sh' .
Preparing volume 2 of ../../backup/cdromdisk.tar.
Preparing volume 3 of ../../backup/cdromdisk.tar-2.
Preparing volume 4 of ../../backup/cdromdisk.tar-3.

Verifying, number and size of files, etc …

$ ls -1
new-volume.sh
Video (2008) [1080p]
Videos Flisol

Solved, very thank you again @raghuu.