Re: Howto: Backup and restore your system!
I admit to having not read all 99 previous pages of this thread.
Instead of using tar or rsync for a full drive backup, I would use an imaging solution like Clonezilla. With this, you select either the whole drive or one or more partitions on the drive. No problem with excluding external drives. And if you need to restore, you can restore to bare metal - you don't need a working installation, just the Clonezilla disc.
There are a couple of gotchas: for example you must not mount the external drive first - Clonezilla will make you select from unmounted drives to save the image on.
You can download the Clonezilla Live CD, or certain other CDS that include it like PartedMagic.
Re: Howto: Backup and restore your system!
Quote:
Originally Posted by
BarryM
Hello there, I hope someone out there can help me with this. I want to make a backup of my entire Ubuntu drive to an external (USB Drive). As far as I can gather, the method suggested by Heliode at the very start of this thread puts the backup on the desktop. Am I right there?
I have got my external drive connected and mounted (it is a FreeAgent drive, and appears as "FreeAgent Drive" in the directory tree). I have managed to navigate to it via the Media directory (I found out that I needed to put the name in quotes for Ubuntu to recognise it in the root terminal).
If I now want to make my backup, having got to the directory in the FreeAgent drive that I want to store the backup in, will it work with the "tar cvpzf backup.tgz --exclude=/... (exclude list) /"? How do I stop the contents of the FreeAgent drive being included in the tarball? Should I add --exclude="/media/FreeAgent Drive" in the exclude list?
Any advice will be greatly appreciated.
Thanks
just put --exclude="/media" ...in the exclude list, you don't want to backup ntfs partitions or cd/dvd-rom (if theres any) in your backup.
Re: Howto: Backup and restore your system!
This totally worked for me!!! thanks and cheers.
idn't get to try the right way as exactly in the tut.
what i did
went to vista - deleted ubuntu folder
re-install from cd
moved backup file to root
followed the command in tut.
rebooted
it whined about something, so, did a 'long-hold' on power button to power down
booted
fine!
so i've condensed your tutorial down to the bare essentials as i have used them. hope you don;t mind...
first boot up from install disk as a visitor, then go to terminal and begin...
### become root
sudo su
### cd into root(can go anywhere you want backup to end up, including remote or removable drives)
cd /
### full backup command
tar cvpzf backup.tgz / --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/host --exclude=/dev --exclude=/sys --exclude=/media
### explanation
"The 'tar' part is, obviously, the program we're going to use.
'cvpfz' are the options we give to tar, like 'create archive' (obviously),
'preserve permissions'(to keep the same permissions on everything the same), and 'gzip' to keep the size down.
Next, the name the archive is going to get. backup.tgz in our example.
Next comes the root of the directory we want to backup. Since we want to backup everything; /
Now come the directories we want to exclude. We don't want to backup everything since some dirs aren't very useful to include. Also make sure you don't include the file itself, or else you'll get weird results.
You might also not want to include the /mnt folder if you have other partitions mounted there or you'll end up backing those up too. Also make sure you don't have anything mounted in /media (i.e. don't have any cd's or removable media mounted). Either that or exclude /media.
At the end of the process you might get a message along the lines of 'tar: Error exit delayed from previous errors' or something, but in most cases you can just ignore that."
### restore
tar xvpfz backup.tgz -C /
### warning
"this will overwrite every single file on your partition with the one in the archive!"
### re-create excluded directories
mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys
etc...
### reboot
Re: Howto: Backup and restore your system!
you can store the file on the seagate, but you have to copy it into file systems before doing the restore command. thats what i ended up doing anyway. all the best, this really does work.
Re: Howto: Backup and restore your system!
Many thanks to the various respondents on this. I successfully made the backup using tar. I did find it took rather a long time, especially with Olympus RAW pictures and a BBC iPlayer video, I realise I should perhaps have excluded the Videos folder as well!
I tried the Clonezilla live CD but got a slight problem with getting to the right drive for storing the backup, so will try again later (I am just doing all of this in preparation for an upgrade, in case anything goes badly wrong, so I can get back to square 1).
I suppose I can use a tarball to back up my ******* drive as well (sadly I have to use that other operating system for some applications that do not have Linux alternatives)?
Re: Howto: Backup and restore your system!
I'm a new convert running Karmic, and I love it. A trial run of Heliode's backup-and-restore method worked fine for me. However, I have a new desktop on the way and, although I've searched this and other threads, I can't find direct answers to the following:
1. Is a disk image or a simple automatic sbackup the best way to backup the old HD and restore to the new? I had a devil of a time getting the settings right for a Linksys router and a Canon printer. I still don't know what I did right to get them to work, and I'm a bit paranoid about losing the settings to those devices in particular.
2. The old box is 2002 vintage and runs a 32-bit OS. The new one is 64-bit. Will the drive-image/sbackup-restore method transfer successfully to the new one? Will the sbackup automatic version? Should I install 64-bit Karmic first, then transplant the old files?
3. The new machine will have a new graphic card and other internal hardware. If I restore the disk image will that cause something to implode?
Many thanks in advance for any replies. And please use small words in any responses: I'm obviously very new to this and on the wrong side of 65 to boot. :-)
Re: Howto: Backup and restore your system!
What if the UIDs of the swap areas are different?
Re: Howto: Backup and restore your system!
It should be noted that when you restore from your backup, your backup file will ALSO be deleted if it is on the hard drive.
Re: Howto: Backup and restore your system!
Hi,
I'm getting this error with the backup command of the post #1.
Code:
/sbin/halt
tar: /: file changed as we read it
tar: Error exit delayed from previous errors
$
I remember the command:
Code:
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
Any idea?
Javi
Re: Howto: Backup and restore your system!
Hi all,
Here is a shell I have put together from this post. I am not a guru on shell scripts this was put together with the help of google search :P.
Feel free to comment and/or change it.
I saved it as backupAndRestore.sh and you can run it as follows
sudo ./backupAndRestore.sh
enjoy
Code:
#!/bin/bash
S1='b'
S2='y'
echo "Please enter b for backup or r for restore:"
read action
if [ $action = $S1 ]; then
echo "These Directories will be excluded:"
echo -e "\033[1m\033[32m /proc /lost+found */backup.tgz /mnt /sys /dev"
echo -e "\033[0m"
echo "To chance these values edit this shell"
echo "continue (y/n):"
read action
if [ $action = $S2 ]; then
echo "Backing up PC ~ timestamp " ;date
tar cpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=*/backup.tgz --exclude=/mnt --exclude=/sys /
fi
else
echo -e "\033[1m\033[31mWARNING: this will overwrite every single file on your partition with the one in the archive!"
echo -e "\033[0m"
echo "Please enter name and location of the archive to restore:"
read fileName
echo "You are about to restore $fileName do you want to continue?(y/n)"
read action
echo -e "\033[1m\033[47mJust sit back and watch the fireworks.This might take a while. When it is done, you have a fully restored Ubuntu system!"
sleep 5
echo "start"
if [ $action = $S2 ]; then
tar xvpfz $fileName -C /
echo "Creating excluded directories"
#Just to make sure that all excluded directories are re-created
mkdir /proc
mkdir /lost+found
mkdir /mnt
mkdir /sys
fi
fi
echo -e "\033[0m"