Best practices for setting up Dell VTL Container or NetVault Backup native virtual tape library (nVTL)
47
Linux
®
/UNIX
®
platform:
#!/bin/bash
# ==================================================================
# The following parameters must be configured for the script example provided as follows:
# vtlpath = This should be the UNC path of the root share used to host the nVTL instance.
# media_prefix = This should be the prefix of the virtual media designated for processing
# library_name = This should be the name of the library as it has been added to NetVault Backup
# media_size = This is the size of the media to be recreated and must be compatibly for input to the
# nvmakemedia command
# ===================================================================
nv_home=`head -n -1 /etc/.nv6_home`
nvutil=$nv_home/util media_size=50m media_prefix=”YN1D”
vtlpath=/vtl2/VTL2 library_name=VTL2 logfile=/tmp/logddclean.log rm -rf /tmp/mediatmp
# ================================================
# Grab media info on tapes in the VTL
# ================================================
$nvutil/nvreport -class media -exclude “%Librarystatus = Unknown” -include “%reuse = yes” -format
“%label
%mediagroup %barcode” -sort “%label” | grep $media_prefix > /tmp/mediatmp echo “========================
============”
echo “Processing the following media list:”
echo “====================================” cat /tmp/mediatmp|awk ‘{print $1}’
read expired_media < /tmp/mediatmp
# ================================================
# Create an array and throw data into it
# Run commands against the data in the array
# ================================================
#Open file for reading exec 10</tmp/mediatmp let count=0
while read LINE <&10; do
barcodes[$count]=$(echo $LINE | awk ‘{print $3}’) tempstring=${barcodes[$count]}
barcodes[$count]=${tempstring%” “} labels[$count]=$(echo $LINE | awk ‘{print $1}’)
tempstring=${labels[$count]} labels[$count]=${tempstring%” “} groups[$count]=$(echo $LINE | awk ‘{print
$2}’) tempstring=${groups[$count]} groups[$count]=${tempstring%” “} media_avail[$count]=$LINE
((count++)) done array_num_avail=0
while [ $count -gt 0 ]; do
echo “================================================”
echo “Cleaning Media with label ${labels[$array_num_avail]}” echo “Cleaning Media from group
${groups[$array_num_avail]}”
echo “Cleaning Media with barcode ${barcodes[$array_num_avail]}” echo “================================
================”
sleep 1
echo $nvutil/nvexportmedia -barcode ${barcodes[$array_num_avail]}
$nvutil/nvexportmedia -barcode ${barcodes[$array_num_avail]}
echo “================================================” sleep 1
echo “Opening the Entry/Exit Port in $library_name”
$nvutil/nvopeneeport -libraryname $library_name
echo “================================================”
echo “Renaming media with barcode ${barcodes[$array_num_avail]} to ${barcodes[$array_num_avail]}.
disabled” echo mv $vtlpath/media/${barcodes[$array_num_avail]} $vtlpath/media/${barcodes[$array_num_
avail]}.disabled mv $vtlpath/media/${barcodes[$array_num_avail]} $vtlpath/media/${barcodes[$array_num_
avail]}.disabled
echo “================================================”
echo “Creating a new piece of media, this may take some time based on size of media”
echo $nvutil/nvmakemedia $media_size mediafiles $vtlpath/media/${labels[$array_num_avail]}