tape-admin: rework ltfs reformat and wipe
* be verbose, if requested * handle return codes for function call * to re-format an already partitioned tape, its need to be wiped first * just simply removing data from tape does not free the occupied space thus, we need to wipe it and format again to get full capacity of the tape Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -559,6 +559,11 @@ ltfs_format () {
|
|||||||
printf "${BLUE}ltfs_format...${NO_COLOR}\n"
|
printf "${BLUE}ltfs_format...${NO_COLOR}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $verbose -ge 2 ]; then
|
||||||
|
printf "${MAGENTA}LTFS format tape ${GREEN}'%s'${MAGENTA} with serial ${GREEN}'%s'${NO_COLOR}\n" \
|
||||||
|
"$volume_name" "$volume_serial"
|
||||||
|
fi
|
||||||
|
|
||||||
make_err_file
|
make_err_file
|
||||||
${MKLTFS} --device=$ltfs_devname --volume-name=${volume_name} --tape-serial=${volume_serial} --force 2>${ERRFILE}
|
${MKLTFS} --device=$ltfs_devname --volume-name=${volume_name} --tape-serial=${volume_serial} --force 2>${ERRFILE}
|
||||||
RET=$?
|
RET=$?
|
||||||
@@ -689,13 +694,17 @@ ltfs_reformat () {
|
|||||||
if [ ${#need_format} -ge 1 ]; then
|
if [ ${#need_format} -ge 1 ]; then
|
||||||
ltfs_format ${volume_name_active} ${volume_serial}
|
ltfs_format ${volume_name_active} ${volume_serial}
|
||||||
else
|
else
|
||||||
#ltfs_wipe
|
|
||||||
ltfs_umount
|
ltfs_umount
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ltfs_format ${volume_name_active} ${volume_serial}
|
ltfs_wipe
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ltfs_format ${volume_name_active} ${volume_serial}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ltfs_mount
|
if [ $? -eq 0 ]; then
|
||||||
|
ltfs_mount
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
@@ -743,7 +752,16 @@ ltfs_wipe () {
|
|||||||
printf "${BLUE}ltfs_wipe...${NO_COLOR}\n"
|
printf "${BLUE}ltfs_wipe...${NO_COLOR}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $ltfs_mountpoint/*
|
#rm -rf $ltfs_mountpoint/*
|
||||||
|
make_err_file
|
||||||
|
${MKLTFS} --device=$ltfs_devname --wipe --force 2>${ERRFILE}
|
||||||
|
RET=$?
|
||||||
|
rm -f ${ERRFILE}
|
||||||
|
if test $RET -eq 1; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return $RET
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
make_err_file() {
|
make_err_file() {
|
||||||
|
|||||||
Reference in New Issue
Block a user