Hard Disk Backup Question

John Summerfield debian at herakles.homelinux.org
Sat Nov 17 06:20:59 UTC 2007


Bill Davidsen wrote:
> Ralph De Witt wrote:
>> Hi All:
>> I have a Dell Inspiron E1705 Computer with a 80 gig hard drive. I also 
>> have a Western Digital 500 gig My Book External USB Hard Drive 
>> attached. I would like to Back up the entire hard drive to a partition 
>> on the external drive. I have very little knowledge of how to do this. 
>> I have always backed up to a CD individual files after a data loss. I 
>> thought a auto backup routine would work, but the computer may not be 
>> on when the backup would be scheduled, and the external hard drive 
>> partition do not seem to want to auto mount so that would not work. I 
>> am using the kde desk top. Could some one add to my knowledge and help 
>> me out? TIA
> 
> If you want to make a backup of the physical hard drive, such that you 
> could just replace the drive with an identical drive and recreate it, 
> you need to boot from a CD, such as the Fedora rescue CD, and just copy 
> the contents. Assuming that the external drive is sdb, mounted on 
> /mnt/external (for example):
>   dd if=/dev/sda bs-1M | gzip -3 >/mnt/external/2007-10-04-1410-image.gz

Actually, you _can_ do that from the live system. The consequences are 
about the same has having a power failure.

I've done it a couple of times, it worked okay.

Safer, is doing something like this to the backup drive. Read the 
documentation for each command. The whole procedure needs to be done as 
root. Take care that you partition the right disk, and create 
filesystems (and swap) on the correct partitions.

If you use LVM, there will be additional steps.

# Partition the disk
fdisk ...
# Create a filesystem for on each backup parrition
mke2fs -j ...
# If your backup disk has a swap partition, you should
mkswap ...
# Mount the backup system, maybe like this:
mount ... /mnt/backup
mkdir /mnt/backup
mount .... /mnt/backup
# Copy the files. Tar is one way, it's good. After the /, you need to 
name each partition
tar clC / boot . | tar xpC ...
# Check plausibility:
df -h -t ext3


The result is a clone of the running system. Files that are open for 
writing/updating at the time you copy them may be damaged.

I do this regularly, but I do make sure that nothing is creating or 
writing to important files (syslog excepted) at the time.

Database software (eg postgresql) has its own backup procedures, you 
should use them.

I've not described how to install grub, I'm sure it's possible, I just 
haven't done it.

> 
> Note that the image must be restored to an identical hard drive, since 
> it's an image of the whole disk. It might work on a larger drive, but 
> you might not use, or even have access to, the whole drive.

It does work to a bigger disk, and the extra space if free space at the 
end of the disk. Read up on resize2fs for hints on expanding an ext{2,3} 
partition into it.

> 
> There are various utilities to do this, g4u being popular. This has some 
> of the same limitations, but is easy to use. Because it's based on 
> netBSD (AFAIK) the drivers are not identical, but it can backup over a 
> network using ftp.

There's dar at sf.net; it doesn't do exactly this.
> 
> There are commercial products which do this, use Google, I haven't used 
> any in several years and can't suggest.
> 
> Finally, you can backup the contents of the critical data (or all files) 
> using programs like rsync, or using tar, cpio, or star. These require 
> manual partitioning of a replacement drive, restore, and rerunning grub 
> by hand, but offer more flexibility.

The backup created using the steps I outlined can be kept in sync using 
rsync.

> 
> You can also put an incremental backup program call in your shutdown 
> sequence, to be sure you back up anything you have done in a current 
> session.
> 
> Hope that's a useful overview of the possibilities, I'm not sure just 
> what features you need, and there's always a tradeoff between 
> convenience of restoring a single lost file and that of restoring 
> everything.
> 
There is also the dump/restore package. My reading says dump should not 
be run from the any live filesystems.



-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

Please do not reply off-list




More information about the users mailing list