LinuxQuestions.org
Visit Jeremy's Blog.
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
 
LinkBack Search this Thread
Old 04-19-2012, 02:39 AM   #751
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,019

Rep: Reputation: 284Reputation: 284Reputation: 284
How DD threat bad sectors when cloning?


How DD threat bad sectors when cloning? Got 500GB HDD that is starting to falling, it is just a system drive no data to backup, will DD make a clean copy of the system when the drive has bad sectors?

Regards
 
1 members found this post helpful.
Old 04-19-2012, 02:46 AM   #752
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,514
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
The best you can do is use conv=sync,noerror on the dd command so it leaves empty blocks when it gets an error when reading the input. That way, the blocks on the output HDD end up in the right places.
 
2 members found this post helpful.
Old 04-19-2012, 03:34 AM   #753
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,019

Rep: Reputation: 284Reputation: 284Reputation: 284
Quote:
Originally Posted by catkin View Post
The best you can do is use conv=sync,noerror on the dd command so it leaves empty blocks when it gets an error when reading the input. That way, the blocks on the output HDD end up in the right places.
Thank you.
 
1 members found this post helpful.
Old 04-19-2012, 04:38 AM   #754
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,534
Blog Entries: 51

Rep: Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604
The best you can do is use dd as described by catkin and check out ddrescue and dd_rescue. Both offer options not present in 'dd' like reading a disk back-to-front, retrying and copy rate adjusting.
 
1 members found this post helpful.
Old 04-19-2012, 02:23 PM   #755
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,019

Rep: Reputation: 284Reputation: 284Reputation: 284
Quote:
Originally Posted by unSpawn View Post
The best you can do is use dd as described by catkin and check out ddrescue and dd_rescue. Both offer options not present in 'dd' like reading a disk back-to-front, retrying and copy rate adjusting.
That is really good to know, thank you.
I hope that using DD will be possible to avoid reinstall the system again(ugh), it is a big install of programs.

Regards
 
1 members found this post helpful.
Old 04-20-2012, 07:11 AM   #756
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,019

Rep: Reputation: 284Reputation: 284Reputation: 284
Code:
dd if=/dev/sda of=/dev/sdb bs=512 conv=sync,noerror
I did the above command it did copied the whole disk, but not all the partitions content, just the 1st one had the data copied, it generated all the partitions thou the 2nd and so are empty. Why is that so?

Regards
 
Old 04-20-2012, 08:56 AM   #757
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,514
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
Originally Posted by ukiuki View Post
Code:
dd if=/dev/sda of=/dev/sdb bs=512 conv=sync,noerror
I did the above command it did copied the whole disk, but not all the partitions content, just the 1st one had the data copied, it generated all the partitions thou the 2nd and so are empty. Why is that so?

Regards
Because the partition table is at the beginning of the disk after the 446 byte master Boot Record (MBR). What you are seeing suggests the early part of the dying HDD is readable but the later parts not. The first partition may not be completely populated. You could try fscking the copy (not the original or you may further damage it).
 
1 members found this post helpful.
Old 04-20-2012, 10:13 AM   #758
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,019

Rep: Reputation: 284Reputation: 284Reputation: 284
Quote:
Originally Posted by catkin View Post
Because the partition table is at the beginning of the disk after the 446 byte master Boot Record (MBR). What you are seeing suggests the early part of the dying HDD is readable but the later parts not. The first partition may not be completely populated. You could try fscking the copy (not the original or you may further damage it).
The problem is with the SMART.
Ok i got this with Clonezilla !! Not sure what happened with DD but now it is working just fine all partitions has been cloned and running!

Regards
 
Old 05-19-2012, 06:21 AM   #759
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,589

Original Poster
Rep: Reputation: 161Reputation: 161
Post manufacturer's disk repair utility, dd, ddrescue, foremost, fsck

Quote:
Originally Posted by ukiuki View Post
How DD threat bad sectors when cloning? Got 500GB HDD that is starting to falling, it is just a system drive no data to backup, will DD make a clean copy of the system when the drive has bad sectors?

Regards
Usually the best thing is to use the manufacturer's repair utility, seatools, wddiag, etc; and do a nondestructive scan for bad sectors.

The data can usually be successfully relocated from the failing sectors to extra sectors on the drive used for this purpose.

That's the first line of defense. Most drives are not really failing. They just have an imperfect area on one surface platter. My experience has been that running the utility permanently solves the problem, and the drive works for five or ten years more.

But, the test can fail if the drive controller is bad. The utility prints a report.

dd is not a sophisticated recovery tool. It's my last choice. I've never used dd for data recovery. But dd has an undocumented function. Over time, data tracks expand. This can give bad blocks errors. So, you can write the drive back to itself:

dd if=/dev/sda of=/dev/sda

That tightens the tracks.

ddrescue is better. It contains sophisticated algorithms to read the edges of bad tracks, to repeatedly read the same track and pick up a little bit more of the data with each pass, to read the drive backwards, to guess at the correct contents to fill small unrecoverable gaps within blocks of recovered data, to operate without a valid partition table, but I have seen it fail.

foremost is a file carver. It will carve out every file. The problem is it doesn't preserve the file names (uses numbers instead), recovers deleted files, recovers only a small number of file types by default, groups the files in a directory tree according to file type.

But I've seen foremost recover everything off a DVD+R that looked like it had been put under a vehicle tire for traction to get out of a snow bank. I had a CD that I scored with deep knife cuts for disposal, but I messed up. Then I had to recover the data.

Foremost can recover everything from a disk like that. The moral is, it takes a bit of work and ingenuity to render a CD safe for disposal.

Everything has some risk, but fsck has a map and relocate bad blocks function that gives you an idea of what eternity might be like, but it's one of the safest remedies.

You choose based on how critical the operation is.
 
2 members found this post helpful.
Old 05-22-2012, 02:24 PM   #760
slxu
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Awsome!

This thread really helps me a lot.
 
Old 09-05-2012, 01:27 AM   #761
apjena
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
very nice post on dd

Thanks for this nice educative post. I just wonder can anyone give a reason why dd if=...iso of=/dev/sdb to create a bootable flash works sometime and sometime not. It seems a powerful command but it doesnot work sometimes where MS Windows programs like lilo (great app though) work on same flash drive and same iso.
 
Old 09-05-2012, 05:03 AM   #762
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,880
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
Copying an ISO image to a disk using dd is only possible if the ISO image is a hybrid-ISO.
 
Old 09-05-2012, 08:21 AM   #763
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-19-live-usb/ aix
Posts: 3,553

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Quote:
Originally Posted by apjena View Post
Thanks for this nice educative post. I just wonder can anyone give a reason why dd if=...iso of=/dev/sdb to create a bootable flash works sometime and sometime not. It seems a powerful command but it doesnot work sometimes where MS Windows programs like lilo (great app though) work on same flash drive and same iso.
i dont think lilo is an ms windows program ?

if you run the file command it will tell you if your iso is a partition or an image of a full disk including boot sector and partition table (judging by your example command you are expecting the latter).
 
Old 09-09-2012, 05:49 AM   #764
nug121
LQ Newbie
 
Registered: Sep 2012
Distribution: Sidsqueezywheezygnudeblinux
Posts: 1

Rep: Reputation: Disabled
Thumbs up DD post..

Thank you for writing that post. I am tired and needed to go to sleep a while ago but reading that kept me up and caused me to register on this site and post.
 
Old 09-23-2012, 05:51 AM   #765
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,589

Original Poster
Rep: Reputation: 161Reputation: 161
Smile U3

Quote:
Originally Posted by apjena View Post
Thanks for this nice educative post. I just wonder can anyone give a reason why dd if=...iso of=/dev/sdb to create a bootable flash works sometime and sometime not. It seems a powerful command but it doesnot work sometimes where MS Windows programs like lilo (great app though) work on same flash drive and same iso.
U3 -Awesome
 
1 members found this post helpful.
  


Reply

Tags
backup, best, clonezilla, cloning, command, data, dd, disk, drive, duplicate, erase, explanation, formatting, ghost, hard, image, iso, memory, ping, popular, recover, recovery, rescue, search, security, stick, upgrade, usb, wipe


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learn The DD command AwesomeMachine Linux - Newbie 17 08-17-2006 04:22 AM
The best way to learn? iz3r Programming 7 02-06-2005 11:00 PM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 03:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 01:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 01:02 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration