LinuxQuestions.org
Visit Jeremy's Blog.
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 12-13-2009, 03:12 PM   #1
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
Fast and accurate backup of partiton?


Hi all. I currently have 3 hdd's in my machine (sda, sdb, sdc) Sdb is beginning to throw errors so I bought a new hard drive which is sdc. Sdb and Sdc each currently have a single partition formatted to ext4. Is there a preffered method to clone one harddrive/partition to another without creating an .iso?

Essentially I just want to get all the files with the existing directory structure form the failing drive to the new one (as fast as possible) so that the fail can be pulled and I can avoid any reconfiguration except to resetting the mount points.

Thanks
 
Old 12-13-2009, 03:27 PM   #2
worm5252
Member
 
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Rep: Reputation: 57
man dd
 
Old 12-13-2009, 03:40 PM   #3
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949

Original Poster
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
I thought dd was for creating image files? I am just wanting to get a working duplicate of the partition without an intermediate step. It seemed that rsync or maybe cp would be the way to go, but I'm not sure of the options or which is more less likely to create corrupted files.
 
Old 12-13-2009, 03:56 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

worm5252 is correct, using dd would be a good way to clone a disk in one go.

Take a look here: Learn The DD Command Revised (here at LQ).

I think you are looking for something like this: dd if=/dev/sdb1 of=/dev/sdc1 bs=4096 conv=notrunc,noerror

I do assume your original post is correct by stating that sdb is the "old" drive and sdc is the clean, new drive. So data goes from sdb -> sdc.

sdc1 will be an exact copy of sdb1, including size, data and UUID's.

Make sure you understand what this command does and check if my assumed in and outfile are correct, doing it wrong can compromise your data!! Do, at least, read the part about the command I suggested in the given link.

Hope this helps.
 
Old 12-13-2009, 03:59 PM   #5
worm5252
Member
 
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Rep: Reputation: 57
dd is used for a lot of things. Creating iso is one use for dd. extracting an iso to a file system is another use, and copying file system structures locally is another use.
 
Old 12-13-2009, 04:11 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
dd has its uses - creating backups ain't one of them. Do you *really* want to keep going unknowing copying corrupted files if there are read errors on the source ?.
Not me.

Use a filesystem aware method - either cp or rsync will do the job nicely, even if the sizes are different, so long as the target is big enough. Personally I prefer the former run from a liveCD
Code:
cp -a <source_mount_point>/* <target_mount_point>/
 
Old 12-13-2009, 08:52 PM   #7
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949

Original Poster
Blog Entries: 8

Rep: Reputation: 203Reputation: 203Reputation: 203
I went with cp -a. There were about 20 files (thankfully that didn't mean a whole lot) that wouldn't copy due to what I'm assuming was a corrupted disk. The only thing that seems weird to me is that the new partition, minus 20 or so files, shows to be using an additional 2GB of diskspace? Maybe due to it being a primary partition? I'm going to have to figure out why the second partition is always sdx5. That one still confuses me.
 
  


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
How accurate is lm_sensors? MyHeartPumpsFreon Linux - Software 1 12-02-2007 12:51 PM
USB Backup and Restore - Fast and reliable way clpl1980 Fedora 1 02-04-2007 05:36 PM
How accurate is LM_Sensors Mojojo Linux - Software 0 12-23-2004 07:49 AM
How do I keep accurate time? teeno Linux - Software 8 10-11-2003 07:04 PM
make new Partiton for backup while re-install qwijibow Linux - Newbie 1 08-30-2003 03:49 PM

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

All times are GMT -5. The time now is 02:54 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