LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-04-2007, 01:47 PM   #376
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15

Hi,
What is the command for running DD in reverse (starting at the end of the partition and working towards the front? I think this is possible with DD. Sorry if it's been mentioned already but I can't find it.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-04-2007, 06:42 PM   #377
terryxela
Member
 
Registered: Dec 2006
Location: Denver, Colorado, USA
Distribution: SuSE 11.3
Posts: 127

Rep: Reputation: 17
DD nfs and backup.

I have a laptop with 3 partitions /boot / /home. The laptop is in a lan with nfs. Can I use dd from one of the other machines to backup the laptop?
At the present I use tar but I was wondering what would be the format of dd to back each of the partition in the laptop.
TIA
-=terry=-
 
Old 10-05-2007, 08:56 PM   #378
dafunks
Member
 
Registered: Sep 2007
Location: UK
Distribution: Slackware 12
Posts: 62

Rep: Reputation: 15
Different class, thanks
 
Old 10-08-2007, 03:44 PM   #379
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Rep: Reputation: 31
AwesomeMachine thank you.

DD is beyond useful. The fact that DD comes with any linux installation makes life easy. Every live cd has it.

Running
dd if=/dev/sda of=/dev/sdb conv=notrunc,noerror

on a 160G drive took about 4 hours.

dd if=/dev/sda of=/dev/sdb bs=4M conv=notrunc,noerror

took 49 minutes. The speed gain is remarkable.

I used 4M instead of the suggested 4k because I have 3gig of RAM on my system.

-------------------------

I needed to copy a 164G drive to a 160G drive. In other words, I went from a larger drive to a smaller drive.
I used resize2fs on the larger drive as suggested by Matir, but it gave errors about some superblock not being readable.

So I just went ahead an unleashed DD on it regardless of the size difference between the drives.

I had two partitions on the source drive. Those partitions got created automatically on the destination drive.

Copy went ok without complaining about the destination drive being full.

So now I have a 160G drive saying it is 164G.
To my surprise, the new drive worked just fine.

-------------------------

I generally slap myself a few times each time I use DD, to make sure I'm not asleep.
One mistake of swapping if= for of=, and your data is gone. As noted by AwesomeMachine, DD=Data Destroyer.
 
Old 10-09-2007, 02:48 AM   #380
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
Quote:
Originally Posted by fw12 View Post

I needed to copy a 164G drive to a 160G drive. In other words, I went from a larger drive to a smaller drive.

So I just went ahead an unleashed DD on it regardless of the size difference between the drives.

I had two partitions on the source drive. Those partitions got created automatically on the destination drive.

Copy went ok without complaining about the destination drive being full.

So now I have a 160G drive saying it is 164G.
To my surprise, the new drive worked just fine.
What happens when your disk gets really full are tries to write to the last 4 gigabytes of the disk that it thinks is there?
 
Old 10-09-2007, 03:06 PM   #381
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
I can't confirm it as I have not done tests on it but I believe one can dd a larger disk into a smaller if the partition table in the larger disk can be fitted into the smaller disk. There have reports saying dd were successful in such situations.

The above means when the capacity of the bigger disk less the empty space is small enough to fit into the smaller disk.

As an example one wants to dd a 200Gb disk into a 100Gb disk. The 200Gb has only the first 75Gb filled and the remaining 125Gb is empty space. The partition table has entries indicating the last partition boundary stops at the end of 75Gb and no more. dd will copy the partition table across and will try to clone all 200Gb but has to stop after the target disk has been exhausted. By which time the 75Gb would be fully clones.

If the hard disk has no empty space then dd will fail because no operating system would touch a disk with a partition table showing more space than the hard disk physically got.
 
Old 10-10-2007, 02:38 AM   #382
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
Quote:
Originally Posted by saikee View Post
I can't confirm it as I have not done tests on it but I believe one can dd a larger disk into a smaller if the partition table in the larger disk can be fitted into the smaller disk. There have reports saying dd were successful in such situations.

The above means when the capacity of the bigger disk less the empty space is small enough to fit into the smaller disk.

As an example one wants to dd a 200Gb disk into a 100Gb disk. The 200Gb has only the first 75Gb filled and the remaining 125Gb is empty space. The partition table has entries indicating the last partition boundary stops at the end of 75Gb and no more. dd will copy the partition table across and will try to clone all 200Gb but has to stop after the target disk has been exhausted. By which time the 75Gb would be fully clones.
Sorry to take issue with you again, the situation you describe above is different: there is space within the partition for the data and the system either recognizes the real size of the partition or the smaller size within the existing partition.

The op speaks of transferring data from a larger disk to smaller disk but in this case the operating system sees the partition as _bigger_ than the physical one.

Quote:
Originally Posted by saikee View Post
If the hard disk has no empty space then dd will fail because no operating system would touch a disk with a partition table showing more space than the hard disk physically got.
But this can happen: consider 48bit LBA addressing. A common effect of this is that the operating system attempts to write to a sector that it thinks is there but isn't it writes to the boot sector and onwards and totally corrupts the disk! Fixes are available from NT4 onwards

The OP would be well advised to run gparted or gnome partition editor or some similar partitioning editor of disks to hopefully ensure that this does't happen.

Last edited by jasee; 10-10-2007 at 02:42 AM.
 
Old 10-10-2007, 02:46 AM   #383
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
I posted because I have tried it before and it didn't work. Here is the thread

Like I said the first sector dd copies from one hard disk to another has the partition table. If the boundary in the partition table is bigger than the physical hard disk then as an operating system yourself, what could you do?

An operating system has to guarantee the data integrity if it read/write a hard disk! So it plays safe and refuses to read it. That is the best policy.

You can also try to partition a Pata disk to 63 partition with a Linux having a kernel older than 2.6.20 and ask the current Linux to read it. The answer is the new Linux, supporting a Pata disk same as a Sata/SCSI/USB with a maximum of 15 partitions, simply treat the old disk a raw disk and unformatted because the new kernel does not know how to handle it. (some may still support the Pata 63 partitions in the interim period)

Last edited by saikee; 10-10-2007 at 02:51 AM.
 
Old 10-10-2007, 04:01 AM   #384
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Found the time to read it at last...
Thank you for your efforts AwesomeMachine.
 
Old 10-10-2007, 04:02 AM   #385
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by jasee View Post
...What is the command for running DD in reverse...
dd_rescue AFAIR, then at

http://www.garloff.de/kurt/linux/ddrescue/

as posted by the thread starter.

Last edited by JZL240I-U; 10-10-2007 at 07:26 AM.
 
Old 10-10-2007, 01:50 PM   #386
hGi'mD
LQ Newbie
 
Registered: Oct 2007
Posts: 10

Rep: Reputation: 0
Make USB key bootable

Hi - I've followed your instructions for "To make a bootable USB thumb drive: ...". DD executed without errors. When I tried to boot from the USB key the screen turned black with a blinking cursor (verified boot order).
Here's what I've done to prep the key:
plugged key in
downloaded ISO (tried it with other ISOs as well)
used gparted to verify path of device
ran dd and rebooted.

Am I missing a step?

Thanks.
 
Old 10-10-2007, 10:34 PM   #387
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Rep: Reputation: 31
Quote:
What happens when your disk gets really full are tries to write to the last 4 gigabytes of the disk that it thinks is there?
You're correct. I don't recommend anybody do what I've done, but it was the only solution I could come up with at the time.

In any event, my 160Gb drive will never come close to filling up before it has to be replaced. So, the issue you raised will never come to pass.

DD is great, with the only setback that the source and destinations drives must be the same size.
 
Old 10-11-2007, 01:02 AM   #388
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by fw12 View Post
...In any event, my 160Gb drive will never come close to filling up before it has to be replaced. So, the issue you raised will never come to pass....
But if it does, just call fdisk and use expert mode to set the heads / blocks / cylinders parameters. The OP has posted how to calculate the accurate values...

Quote:
Originally Posted by fw12 View Post
... DD is great, with the only setback that the source and destinations drives must be the same size.
No, they don't really have to. The OP has shown how to "skip" and "seek" the appropriate places on the hd and how to write to a file and / or compress. Take some time to re-read, then you'll be better prepared for the next time .

No matter as long as it works for you, I just thought I'd mention this .
 
Old 10-11-2007, 03:34 AM   #389
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
Quote:
Originally Posted by fw12 View Post
You're correct. I don't recommend anybody do what I've done, but it was the only solution I could come up with at the time.

In any event, my 160Gb drive will never come close to filling up before it has to be replaced. So, the issue you raised will never come to pass.
Just be aware that files can be scattered all over a partition well before a disk becomes nearly full.

Quote:
Originally Posted by fw12 View Post
DD is great, with the only setback that the source and destinations drives must be the same size.
It's simpler to use if the source and destination partition are the same size.


Quote:
Originally Posted by JZL240I-U View Post
But if it does, just call fdisk and use expert mode to set the heads / blocks / cylinders parameters. The OP has posted how to calculate the accurate values...
I really can't see why it's really necessary to go to so much trouble. Nowadays there are simple graphic utilities for resizing and copying partitions. I'm mentioned them before gparted and gnome partition editor. These work exceedingly well with linux and windows formatted disks and partitions. Probably you've got one or both of these. Otherwise find a bootable iso of them. It is then child's play to copy resize any partitions (lvm (linux) and dynamic disks (windows) are the exception)).

Just because it's linux doesn't mean you have always work at the terminal prompt, it doesn't make it better! We're not in the dark ages!

IMO dd is best used for hard disk rescue. Transferring the contents of a mountable but maybe corrupt partition to another disk for analysis and recovery. But there are other tools which are more versatile than dd to do this. These are ddrescue and dd_rescue (most verstile with dd_rhelp). A modern distro may already have either one of these. Unfortunately, these both work from a terminal prompt, as the starter of this thread will appreciate no doubt :-) but the latter allows you to work with dd_rhelp a sort of logging and simple batch file which you can customise to make as many passes as you dare at a failing hard disk partitiom and recover a readable partition.
 
Old 10-11-2007, 03:36 AM   #390
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
Quote:
Originally Posted by JZL240I-U View Post
dd_rescue AFAIR, then at

http://www.garloff.de/kurt/linux/ddrescue/

as posted by the thread starter.
Thanks yes, I know ddrescue (and dd_rescue) will both do it.
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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