LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
Search this Thread
Old 09-19-2006, 02:00 PM   #211
psjoberg
LQ Newbie
 
Registered: May 2001
Posts: 2

Rep: Reputation: 0
dd retries forever


I'm trying to use dd to copy whatever data I can from a bad to a good disk but bumped into a problem that dd retires the same sector forever (or at least hours).

For example, I did
Code:
strace dd if=/dev/sdb of=/dev/sdc bs=512 seek=122030010 skip=122030010 count=1 conv=noerror,notrunc
and exepected it to fail to copy one sector (that one isn'r readable) but it did retry over and over. The stray shows how it does
Code:
lseek(0, 0, SEEK_CUR)                   = 62479380480
ioctl(0, MGSL_IOCSTXIDLE or MTIOCGET or SNDCTL_MIDI_MPUCMD, 0x7fffcc749dc0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(0, 512, SEEK_CUR)                 = 62479380992
read(0, 0x50c000, 512)                  = -1 EIO (Input/output error)
repeated over and over for 1h.
Is it a bug in dd (v5.93) or did I fiddle wrong with my parameters ?

/ps
 
Old 09-20-2006, 07:44 AM   #212
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 114Reputation: 114
Try moving the conv= to the front of the dd statement.
 
Old 09-20-2006, 01:10 PM   #213
booyaadewd
LQ Newbie
 
Registered: Sep 2006
Posts: 9

Rep: Reputation: 0
Good Morning,

I have a question. I would like to use dd to wipe a drive, i can do this no problem with the command:

dd if=/dev/zero of=/dev/hda bs=1024

what i want to do is actually email a log with the date, time, computer name, and wether the script completed okay to someone.

How could i do this at the command line? Keep in mind i would like to use the a very minimal kernel install to do this. (I think im going to have to add mail to tthe kernel)

thanks
booyaa
 
Old 09-20-2006, 01:25 PM   #214
NapalmD
LQ Newbie
 
Registered: Apr 2006
Location: Portugal
Distribution: lots
Posts: 21

Rep: Reputation: 15
Quote:
Originally Posted by NapalmD
lol, it is working fine, despite that 15GB problem!
I have a temporary HD(80Gb) to put the 40GB data to fix this problem... sorry but I didnt understand correctly your last tips...
so 1st I need to put hda1 (15gb) in hdb1 in some way, but I need to create partitions 1st in this temporary HD right?
then will I need to format the hda1? how is that done?

then, transfer the data back to where it belongs but using all space provided by 37gb partition, how is that dd done?

I have read the 1st post, but it seems that it didnt work the way I liked. sorry but because I'm not good in english maybe I missed some word

thanks
I was able to do the trick with cp -a * /mnt/backup
then mkfs.ext3 /dev/hda1
then files back with cp -a again..
then it certainly would work...
I've read this in a google search, it seems that dd does not work right when copying from a small to a bigger drive...
 
Old 09-20-2006, 04:58 PM   #215
linuxquestionsorg42
LQ Newbie
 
Registered: Sep 2006
Posts: 9

Rep: Reputation: 0
Thumbs up Will this be in the Linux Tutorial section?

Quote:
Originally Posted by AwesomeMachine
dd [I][COLOR="DarkSlateGray"][SIZE="4"]Most comprehensive documentation and example sheet for one of the most useful linux/UNIX commands, "dd".
Will this be in the Linux Tutorial section?

Thank you.
 
Old 09-21-2006, 01:34 AM   #216
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,604

Rep: Reputation: 47
Suggestions to add to the topic

AwesomeMachine,

You have done a great work/tutorial . If this goes to the TLDP
or if you keep enhancing the thread, here are some suggestions:

add http://dcfldd.sourceforge.net/ where ddrescue is
maybe talk about http://linux.maruhn.com/sec/sdd.html
(I have no experience with sdd)

external links (this one was quite comprehensive
"Unix dd command and image creation"
by Softpanorama: (slightly skeptical) Open Source Software Educational Society
http://www.softpanorama.org/Tools/dd.shtml

I let you know if I have further ideas
 
Old 09-26-2006, 03:17 AM   #217
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Sorry this took me so long. I was away.

Quote:
Originally Posted by booyaadewd
Good Morning,

I have a question. I would like to use dd to wipe a drive, i can do this no problem with the command:

dd if=/dev/zero of=/dev/hda bs=1024

what i want to do is actually email a log with the date, time, computer name, and wether the script completed okay to someone.

How could i do this at the command line? Keep in mind i would like to use the a very minimal kernel install to do this. (I think im going to have to add mail to tthe kernel)

thanks
booyaa
If you boot from a live CD, such as Helix, which is linked in the OP, you can run dd, and email the logs entries with the live CD. Knoppix would also work for this. I don't recommend using the same kernel you are erasing to run dd. You should use a live CD.
 
Old 09-26-2006, 03:18 AM   #218
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Link

Quote:
Originally Posted by linuxquestionsorg42
Will this be in the Linux Tutorial section?

Thank you.
In the dd tutorial there is a link to this post.
 
Old 09-26-2006, 03:20 AM   #219
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
ddrescue

Quote:
Originally Posted by psjoberg
I'm trying to use dd to copy whatever data I can from a bad to a good disk but bumped into a problem that dd retires the same sector forever (or at least hours).

For example, I did
Code:
strace dd if=/dev/sdb of=/dev/sdc bs=512 seek=122030010 skip=122030010 count=1 conv=noerror,notrunc
and exepected it to fail to copy one sector (that one isn'r readable) but it did retry over and over. The stray shows how it does
Code:
lseek(0, 0, SEEK_CUR)                   = 62479380480
ioctl(0, MGSL_IOCSTXIDLE or MTIOCGET or SNDCTL_MIDI_MPUCMD, 0x7fffcc749dc0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(0, 512, SEEK_CUR)                 = 62479380992
read(0, 0x50c000, 512)                  = -1 EIO (Input/output error)
repeated over and over for 1h.
Is it a bug in dd (v5.93) or did I fiddle wrong with my parameters ?

/ps
Try using ddrescue. It is linked in the OP. It works the same way as dd, but it will work with bad media.
 
Old 09-26-2006, 03:23 AM   #220
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
mke2fs

Quote:
Originally Posted by NapalmD
lol, it is working fine, despite that 15GB problem!
I have a temporary HD(80Gb) to put the 40GB data to fix this problem... sorry but I didnt understand correctly your last tips...
so 1st I need to put hda1 (15gb) in hdb1 in some way, but I need to create partitions 1st in this temporary HD right?
then will I need to format the hda1? how is that done?

then, transfer the data back to where it belongs but using all space provided by 37gb partition, how is that dd done?

I have read the 1st post, but it seems that it didnt work the way I liked. sorry but because I'm not good in english maybe I missed some word

thanks
Use the command mke2fs to make a ext2 or ext3 file system. man mke2fs for info
 
Old 09-26-2006, 03:29 AM   #221
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Have you considered overhauling the original post in terms of layout/paragraph
and colorisation? The content is fine, but it's such an eye-sore.


Cheers,
Tink
 
Old 09-26-2006, 03:53 AM   #222
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Smile I'm limited on space.

Quote:
Originally Posted by Tinkster
Have you considered overhauling the original post in terms of layout/paragraph
and colorisation? The content is fine, but it's such an eye-sore.


Cheers,
Tink
Tink,

I'm almost at the maximum word count in the OP. I don't have much flexibility on paragraph styling, although I admit a little more "white space" would be attractive. Blank lines count toward total word count, so I'm in a pinch. If you would PM me I would be willing to listen to some thoughts on colorisation. I myself am not able to PM you for lack of sufficient board privileges. I'm open to suggestions, but this is off topic.
 
Old 09-26-2006, 04:53 AM   #223
sardaukar_siet
Member
 
Registered: Feb 2003
Location: Warsaw
Distribution: Fedora 8
Posts: 58

Rep: Reputation: 15
Question extracting boot sectors

Hello.

I used to extract boot info from Linux partitions by copying the first 512 bytes to a file, like so :

dd if=/dev/<partition with boot info> of=bootsect.lnx bs=512 count=1

The produced file is suitable to work with XP's ntldr, editing boot.ini. This way dual boot is clean and easy, since upgrading Windows won't wipe Linux's boot info as long as you keep the file.

But this only works for simple partitions. How can I make it work with LVM or MDraid partitions? Where is the boot info located in them?

Thanks in advance!
 
Old 09-27-2006, 02:59 AM   #224
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Smile

Quote:
Originally Posted by sardaukar_siet
Hello.

I used to extract boot info from Linux partitions by copying the first 512 bytes to a file, like so :

dd if=/dev/<partition with boot info> of=bootsect.lnx bs=512 count=1

The produced file is suitable to work with XP's ntldr, editing boot.ini. This way dual boot is clean and easy, since upgrading Windows won't wipe Linux's boot info as long as you keep the file.

But this only works for simple partitions. How can I make it work with LVM or MDraid partitions? Where is the boot info located in them?

Thanks in advance!
Your are speaking of sector 1 on the HDD. This holds the partition table, among other things. Raid and LVM are special considerations. With software raid you must disconnect all but one disk, copy the info you need, make all your changes, and rebuild the raid array. This only works with RAID 0. Other types of raid will not respond well to dd. LVM is a special type of volume where the description is kept in an extended partition. How to find this information is really quite complex, and you have to have a good eye for what you looking for. These two types of applications are poor for using dd.
 
Old 09-27-2006, 04:24 AM   #225
prashant.gupta
LQ Newbie
 
Registered: Sep 2006
Posts: 1

Rep: Reputation: 0
This article on dd command is very nice. Can we get the dd command for windows/dos?
 
  


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


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 03:20 PM.

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