Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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=-
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.
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.
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
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.
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)
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.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
Quote:
Originally Posted by fw12
...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
... 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 .
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
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.