On a linux system we are unable to run ghost
search cancel

On a linux system we are unable to run ghost

book

Article ID: 278064

calendar_today

Updated On:

Products

Ghost Solution Suite

Issue/Introduction

Unable to run ghost on a Linux machine

Environment

GSS 3.x

DS 8.x

Cause

Using non-supported drives

 

If you run lsblk and the drive is listed, ( in this case the drive in nvme0n1 )

but if run ./gdisk64 and the drive is not listed then running ghost to take an image will not work

Gdisk is unable to see the NVMe m2 drive

 

Resolution

Use tar commands to image the drive.  Use the provide script file and add it to the LinuxPE environment within bootwiz ( Right click on the configuration name > add > file and locate the gssbackup.sh file )

Also if you want the script to start automatically add: ./gssbackup.sh  to the startup.rc file in the configuration

Example backup script to use: (also attached at bottom of this document )
NOTE: it's required to save this file as UNIX file type, not windows.  Best Practice is to create this file on UNIX.

#!/usr/bin/env bash

print_help() {
    echo "Usage: $0 [OPTIONS]"
    echo "  -h          Display this help message"
    echo "  -s DEVICE   Specify source device to backup"
    echo "  -d DIR      Specify output directory"
    echo ""
    echo "Example: $0 -s /dev/sda -d /mnt/gss/backup"
    exit 0
}

cleanup () {
    if [ ! -z ${MOUNTPOINT} ] && [ -d ${MOUNTPOINT} ]; then
        if grep -qs ${MOUNTPOINT} /proc/mounts; then    
            umount ${MOUNTPOINT}
        fi
        rmdir ${MOUNTPOINT}
    fi
}

try_backup_partition() {
    PARTITION=$1

    if mount ${PARTITION} ${MOUNTPOINT} 2> /dev/null ; then
        backup_partition ${PARTITION}
        umount ${MOUNTPOINT}
    fi
}

backup_partition() {
    PARTITION=$1
    #detect filesystem
    FS_TYPE=$(blkid -o value -s TYPE ${PARTITION})

    DEST_FILE_NAME=${DESTINATION_FOLDER}/$(basename ${PARTITION}).tgz

    #test that tar has checkpoint support
    TAR_ADDITIONAL_OPTIONS=""
    CHECKPOINT_SUPPORT=$(tar --help | grep -c checkpoint)
    if [ ! ${CHECKPOINT_SUPPORT} -eq 0 ]; then
        TAR_ADDITIONAL_OPTIONS="--checkpoint=1000 --checkpoint-action=dot"
    fi

    echo "Backing up ${PARTITION} (${FS_TYPE}) to ${DEST_FILE_NAME} ..."
    #tar backup
    tar -cpzf ${DEST_FILE_NAME} ${TAR_ADDITIONAL_OPTIONS} -C ${MOUNTPOINT} .

    echo ""
}

backup_device() {
    #enumerate all physical devices
    for part in $(ls ${SOURCE_DEVICE}?)
    do
        try_backup_partition ${part}
    done

    #enumerate lvm devices
    for part in $(ls /dev/mapper/*)
    do
        try_backup_partition ${part}
    done
}

SOURCE_DEVICE=""
DESTINATION_FOLDER=""

while getopts "hs:d:" opt; do
    case "$opt" in
    h)  print_help
        exit 0
        ;;
    s)  SOURCE_DEVICE="$OPTARG"
        ;;
    d)  DESTINATION_FOLDER="$OPTARG"
        ;;
    *)  # Any other option will exit with an error
        echo "Invalid option or option requires an argument."
        echo "Use -h for help."
        exit 1
        ;;
    esac
done

#check for root
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root."
    exit 1
fi

#check source device
if [ -z "${SOURCE_DEVICE}" ]; then
    echo "Source device not specified."
    echo "Use -h for help."
    exit 1
fi

#chech that source device is a block device
if [ ! -b "${SOURCE_DEVICE}" ]; then
    echo "Source device is not a block device."
    echo "Use -h for help."
    exit 1
fi

#check destination folder
if [ -z "${DESTINATION_FOLDER}" ]; then
    echo "Destination folder not specified."
    echo "Use -h for help."
    exit 1
fi

#check that destination folder exists
if [ ! -d "${DESTINATION_FOLDER}" ]; then
    echo "Destination folder does not exist."
    echo "Use -h for help."
    exit 1
fi

#crreate temporary folder in /mnt
MOUNTPOINT=$(mktemp -d /mnt/dbackup.XXXXXX)

#set trap for cleanup
trap cleanup EXIT

backup_device

Additional Information

gssbackup zip file attached to this case includes a .sh file that has been saved on a Unix system (by running dos2unix).  Only edit this file inside Unix, if editing is required.  Saving this file in Windows will ruin the Linux formatting.

Attachments

gssbackup.linux.zip get_app