LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   easiest way to backup / (root) partition (http://www.linuxquestions.org/questions/debian-26/easiest-way-to-backup-root-partition-418569/)

kushalkoolwal 02-22-2006 08:20 PM

easiest way to backup / (root) partition
 
hi guys,

I would like to back up my root partition on my drive i.e. /dev/hda1 on which I have Debian installed. What is the easiest way to make a compresssed backup copy of the /dev/hda1 partition.

I did an apt-cache search backup

and it seems that there are plenty of utility to achieve this. Has anyone has any personal experience with these kind of tools. Can anyone suggest one based on their own experience.

Thanks

johnMG 02-22-2006 08:37 PM

You don't usually need to backup the whole drive -- most folks just back up their home directory, since, everything else can just be reinstalled. Your data is the stuff that's tough to replace.

That said, if you want an entire bit-for-bit copy of /dev/hda1, I think the dd command may be what you're looking for.

microsoft/linux 02-22-2006 08:45 PM

or you can use tar to make an archive of your root directory(excluding /proc, I think). Then all you need to do is untar it.

kushalkoolwal 02-22-2006 08:48 PM

Quote:

Originally Posted by johnMG
You don't usually need to backup the whole drive -- most folks just back up their home directory, since, everything else can just be reinstalled. Your data is the stuff that's tough to replace.

That said, if you want an entire bit-for-bit copy of /dev/hda1, I think the dd command may be what you're looking for.

Yes I would like to take the snapshot of my entire hard drive partition(/dev/hda1). How can dd be used to have those backups? What about utility like pdumpfs,cpbk?

dracae 02-22-2006 09:00 PM

dump/restore is a good backup/restore solution. It works with the filesystem and not files so it does not needlessly copy /proc, /sys, /dev, etc. You also have the option of incremental backups.

johnMG 02-23-2006 12:01 PM

> How can dd be used to have those backups? What about utility like pdumpfs,cpbk?

Never heard of dumpfs or cpbk.

Google around for a tutorial on using dump and restore. dracae probably knows better than me -- I don't think dd knows to avoid /proc, /sys, and /dev. There's whole books written on doing backups. :)

haertig 02-23-2006 12:53 PM

Quote:

Originally Posted by kushalkoolwal
I would like to back up my root partition on my drive i.e. /dev/hda1 on which I have Debian installed. What is the easiest way to make a compresssed backup copy of the /dev/hda1 partition.

First, you don't want to be writing to the partition while you're backing it up. Second, storing the backup of partition hda1 on some other partition of disk hda does not provide you much protection should hda fail. I suggest booting Knoppix and doing the imaging to a remote system from there. One way I have played with this in the past is (hope I'm remembering the syntax correctly):

Boot Knoppix and open a terminal window:
Code:

$ su
# dd if=/dev/hda1 | gzip | ssh userid@remote_host 'dd of=hda1.gz'

This should give you a compressed copy over on remote_host in userid's home directory. Make sure you have enough disk space there, or alter the destination path to some better place. Of course, not everybody has multiple Linux boxes at their disposal for the above command to work. If you have other Windows boxes available over the LAN you could share one of their drives, mount it to your Linux box using smbfs, and then dd over the network that way.

Alternately, you could make the image and store it locally, then manually transfer it or burn it to a CD or DVD. You're set if you have other partitions where you can store the image (you can't image /dev/hda1 and store it on /dev/hda1 at the same time!) But there's still the issue of not writing to /dev/hda1 while you're imaging it. Again, Knoppix to the rescue.

If you DON'T have other partitions to store the /dev/hda1 image on, it gets trickier. Where are you going to store the thing while it's being created? Direct to CD or DVD might be an option, but I don't know how to do that. There's a program named partimage that may have this capability, but I've never used it and couldn't tell you. Otherwise you'd need to come up with some kind of dd | mkisofs | cdrecord chain of events. I have no idea if that would even be possible.

leiavoia 02-23-2006 01:49 PM

I use rsync and backup to an external HD, for what it's worth. Works good for me.

kushalkoolwal 02-23-2006 04:47 PM

Quote:

Originally Posted by leiavoia
I use rsync and backup to an external HD, for what it's worth. Works good for me.

Ofcourse, I do not intend to backup on the same partition whose back up I want. All I am looking for is to backup my /dev/hda1 from /dev/hdb1(hard disk from which I will boot debian linux) and store the back up either on to a remote server or on /dev/hdb1.

So you guys think that rsync,backup,dd work?

Will dd exclude the /proc /sys and /dev?

Also can you give me example as to how to use rsync and backup?

dracae 02-23-2006 04:59 PM

Here is the easy way to use dump/restore
mkdir /backup; mount /dev/hdb1 /backup;( dump -0f - / ) | ( cd /backup ; restore -rf - )

leiavoia 02-23-2006 05:00 PM

for rsync, you just do:

$rsync -a /source/folder /destination/folder

That's it!

You can also compress it, but i leave mine uncompressed for quick access and since i could never fill 160GB on the backup drive anyway.

I wrote a dirt-simple perl script that automates it for me. It backs up only the folders i want.

nx5000 02-24-2006 04:46 AM

Quote:

apt-get install faubackup
Complete and then incremantal backup, you can directly browse in your backups . Incremental are made by hardlinks. simple, efficient.

Tar can do the same, complete and incremental backup.

Because you maybe not want to backup everything if only one file has changed, do you? (which also rsync handles)

jerril 02-24-2006 07:57 AM

Hi;

You might also want to check out Partimage:

http://www.partimage.org

jer

RodWC 02-24-2006 08:15 AM

I'm a traitor. I use Acronis. :( I'm thinking of using rsync though, once I get it all figured out. I'm sure that would be much faster than making a whole new disk image every time. The thing I worry about is restoration if my drive ever becomes completely wiped out. Will just copying the files (with cp or rsync) back onto a wiped disk, and then installing grub, make it bootable? I have my doubts. That's why I haven't done it yet!

leiavoia, it would be pretty cool if you would go ahead and post an example of the script you have created. ;) BTW, does rsync delete files that are only in the destination? I'd like a util that does that.

dajlinuxorg 03-11-2009 04:47 PM

Acronis vs Rsync
 
Haha! I'm getting on the Acronis bus too. Just for the initial pre-patch imaging though. That was I will always have a quick backup of the OS to convert back to in the event of a disaster.

We are actually going to implement rsync as part of our DR solution and replicate between Production and the mirrored DR servers in a separate location. Hopefully it works.

I would love to see some existing scripts or related rsync tips or tricks that people are using. This is my first time attempting to use it, wish me luck!

Thnx in advance,

DJ


All times are GMT -5. The time now is 08:15 PM.