LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-30-2007, 01:14 PM   #1
xomic
LQ Newbie
 
Registered: Dec 2004
Posts: 20

Rep: Reputation: 0
tool to clone my hd regularly for backup reasons


Hi everyone!


Background:
I got 2 identical hard disks. On the fist is gentoo linux and all of my files. The second is still empty.

The idea is to clone the first hd to the second regularly (once a week - or maybe twice) for backup. So - in the case of a crash - I just need to swap the hds to boot my ("backuped") system without doing anything else.

I searched a while but it seems to me that the only way to clone a hd with a unix file system is to copy it cluster by cluster which makes about 5 hours(!)for my 160 GB. And that is not acceptable.


Does anyone know a tool that can help me?
(And don't answer 'dd' because it the same as I mentioned)


Thanks to anyone,


xomic





[x means unknown
o means original
m means male
i means intelligent
c means confused]

Last edited by xomic; 05-30-2007 at 01:15 PM.
 
Old 05-30-2007, 02:05 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

'rsync' is probably the tool of choice if you want to do occasional backups. It'll still take a while, but should be significantly less than doing a dd from one drive to the other.

You'll have to partition the spare drive to have the same partitions as the original drive, then mount each partition where it would normally be mounted, but with the spare root partition in a directory, e.g.

Original:
Code:
/
/var
/home
Spare:
Code:
/backup            <- /
/backup/var        <- /var
/backup/home       <- /home
(change to suit your filesystem layout, of course)

Then do 'rsync -av / /backup' to sync everything.
You'll have to copy the MBR from the original drive onto the spare too, though, with 'dd if=/dev/hdX of=/dev/hdY count=1 bs=512' where hdX is the original drive and hdY is the spare.

Be extremely careful with both commands. Get either wrong and you'll hose the system.

You might want to just RAID 1 the two drives with 'md' (or with hardware(ish) RAID, if your motherboard can do that). That will keep both drives synced, and you'll (probably) gain read speed too. Does mean both drives will be running all the time, though.

Dave

Last edited by ilikejam; 05-30-2007 at 02:10 PM.
 
Old 05-30-2007, 04:18 PM   #3
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Rep: Reputation: 30
Yes I will suggest DD

I would go RAID too.

but if you don't want to do that or rsync

I will suggest dd again, because there are ways to speed dd up. Have you used this option?

bs=xxxxy

this allows the system to copy xxx*k bytes by reading and writing at the same time, with a much larger block size.
xxx are bytes and y is a multiplier ('man dd' for more info)
Don't make the value too high or else you'll exceed your memory
Theoretically, the larger the block size, the faster the copy can go, up to a certain limit (it's like a parabolic graph). DD's default is some kind of crazy amount like 512 bytes (I forgot)

Anyway, just to give you a overview of how long it would take with 160GB:

I back up 108 G of data (using the count=option, and because I only paritioned the drive to 105G) using DD from an internal IDE HDD to an external USB HDD

I usually use bs=1000k (I have 512 MB of memory, a 2.4 GHZ P4 CPU)

it takes me about an hour. I usually get more than 28 MB/s, and i think you should get more if you don't use USB, since USB uses lots of processor for transfer

ps. dd_rescue cannot read/write at the same time, I think.
 
  


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
Can't clone FC6 using tar-backup and restore skellert Fedora 10 03-30-2007 06:13 PM
clone HD or backup partition image to CD? jovie Linux - Newbie 3 06-23-2006 02:25 PM
Backup tool shooters Linux - Newbie 9 12-15-2005 02:29 PM
How to clone or backup Linux boot drive? RodWC Linux - General 8 11-13-2005 09:00 AM
Clone Backup plz Help neos Linux - Newbie 4 02-11-2005 02:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:30 PM.

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