LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2009, 04:07 PM   #1
digity
Member
 
Registered: Apr 2005
Posts: 105

Rep: Reputation: 15
making scheduled backup image


How do I go about making a backup image (of just the used space, not the whole drive) of my Ubuntu 8.10 box and having it do this weekly?
 
Old 03-28-2009, 05:10 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,652

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by digity View Post
How do I go about making a backup image (of just the used space, not the whole drive) of my Ubuntu 8.10 box and having it do this weekly?
Well, there are several ways. You could use a bare-metal recovery tool, like mkcdrec, systemimager, or mondoarchive, which will create a bootable ISO image, suitable for recovering a system if the hard drive dies.

You could use tar to just grab all the files, and shovel them onto a tape/CD/DVD/whatever, so you can read just one file off if needed, or use network backup tools, to backup to a central server.

No matter which you need, CRON can run the job whenever you tell it to. What kind of backup do you want? To what media? What are your backup goals (just need files? Bare-metal?)??
 
Old 03-28-2009, 05:32 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
I'd just use tar with gzip compression (bzip2 is quite slow and cpu intensive for such a big backup, though you can use it if you want a smaller backup, though in that case I'd just use 7z). Be sure to read the tar man page, and look specially at the --exclude option which will allow you to exclude dirs like /tmp, /var/tmp, /proc, /dev, /mnt, /media and /sys.

You could also use dd to get a disk image, kind of like a ghost image. If you choose to do so, first make sure to zero out the empty part of the disk first, so the image can be compressed much more effectively. That can be done with this command:

Code:
dd if=/dev/zero of=/tmp/foo bs=4096
It will eventually abort, once the disk is full. Then you can remove /tmp/foo.

To run whatever script weekly, you can put it in /etc/cron.weekly
 
Old 03-28-2009, 08:29 PM   #4
digity
Member
 
Registered: Apr 2005
Posts: 105

Original Poster
Rep: Reputation: 15
yes, my hard drive died and i want a bare-metal backup to simply restore/clone the most recent image to disk. i'd like to store the backup images on an external drive. is this actually possible?
 
Old 03-28-2009, 09:41 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by digity View Post
yes, my hard drive died and i want a bare-metal backup to simply restore/clone the most recent image to disk. i'd like to store the backup images on an external drive. is this actually possible?
Of course. Cron scripts are run as root, so the same script can be used to mount the drive somewhere, copy the files to the correct place and then unmount the drive again.
 
Old 03-28-2009, 09:49 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you use "df" you can calculate the amount of free space and use that to calculate the size of a zeroed file. Then delete the file. Now if you use dd to create an image, it will compress better.

Make sure that the external drive uses a filesystem that can hold large files. If you use ieee1394 or even better eSATA, it will be a lot faster.

If you don't compress the image, one trick you could use is to mount the partitions on the image and sync files to it. This will give you the convenience of a fast bare metal restore, in the case of an emergency, while keeping the image up to date.

Look at the info manual for tar. You can use it to easily transport files to a mounted partition:

tar -C / -g timestamp -cf - /usr /home /var | tar -C /mnt/backupdir -xvf - >logfile
This will perform incremental backups, extracting the files to the destination.
The /mnt/backupdir could be the mounted image itself. The first time you run it, it will backup all files. The next time, only new files.

Something to play around with anyway.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scheduled backup - WinXP to Linux samengr Linux - General 4 01-23-2008 07:17 AM
Online backup manager: missing scheduled backups ronaldv Ubuntu 0 11-08-2007 02:14 PM
How to make a scheduled backup using cron file? mus1402 Linux - Newbie 3 02-04-2006 11:23 PM
How to make a scheduled backup procedure using the cron file? mus1402 Linux - Networking 1 02-04-2006 10:51 PM
making backup image of dual boot RH8/w2k - How? wright_pm Linux - General 1 04-25-2003 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration