Help Automating Backup of Drive
by des_a from LinuxQuestions.org on (#6HFRS)
I need help with this problem. OK, here goes. I think I have a bad internal keyboard. I'm going to want to replace it. I need a little hardware help to do the work, I'm a software guy, not a hardware guy. I typically save a partition table, and then use partimage for backup, when backing up in this manor. I "think" I have enough space. Basically, I want to make sure software is saved so when it gets replaced, I lose nothing. Even the OS could possibly be replaced, but some of the files, CANNOT be replaced.
But partimage failed to work, probably because I see I'm using ext4, not ext3. This could be fixed, but for time, I just want to save it anyway. The OS for backup will be System Rescue CD running off of a ventoy USB stick.
I typically use dd when partimage fails like that. I do a simple:
Code:dd if=<savedrive> of=<outputfile>However, in this case, that was unreliable. After about 2 days, it still failed without even being completed for the command. I'm thinking that if I split each image, into my standard split size (the size of my smallest CD), 637MB, like partimage does, this would succeed. I can immediately compress the files, each one, right with bzip, right after I make the image. The extension, should probably do what dd does, and end in a number. To restore it, I think I could uncompress, then join the images, with a copy, then restore the file to the hard drive. I've only now begun to think of restoration, which IS important.
But giving each command to the OS, to do the work, is tedious, and error prone. I CANNOT afford one error in this process. Can you help me write a script for this task? Then, I can include it with my standard scripts, in which case my process for backing up, would be:
Code:1. boot the disk
2. install standard scripts
3. run the script for backup
4. reboot into real os, and good to goThis is simplifying it, but I should be able to do this. I might need this process in the future too, which is why I thought script would be best. I may not have the latest version of the backup OS.
I cannot afford to make mistakes, and need no sudo in the script, as a requirement, if sudo is needed, I will have to sudo it by the whole script.
Code so far:
Code:#! /bin/bash
if [ $# == 3 ]; then
countvar=$3
splitnum=0
echo "Saving drive if=$1, of=$2.$splitnum <blocksize=$countvar>..."
dd if=$1 of=`echo $2.$splitnum` count=$countvar
for i in `seq 0..`
do
done
echo
else
echo "Usage: $0 <input> <output> <splitsize>"
echo
echo "input - The input file."
echo "output - The output file."
echo "splitsize - The size in megabytes, to split the file into for ouput."
echo
fiI'm open to suggestions if this is not right process. I DON'T want to use clonezilla, because it takes too much to setup and get working. I can backup online in Linux Mint, or offline in that OS. I want to do the quickest too, as well as safest. Please try to help quick, I need the replacement, but don't make an error or I'm in trouble. This could be the wrong idea.
But partimage failed to work, probably because I see I'm using ext4, not ext3. This could be fixed, but for time, I just want to save it anyway. The OS for backup will be System Rescue CD running off of a ventoy USB stick.
I typically use dd when partimage fails like that. I do a simple:
Code:dd if=<savedrive> of=<outputfile>However, in this case, that was unreliable. After about 2 days, it still failed without even being completed for the command. I'm thinking that if I split each image, into my standard split size (the size of my smallest CD), 637MB, like partimage does, this would succeed. I can immediately compress the files, each one, right with bzip, right after I make the image. The extension, should probably do what dd does, and end in a number. To restore it, I think I could uncompress, then join the images, with a copy, then restore the file to the hard drive. I've only now begun to think of restoration, which IS important.
But giving each command to the OS, to do the work, is tedious, and error prone. I CANNOT afford one error in this process. Can you help me write a script for this task? Then, I can include it with my standard scripts, in which case my process for backing up, would be:
Code:1. boot the disk
2. install standard scripts
3. run the script for backup
4. reboot into real os, and good to goThis is simplifying it, but I should be able to do this. I might need this process in the future too, which is why I thought script would be best. I may not have the latest version of the backup OS.
I cannot afford to make mistakes, and need no sudo in the script, as a requirement, if sudo is needed, I will have to sudo it by the whole script.
Code so far:
Code:#! /bin/bash
if [ $# == 3 ]; then
countvar=$3
splitnum=0
echo "Saving drive if=$1, of=$2.$splitnum <blocksize=$countvar>..."
dd if=$1 of=`echo $2.$splitnum` count=$countvar
for i in `seq 0..`
do
done
echo
else
echo "Usage: $0 <input> <output> <splitsize>"
echo
echo "input - The input file."
echo "output - The output file."
echo "splitsize - The size in megabytes, to split the file into for ouput."
echo
fiI'm open to suggestions if this is not right process. I DON'T want to use clonezilla, because it takes too much to setup and get working. I can backup online in Linux Mint, or offline in that OS. I want to do the quickest too, as well as safest. Please try to help quick, I need the replacement, but don't make an error or I'm in trouble. This could be the wrong idea.