Multi volume tar archive


tar archive spanning multiple volumes

backupDir=/backups
backupFile=pseudo-tape.tar
backupVolume=pseudo-tape.volno

# tar
# -c						  create new archive
# --gzip					gzip archive
# -M						  create/list/extract multi-volume
# --tape-length		change tape after writing x * 1024 bytes. 1048576 gives 1GB output files
# --file					archive file
# --new-volume-script		run script at end of each volume
# --volno-file		use/update volume number in file

tar -c  -M --tape-length=1048576 --file=${backupDir}/${backupFile} --new-volume-script=${backupDir}/pseudo-tape-new-volume.sh --volno-file=${backupDir}/${backupVolume} ${backupDir}/software-20151102

dir="${backupDir}"
base_name="${backupFile}"
next_volume_name=`echo -n "archive."; cat $dir/${backupVolume}`
echo "moving $dir/$base_name to $dir/$next_volume_name"
mv -v "$dir/$base_name" "$dir/$next_volume_name"

sid=xp1
mkdir /backup1/${sid}
chmod 777 /backup1/${sid}
mkdir /backup2/${sid}
chmod 777 /backup2/${sid}
mkdir /backup3/${sid}
chmod 777 /backup3/${sid}
mkdir /backup4/${sid}
chmod 777 /backup4/${sid}
Comment on this article using form below. Requires email login only for authentication. HTML forbidden, Markdown only.